aboutsummaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-17 18:18:44 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-17 18:18:44 +0000
commit57623d42ebb04f0a0b9e6eb7c0847a3ece2aa0ff (patch)
tree25d07d14e920d31c0b1947c9ca586f2a01fc32d8 /nuttx/configs
downloadpx4-firmware-57623d42ebb04f0a0b9e6eb7c0847a3ece2aa0ff.tar.gz
px4-firmware-57623d42ebb04f0a0b9e6eb7c0847a3ece2aa0ff.tar.bz2
px4-firmware-57623d42ebb04f0a0b9e6eb7c0847a3ece2aa0ff.zip
Resync new repository with old repo r5166
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5153 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/Kconfig890
-rw-r--r--nuttx/configs/README.txt1873
-rw-r--r--nuttx/configs/amber/Kconfig4
-rw-r--r--nuttx/configs/amber/README.txt502
-rw-r--r--nuttx/configs/amber/hello/Make.defs150
-rw-r--r--nuttx/configs/amber/hello/appconfig39
-rw-r--r--nuttx/configs/amber/hello/defconfig416
-rw-r--r--nuttx/configs/amber/hello/ld.script211
-rwxr-xr-xnuttx/configs/amber/hello/setenv.sh63
-rw-r--r--nuttx/configs/amber/include/board.h100
-rw-r--r--nuttx/configs/amber/src/Makefile97
-rw-r--r--nuttx/configs/amber/src/amber_internal.h101
-rw-r--r--nuttx/configs/amber/src/up_boot.c93
-rw-r--r--nuttx/configs/avr32dev1/Kconfig8
-rw-r--r--nuttx/configs/avr32dev1/README.txt446
-rw-r--r--nuttx/configs/avr32dev1/include/board.h257
-rw-r--r--nuttx/configs/avr32dev1/nsh/Make.defs146
-rw-r--r--nuttx/configs/avr32dev1/nsh/appconfig44
-rwxr-xr-xnuttx/configs/avr32dev1/nsh/defconfig426
-rwxr-xr-xnuttx/configs/avr32dev1/nsh/ld.script105
-rwxr-xr-xnuttx/configs/avr32dev1/nsh/setenv.sh57
-rw-r--r--nuttx/configs/avr32dev1/ostest/Make.defs146
-rw-r--r--nuttx/configs/avr32dev1/ostest/appconfig39
-rwxr-xr-xnuttx/configs/avr32dev1/ostest/defconfig426
-rwxr-xr-xnuttx/configs/avr32dev1/ostest/ld.script105
-rwxr-xr-xnuttx/configs/avr32dev1/ostest/setenv.sh57
-rw-r--r--nuttx/configs/avr32dev1/ostest/test-result.txt404
-rw-r--r--nuttx/configs/avr32dev1/src/Makefile91
-rw-r--r--nuttx/configs/avr32dev1/src/avr32dev1_internal.h127
-rw-r--r--nuttx/configs/avr32dev1/src/up_boot.c84
-rw-r--r--nuttx/configs/avr32dev1/src/up_buttons.c185
-rw-r--r--nuttx/configs/avr32dev1/src/up_leds.c93
-rwxr-xr-xnuttx/configs/avr32dev1/tools/doisp.sh37
-rw-r--r--nuttx/configs/c5471evm/Kconfig13
-rw-r--r--nuttx/configs/c5471evm/README.txt149
-rw-r--r--nuttx/configs/c5471evm/doc/test-result.txt164
-rw-r--r--nuttx/configs/c5471evm/httpd/Make.defs120
-rw-r--r--nuttx/configs/c5471evm/httpd/appconfig46
-rw-r--r--nuttx/configs/c5471evm/httpd/defconfig261
-rw-r--r--nuttx/configs/c5471evm/httpd/ld.script107
-rwxr-xr-xnuttx/configs/c5471evm/httpd/setenv.sh46
-rw-r--r--nuttx/configs/c5471evm/include/README.txt1
-rw-r--r--nuttx/configs/c5471evm/include/board.h66
-rw-r--r--nuttx/configs/c5471evm/nettest/Make.defs120
-rw-r--r--nuttx/configs/c5471evm/nettest/appconfig43
-rw-r--r--nuttx/configs/c5471evm/nettest/defconfig261
-rw-r--r--nuttx/configs/c5471evm/nettest/ld.script107
-rwxr-xr-xnuttx/configs/c5471evm/nettest/setenv.sh46
-rw-r--r--nuttx/configs/c5471evm/nsh/Make.defs120
-rw-r--r--nuttx/configs/c5471evm/nsh/appconfig58
-rw-r--r--nuttx/configs/c5471evm/nsh/defconfig261
-rw-r--r--nuttx/configs/c5471evm/nsh/ld.script107
-rwxr-xr-xnuttx/configs/c5471evm/nsh/setenv.sh46
-rw-r--r--nuttx/configs/c5471evm/ostest/Make.defs120
-rw-r--r--nuttx/configs/c5471evm/ostest/appconfig39
-rw-r--r--nuttx/configs/c5471evm/ostest/defconfig261
-rw-r--r--nuttx/configs/c5471evm/ostest/ld.script107
-rwxr-xr-xnuttx/configs/c5471evm/ostest/setenv.sh46
-rw-r--r--nuttx/configs/c5471evm/src/Makefile77
-rw-r--r--nuttx/configs/c5471evm/src/README.txt2
-rw-r--r--nuttx/configs/c5471evm/src/up_leds.c107
-rw-r--r--nuttx/configs/compal_e88/Kconfig4
-rw-r--r--nuttx/configs/compal_e88/README.txt52
-rw-r--r--nuttx/configs/compal_e88/include/board.h6
-rw-r--r--nuttx/configs/compal_e88/include/power.h6
-rw-r--r--nuttx/configs/compal_e88/nsh_highram/Make.defs129
-rw-r--r--nuttx/configs/compal_e88/nsh_highram/appconfig43
-rw-r--r--nuttx/configs/compal_e88/nsh_highram/defconfig280
-rw-r--r--nuttx/configs/compal_e88/nsh_highram/ld.script128
-rw-r--r--nuttx/configs/compal_e88/nsh_highram/setenv.sh46
-rw-r--r--nuttx/configs/compal_e88/src/Makefile80
-rw-r--r--nuttx/configs/compal_e88/src/dummy.c1
-rw-r--r--nuttx/configs/compal_e99/Kconfig4
-rw-r--r--nuttx/configs/compal_e99/README.txt52
-rw-r--r--nuttx/configs/compal_e99/include/board.h6
-rw-r--r--nuttx/configs/compal_e99/include/power.h6
-rw-r--r--nuttx/configs/compal_e99/nsh_compalram/Make.defs129
-rw-r--r--nuttx/configs/compal_e99/nsh_compalram/appconfig43
-rw-r--r--nuttx/configs/compal_e99/nsh_compalram/defconfig282
-rw-r--r--nuttx/configs/compal_e99/nsh_compalram/ld.script126
-rw-r--r--nuttx/configs/compal_e99/nsh_compalram/setenv.sh46
-rw-r--r--nuttx/configs/compal_e99/nsh_highram/Make.defs129
-rw-r--r--nuttx/configs/compal_e99/nsh_highram/appconfig49
-rw-r--r--nuttx/configs/compal_e99/nsh_highram/defconfig326
-rw-r--r--nuttx/configs/compal_e99/nsh_highram/ld.script128
-rw-r--r--nuttx/configs/compal_e99/nsh_highram/setenv.sh46
-rw-r--r--nuttx/configs/compal_e99/src/Makefile80
-rw-r--r--nuttx/configs/compal_e99/src/dummy.c1
-rw-r--r--nuttx/configs/compal_e99/src/ssd1783.c523
-rw-r--r--nuttx/configs/compal_e99/src/ssd1783.h110
-rw-r--r--nuttx/configs/demo9s12ne64/Kconfig8
-rw-r--r--nuttx/configs/demo9s12ne64/README.txt374
-rw-r--r--nuttx/configs/demo9s12ne64/include/board.h143
-rw-r--r--nuttx/configs/demo9s12ne64/ostest/Make.defs153
-rw-r--r--nuttx/configs/demo9s12ne64/ostest/appconfig39
-rwxr-xr-xnuttx/configs/demo9s12ne64/ostest/defconfig396
-rwxr-xr-xnuttx/configs/demo9s12ne64/ostest/ld.script.banked143
-rwxr-xr-xnuttx/configs/demo9s12ne64/ostest/ld.script.nonbanked116
-rwxr-xr-xnuttx/configs/demo9s12ne64/ostest/setenv.sh46
-rw-r--r--nuttx/configs/demo9s12ne64/src/Makefile86
-rw-r--r--nuttx/configs/demo9s12ne64/src/demo9s12ne64.h91
-rw-r--r--nuttx/configs/demo9s12ne64/src/up_boot.c89
-rw-r--r--nuttx/configs/demo9s12ne64/src/up_buttons.c82
-rw-r--r--nuttx/configs/demo9s12ne64/src/up_leds.c108
-rw-r--r--nuttx/configs/demo9s12ne64/src/up_nsh.c86
-rw-r--r--nuttx/configs/demo9s12ne64/src/up_spi.c130
-rw-r--r--nuttx/configs/ea3131/Kconfig7
-rw-r--r--nuttx/configs/ea3131/README.txt636
-rw-r--r--nuttx/configs/ea3131/include/board.h167
-rw-r--r--nuttx/configs/ea3131/include/board_memorymap.h117
-rw-r--r--nuttx/configs/ea3131/locked/Makefile120
-rw-r--r--nuttx/configs/ea3131/locked/ld-locked.script43
-rwxr-xr-xnuttx/configs/ea3131/locked/mklocked.sh225
-rw-r--r--nuttx/configs/ea3131/nsh/Make.defs165
-rw-r--r--nuttx/configs/ea3131/nsh/appconfig44
-rw-r--r--nuttx/configs/ea3131/nsh/defconfig394
-rwxr-xr-xnuttx/configs/ea3131/nsh/setenv.sh66
-rw-r--r--nuttx/configs/ea3131/ostest/Make.defs165
-rw-r--r--nuttx/configs/ea3131/ostest/appconfig39
-rw-r--r--nuttx/configs/ea3131/ostest/defconfig394
-rwxr-xr-xnuttx/configs/ea3131/ostest/setenv.sh66
-rw-r--r--nuttx/configs/ea3131/pgnsh/Make.defs165
-rw-r--r--nuttx/configs/ea3131/pgnsh/appconfig45
-rw-r--r--nuttx/configs/ea3131/pgnsh/defconfig437
-rwxr-xr-xnuttx/configs/ea3131/pgnsh/setenv.sh66
-rw-r--r--nuttx/configs/ea3131/scripts/ld.script108
-rw-r--r--nuttx/configs/ea3131/scripts/pg-ld.script151
-rw-r--r--nuttx/configs/ea3131/src/Makefile105
-rw-r--r--nuttx/configs/ea3131/src/ea3131_internal.h127
-rw-r--r--nuttx/configs/ea3131/src/up_boot.c119
-rw-r--r--nuttx/configs/ea3131/src/up_buttons.c82
-rw-r--r--nuttx/configs/ea3131/src/up_clkinit.c444
-rw-r--r--nuttx/configs/ea3131/src/up_fillpage.c525
-rw-r--r--nuttx/configs/ea3131/src/up_leds.c111
-rw-r--r--nuttx/configs/ea3131/src/up_mem.c359
-rw-r--r--nuttx/configs/ea3131/src/up_nsh.c165
-rw-r--r--nuttx/configs/ea3131/src/up_spi.c142
-rw-r--r--nuttx/configs/ea3131/src/up_usbmsc.c126
-rw-r--r--nuttx/configs/ea3131/tools/Makefile53
-rw-r--r--nuttx/configs/ea3131/tools/armusbocd.cfg34
-rw-r--r--nuttx/configs/ea3131/tools/crc32.c123
-rw-r--r--nuttx/configs/ea3131/tools/lpchdr.c297
-rw-r--r--nuttx/configs/ea3131/tools/lpchdr.h105
-rwxr-xr-xnuttx/configs/ea3131/tools/mklpc.sh60
-rwxr-xr-xnuttx/configs/ea3131/tools/oocd.sh43
-rw-r--r--nuttx/configs/ea3131/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/ea3131/usbserial/Make.defs165
-rw-r--r--nuttx/configs/ea3131/usbserial/appconfig39
-rw-r--r--nuttx/configs/ea3131/usbserial/defconfig409
-rwxr-xr-xnuttx/configs/ea3131/usbserial/setenv.sh66
-rw-r--r--nuttx/configs/ea3131/usbstorage/Make.defs165
-rw-r--r--nuttx/configs/ea3131/usbstorage/appconfig39
-rw-r--r--nuttx/configs/ea3131/usbstorage/defconfig410
-rwxr-xr-xnuttx/configs/ea3131/usbstorage/setenv.sh66
-rw-r--r--nuttx/configs/ea3152/Kconfig7
-rw-r--r--nuttx/configs/ea3152/README.txt411
-rw-r--r--nuttx/configs/ea3152/include/board.h167
-rw-r--r--nuttx/configs/ea3152/include/board_memorymap.h117
-rw-r--r--nuttx/configs/ea3152/ostest/Make.defs165
-rw-r--r--nuttx/configs/ea3152/ostest/appconfig39
-rw-r--r--nuttx/configs/ea3152/ostest/defconfig395
-rwxr-xr-xnuttx/configs/ea3152/ostest/setenv.sh66
-rw-r--r--nuttx/configs/ea3152/scripts/ld.script107
-rw-r--r--nuttx/configs/ea3152/src/Makefile105
-rw-r--r--nuttx/configs/ea3152/src/ea3152_internal.h127
-rw-r--r--nuttx/configs/ea3152/src/up_boot.c119
-rw-r--r--nuttx/configs/ea3152/src/up_buttons.c82
-rw-r--r--nuttx/configs/ea3152/src/up_clkinit.c444
-rw-r--r--nuttx/configs/ea3152/src/up_fillpage.c525
-rw-r--r--nuttx/configs/ea3152/src/up_leds.c111
-rw-r--r--nuttx/configs/ea3152/src/up_mem.c359
-rw-r--r--nuttx/configs/ea3152/src/up_nsh.c165
-rw-r--r--nuttx/configs/ea3152/src/up_spi.c142
-rw-r--r--nuttx/configs/ea3152/src/up_usbmsc.c126
-rw-r--r--nuttx/configs/ea3152/tools/Makefile53
-rw-r--r--nuttx/configs/ea3152/tools/armusbocd.cfg34
-rw-r--r--nuttx/configs/ea3152/tools/crc32.c123
-rw-r--r--nuttx/configs/ea3152/tools/jlink.cfg8
-rw-r--r--nuttx/configs/ea3152/tools/lpc3152.cfg78
-rw-r--r--nuttx/configs/ea3152/tools/lpchdr.c297
-rw-r--r--nuttx/configs/ea3152/tools/lpchdr.h105
-rwxr-xr-xnuttx/configs/ea3152/tools/mklpc.sh60
-rw-r--r--nuttx/configs/ea3152/tools/olimex-arm-usb-ocd.cfg12
-rwxr-xr-xnuttx/configs/ea3152/tools/oocd.sh169
-rw-r--r--nuttx/configs/ea3152/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/eagle100/Kconfig13
-rw-r--r--nuttx/configs/eagle100/README.txt373
-rw-r--r--nuttx/configs/eagle100/httpd/Make.defs149
-rw-r--r--nuttx/configs/eagle100/httpd/appconfig46
-rw-r--r--nuttx/configs/eagle100/httpd/defconfig343
-rw-r--r--nuttx/configs/eagle100/httpd/ld.script112
-rwxr-xr-xnuttx/configs/eagle100/httpd/setenv.sh46
-rw-r--r--nuttx/configs/eagle100/include/README.txt1
-rw-r--r--nuttx/configs/eagle100/include/board.h142
-rw-r--r--nuttx/configs/eagle100/nettest/Make.defs149
-rw-r--r--nuttx/configs/eagle100/nettest/appconfig43
-rw-r--r--nuttx/configs/eagle100/nettest/defconfig326
-rw-r--r--nuttx/configs/eagle100/nettest/ld.script112
-rwxr-xr-xnuttx/configs/eagle100/nettest/setenv.sh46
-rw-r--r--nuttx/configs/eagle100/nsh/Make.defs149
-rw-r--r--nuttx/configs/eagle100/nsh/appconfig57
-rw-r--r--nuttx/configs/eagle100/nsh/defconfig328
-rw-r--r--nuttx/configs/eagle100/nsh/ld.script112
-rwxr-xr-xnuttx/configs/eagle100/nsh/setenv.sh46
-rw-r--r--nuttx/configs/eagle100/nxflat/Make.defs152
-rw-r--r--nuttx/configs/eagle100/nxflat/appconfig39
-rw-r--r--nuttx/configs/eagle100/nxflat/defconfig329
-rw-r--r--nuttx/configs/eagle100/nxflat/ld.script112
-rwxr-xr-xnuttx/configs/eagle100/nxflat/setenv.sh46
-rw-r--r--nuttx/configs/eagle100/ostest/Make.defs149
-rw-r--r--nuttx/configs/eagle100/ostest/appconfig39
-rw-r--r--nuttx/configs/eagle100/ostest/defconfig323
-rw-r--r--nuttx/configs/eagle100/ostest/ld.script112
-rwxr-xr-xnuttx/configs/eagle100/ostest/setenv.sh46
-rw-r--r--nuttx/configs/eagle100/ostest/test-result.txt427
-rw-r--r--nuttx/configs/eagle100/src/Makefile86
-rw-r--r--nuttx/configs/eagle100/src/README.txt1
-rw-r--r--nuttx/configs/eagle100/src/eagle100_internal.h106
-rw-r--r--nuttx/configs/eagle100/src/up_boot.c91
-rw-r--r--nuttx/configs/eagle100/src/up_ethernet.c98
-rw-r--r--nuttx/configs/eagle100/src/up_leds.c171
-rw-r--r--nuttx/configs/eagle100/src/up_nsh.c159
-rw-r--r--nuttx/configs/eagle100/src/up_ssi.c152
-rw-r--r--nuttx/configs/eagle100/thttpd/Make.defs152
-rw-r--r--nuttx/configs/eagle100/thttpd/appconfig44
-rw-r--r--nuttx/configs/eagle100/thttpd/defconfig367
-rw-r--r--nuttx/configs/eagle100/thttpd/ld.script112
-rwxr-xr-xnuttx/configs/eagle100/thttpd/setenv.sh46
-rw-r--r--nuttx/configs/ekk-lm3s9b96/Kconfig7
-rw-r--r--nuttx/configs/ekk-lm3s9b96/README.txt377
-rw-r--r--nuttx/configs/ekk-lm3s9b96/include/board.h143
-rw-r--r--nuttx/configs/ekk-lm3s9b96/nsh/Make.defs164
-rw-r--r--nuttx/configs/ekk-lm3s9b96/nsh/appconfig59
-rw-r--r--nuttx/configs/ekk-lm3s9b96/nsh/defconfig342
-rwxr-xr-xnuttx/configs/ekk-lm3s9b96/nsh/setenv.sh59
-rw-r--r--nuttx/configs/ekk-lm3s9b96/ostest/Make.defs164
-rw-r--r--nuttx/configs/ekk-lm3s9b96/ostest/appconfig40
-rw-r--r--nuttx/configs/ekk-lm3s9b96/ostest/defconfig339
-rwxr-xr-xnuttx/configs/ekk-lm3s9b96/ostest/setenv.sh59
-rw-r--r--nuttx/configs/ekk-lm3s9b96/scripts/ld.script107
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/Makefile88
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h115
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/up_boot.c91
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c99
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/up_leds.c168
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/up_nsh.c85
-rw-r--r--nuttx/configs/ekk-lm3s9b96/src/up_ssi.c162
-rw-r--r--nuttx/configs/ez80f910200kitg/Kconfig4
-rw-r--r--nuttx/configs/ez80f910200kitg/README.txt80
-rw-r--r--nuttx/configs/ez80f910200kitg/include/board.h80
-rw-r--r--nuttx/configs/ez80f910200kitg/ostest/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200kitg/ostest/README.txt12
-rw-r--r--nuttx/configs/ez80f910200kitg/ostest/appconfig39
-rw-r--r--nuttx/configs/ez80f910200kitg/ostest/defconfig406
-rwxr-xr-xnuttx/configs/ez80f910200kitg/ostest/ostest.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200kitg/ostest/ostest.zdsproj247
-rwxr-xr-xnuttx/configs/ez80f910200kitg/ostest/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200kitg/ostest/test-result.txt529
-rw-r--r--nuttx/configs/ez80f910200kitg/src/Makefile84
-rw-r--r--nuttx/configs/ez80f910200kitg/src/ez80_leds.c89
-rw-r--r--nuttx/configs/ez80f910200kitg/src/ez80_lowinit.c66
-rw-r--r--nuttx/configs/ez80f910200zco/Kconfig4
-rw-r--r--nuttx/configs/ez80f910200zco/README.txt107
-rw-r--r--nuttx/configs/ez80f910200zco/dhcpd/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200zco/dhcpd/README.txt5
-rw-r--r--nuttx/configs/ez80f910200zco/dhcpd/appconfig43
-rw-r--r--nuttx/configs/ez80f910200zco/dhcpd/defconfig427
-rwxr-xr-xnuttx/configs/ez80f910200zco/dhcpd/dhcpd.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200zco/dhcpd/dhcpd.zdsproj247
-rwxr-xr-xnuttx/configs/ez80f910200zco/dhcpd/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200zco/httpd/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200zco/httpd/README.txt5
-rw-r--r--nuttx/configs/ez80f910200zco/httpd/appconfig47
-rw-r--r--nuttx/configs/ez80f910200zco/httpd/defconfig435
-rwxr-xr-xnuttx/configs/ez80f910200zco/httpd/httpd.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200zco/httpd/httpd.zdsproj247
-rwxr-xr-xnuttx/configs/ez80f910200zco/httpd/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200zco/include/board.h93
-rw-r--r--nuttx/configs/ez80f910200zco/nettest/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200zco/nettest/README.txt5
-rw-r--r--nuttx/configs/ez80f910200zco/nettest/appconfig43
-rw-r--r--nuttx/configs/ez80f910200zco/nettest/defconfig420
-rwxr-xr-xnuttx/configs/ez80f910200zco/nettest/nettest.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200zco/nettest/nettest.zdsproj247
-rwxr-xr-xnuttx/configs/ez80f910200zco/nettest/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200zco/nsh/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200zco/nsh/README.txt5
-rw-r--r--nuttx/configs/ez80f910200zco/nsh/appconfig55
-rw-r--r--nuttx/configs/ez80f910200zco/nsh/defconfig420
-rwxr-xr-xnuttx/configs/ez80f910200zco/nsh/nsh.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200zco/nsh/nsh.zdsproj247
-rw-r--r--nuttx/configs/ez80f910200zco/nsh/sample-run.txt57
-rwxr-xr-xnuttx/configs/ez80f910200zco/nsh/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200zco/ostest/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200zco/ostest/README.txt5
-rw-r--r--nuttx/configs/ez80f910200zco/ostest/appconfig39
-rw-r--r--nuttx/configs/ez80f910200zco/ostest/defconfig415
-rwxr-xr-xnuttx/configs/ez80f910200zco/ostest/ostest.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200zco/ostest/ostest.zdsproj247
-rwxr-xr-xnuttx/configs/ez80f910200zco/ostest/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200zco/ostest/test-result.txt731
-rw-r--r--nuttx/configs/ez80f910200zco/poll/Make.defs179
-rw-r--r--nuttx/configs/ez80f910200zco/poll/README.txt5
-rw-r--r--nuttx/configs/ez80f910200zco/poll/appconfig43
-rw-r--r--nuttx/configs/ez80f910200zco/poll/defconfig420
-rwxr-xr-xnuttx/configs/ez80f910200zco/poll/poll.linkcmd94
-rwxr-xr-xnuttx/configs/ez80f910200zco/poll/poll.zdsproj247
-rwxr-xr-xnuttx/configs/ez80f910200zco/poll/setenv.sh52
-rw-r--r--nuttx/configs/ez80f910200zco/src/Makefile91
-rw-r--r--nuttx/configs/ez80f910200zco/src/ez80_buttons.c174
-rw-r--r--nuttx/configs/ez80f910200zco/src/ez80_leds.c318
-rw-r--r--nuttx/configs/ez80f910200zco/src/ez80_lowinit.c66
-rw-r--r--nuttx/configs/ez80f910200zco/src/ez80f910200zco.h151
-rw-r--r--nuttx/configs/fire-stm32v2/Kconfig6
-rw-r--r--nuttx/configs/fire-stm32v2/README.txt786
-rw-r--r--nuttx/configs/fire-stm32v2/include/board.h442
-rw-r--r--nuttx/configs/fire-stm32v2/nsh/Make.defs196
-rw-r--r--nuttx/configs/fire-stm32v2/nsh/defconfig980
-rwxr-xr-xnuttx/configs/fire-stm32v2/nsh/setenv.sh78
-rw-r--r--nuttx/configs/fire-stm32v2/scripts/ld.script112
-rw-r--r--nuttx/configs/fire-stm32v2/scripts/ld.script.dfu111
-rw-r--r--nuttx/configs/fire-stm32v2/src/Makefile123
-rw-r--r--nuttx/configs/fire-stm32v2/src/fire-internal.h307
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_autoleds.c388
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_boot.c102
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_buttons.c153
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_composite.c106
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_cxxinitialize.c155
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_enc28j60.c211
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_mmcsd.c122
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_nsh.c151
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_selectlcd.c210
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_spi.c216
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_usbdev.c120
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_usbmsc.c103
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_userleds.c139
-rw-r--r--nuttx/configs/fire-stm32v2/src/up_watchdog.c136
-rw-r--r--nuttx/configs/hymini-stm32v/Kconfig7
-rw-r--r--nuttx/configs/hymini-stm32v/README.txt670
-rw-r--r--nuttx/configs/hymini-stm32v/buttons/Make.defs175
-rw-r--r--nuttx/configs/hymini-stm32v/buttons/appconfig39
-rw-r--r--nuttx/configs/hymini-stm32v/buttons/defconfig481
-rw-r--r--nuttx/configs/hymini-stm32v/buttons/ld.script112
-rw-r--r--nuttx/configs/hymini-stm32v/buttons/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/buttons/setenv.sh47
-rw-r--r--nuttx/configs/hymini-stm32v/include/README.txt1
-rw-r--r--nuttx/configs/hymini-stm32v/include/board.h244
-rw-r--r--nuttx/configs/hymini-stm32v/nsh/Make.defs175
-rw-r--r--nuttx/configs/hymini-stm32v/nsh/appconfig42
-rwxr-xr-xnuttx/configs/hymini-stm32v/nsh/defconfig466
-rwxr-xr-xnuttx/configs/hymini-stm32v/nsh/ld.script112
-rwxr-xr-xnuttx/configs/hymini-stm32v/nsh/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/nsh/setenv.sh47
-rw-r--r--nuttx/configs/hymini-stm32v/nsh2/Make.defs175
-rw-r--r--nuttx/configs/hymini-stm32v/nsh2/appconfig53
-rw-r--r--nuttx/configs/hymini-stm32v/nsh2/defconfig585
-rw-r--r--nuttx/configs/hymini-stm32v/nsh2/ld.script112
-rw-r--r--nuttx/configs/hymini-stm32v/nsh2/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/nsh2/setenv.sh67
-rw-r--r--nuttx/configs/hymini-stm32v/nx/Make.defs175
-rw-r--r--nuttx/configs/hymini-stm32v/nx/appconfig39
-rw-r--r--nuttx/configs/hymini-stm32v/nx/defconfig575
-rw-r--r--nuttx/configs/hymini-stm32v/nx/ld.script112
-rw-r--r--nuttx/configs/hymini-stm32v/nx/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/nx/setenv.sh62
-rw-r--r--nuttx/configs/hymini-stm32v/nxlines/Make.defs177
-rw-r--r--nuttx/configs/hymini-stm32v/nxlines/appconfig39
-rw-r--r--nuttx/configs/hymini-stm32v/nxlines/defconfig583
-rw-r--r--nuttx/configs/hymini-stm32v/nxlines/ld.script112
-rw-r--r--nuttx/configs/hymini-stm32v/nxlines/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/nxlines/setenv.sh53
-rw-r--r--nuttx/configs/hymini-stm32v/src/Makefile106
-rw-r--r--nuttx/configs/hymini-stm32v/src/README.txt1
-rw-r--r--nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h140
-rw-r--r--nuttx/configs/hymini-stm32v/src/ssd1289.c989
-rw-r--r--nuttx/configs/hymini-stm32v/src/ssd1289.h55
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_boot.c103
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_buttons.c159
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_leds.c241
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_nsh.c182
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_spi.c179
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_ts.c180
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_usbdev.c117
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_usbmsc.c164
-rw-r--r--nuttx/configs/hymini-stm32v/src/up_watchdog.c136
-rw-r--r--nuttx/configs/hymini-stm32v/usbserial/Make.defs175
-rw-r--r--nuttx/configs/hymini-stm32v/usbserial/appconfig39
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbserial/defconfig498
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbserial/ld.script113
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbserial/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbserial/setenv.sh47
-rw-r--r--nuttx/configs/hymini-stm32v/usbstorage/Make.defs175
-rw-r--r--nuttx/configs/hymini-stm32v/usbstorage/appconfig39
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbstorage/defconfig488
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbstorage/ld.script112
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbstorage/ld.script.dfu111
-rwxr-xr-xnuttx/configs/hymini-stm32v/usbstorage/setenv.sh47
-rw-r--r--nuttx/configs/kwikstik-k40/Kconfig7
-rw-r--r--nuttx/configs/kwikstik-k40/README.txt478
-rw-r--r--nuttx/configs/kwikstik-k40/include/board.h285
-rw-r--r--nuttx/configs/kwikstik-k40/ostest/Make.defs163
-rw-r--r--nuttx/configs/kwikstik-k40/ostest/appconfig39
-rwxr-xr-xnuttx/configs/kwikstik-k40/ostest/defconfig463
-rwxr-xr-xnuttx/configs/kwikstik-k40/ostest/ld.script135
-rwxr-xr-xnuttx/configs/kwikstik-k40/ostest/setenv.sh61
-rw-r--r--nuttx/configs/kwikstik-k40/src/Makefile105
-rw-r--r--nuttx/configs/kwikstik-k40/src/kwikstik-internal.h195
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_boot.c102
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_buttons.c123
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_lcd.c134
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_leds.c107
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_nsh.c258
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_spi.c164
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_usbdev.c115
-rw-r--r--nuttx/configs/kwikstik-k40/src/up_usbmsc.c118
-rw-r--r--nuttx/configs/lincoln60/Kconfig7
-rw-r--r--nuttx/configs/lincoln60/README.txt441
-rw-r--r--nuttx/configs/lincoln60/include/board.h222
-rw-r--r--nuttx/configs/lincoln60/nsh/Make.defs163
-rw-r--r--nuttx/configs/lincoln60/nsh/appconfig44
-rw-r--r--nuttx/configs/lincoln60/nsh/defconfig444
-rwxr-xr-xnuttx/configs/lincoln60/nsh/setenv.sh58
-rw-r--r--nuttx/configs/lincoln60/ostest/Make.defs163
-rw-r--r--nuttx/configs/lincoln60/ostest/appconfig39
-rw-r--r--nuttx/configs/lincoln60/ostest/defconfig483
-rwxr-xr-xnuttx/configs/lincoln60/ostest/setenv.sh58
-rw-r--r--nuttx/configs/lincoln60/scripts/ld.script109
-rw-r--r--nuttx/configs/lincoln60/src/Makefile96
-rw-r--r--nuttx/configs/lincoln60/src/lincoln60_internal.h105
-rw-r--r--nuttx/configs/lincoln60/src/up_boot.c82
-rw-r--r--nuttx/configs/lincoln60/src/up_buttons.c225
-rw-r--r--nuttx/configs/lincoln60/src/up_leds.c219
-rw-r--r--nuttx/configs/lincoln60/src/up_nsh.c86
-rw-r--r--nuttx/configs/lm3s6432-s2e/Kconfig13
-rw-r--r--nuttx/configs/lm3s6432-s2e/README.txt381
-rw-r--r--nuttx/configs/lm3s6432-s2e/include/README.txt1
-rw-r--r--nuttx/configs/lm3s6432-s2e/include/board.h144
-rw-r--r--nuttx/configs/lm3s6432-s2e/nsh/Make.defs163
-rw-r--r--nuttx/configs/lm3s6432-s2e/nsh/appconfig58
-rw-r--r--nuttx/configs/lm3s6432-s2e/nsh/defconfig342
-rw-r--r--nuttx/configs/lm3s6432-s2e/nsh/ld.script108
-rw-r--r--nuttx/configs/lm3s6432-s2e/nsh/setenv.sh46
-rw-r--r--nuttx/configs/lm3s6432-s2e/ostest/Make.defs163
-rw-r--r--nuttx/configs/lm3s6432-s2e/ostest/appconfig39
-rw-r--r--nuttx/configs/lm3s6432-s2e/ostest/defconfig339
-rw-r--r--nuttx/configs/lm3s6432-s2e/ostest/ld.script108
-rw-r--r--nuttx/configs/lm3s6432-s2e/ostest/setenv.sh46
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/Makefile87
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/README.txt1
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h125
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/up_boot.c103
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/up_ethernet.c98
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/up_leds.c168
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/up_nsh.c87
-rw-r--r--nuttx/configs/lm3s6432-s2e/src/up_ssi.c151
-rw-r--r--nuttx/configs/lm3s6965-ek/Kconfig13
-rw-r--r--nuttx/configs/lm3s6965-ek/README.txt447
-rw-r--r--nuttx/configs/lm3s6965-ek/include/README.txt1
-rw-r--r--nuttx/configs/lm3s6965-ek/include/board.h142
-rw-r--r--nuttx/configs/lm3s6965-ek/nsh/Make.defs163
-rw-r--r--nuttx/configs/lm3s6965-ek/nsh/appconfig58
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nsh/defconfig344
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nsh/ld.script108
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nsh/setenv.sh46
-rw-r--r--nuttx/configs/lm3s6965-ek/nx/Make.defs163
-rw-r--r--nuttx/configs/lm3s6965-ek/nx/appconfig39
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nx/defconfig411
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nx/ld.script108
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nx/setenv.sh46
-rw-r--r--nuttx/configs/lm3s6965-ek/ostest/Make.defs163
-rw-r--r--nuttx/configs/lm3s6965-ek/ostest/appconfig39
-rwxr-xr-xnuttx/configs/lm3s6965-ek/ostest/defconfig340
-rwxr-xr-xnuttx/configs/lm3s6965-ek/ostest/ld.script108
-rwxr-xr-xnuttx/configs/lm3s6965-ek/ostest/setenv.sh46
-rw-r--r--nuttx/configs/lm3s6965-ek/src/Makefile90
-rw-r--r--nuttx/configs/lm3s6965-ek/src/README.txt1
-rw-r--r--nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h136
-rw-r--r--nuttx/configs/lm3s6965-ek/src/up_boot.c92
-rw-r--r--nuttx/configs/lm3s6965-ek/src/up_ethernet.c98
-rw-r--r--nuttx/configs/lm3s6965-ek/src/up_leds.c167
-rw-r--r--nuttx/configs/lm3s6965-ek/src/up_nsh.c159
-rw-r--r--nuttx/configs/lm3s6965-ek/src/up_oled.c172
-rw-r--r--nuttx/configs/lm3s6965-ek/src/up_ssi.c164
-rw-r--r--nuttx/configs/lm3s8962-ek/Kconfig13
-rw-r--r--nuttx/configs/lm3s8962-ek/README.txt423
-rw-r--r--nuttx/configs/lm3s8962-ek/include/README.txt1
-rw-r--r--nuttx/configs/lm3s8962-ek/include/board.h142
-rw-r--r--nuttx/configs/lm3s8962-ek/nsh/Make.defs163
-rw-r--r--nuttx/configs/lm3s8962-ek/nsh/appconfig58
-rwxr-xr-xnuttx/configs/lm3s8962-ek/nsh/defconfig342
-rwxr-xr-xnuttx/configs/lm3s8962-ek/nsh/ld.script108
-rwxr-xr-xnuttx/configs/lm3s8962-ek/nsh/setenv.sh46
-rw-r--r--nuttx/configs/lm3s8962-ek/nx/Make.defs163
-rw-r--r--nuttx/configs/lm3s8962-ek/nx/appconfig39
-rwxr-xr-xnuttx/configs/lm3s8962-ek/nx/defconfig409
-rwxr-xr-xnuttx/configs/lm3s8962-ek/nx/ld.script108
-rwxr-xr-xnuttx/configs/lm3s8962-ek/nx/setenv.sh46
-rw-r--r--nuttx/configs/lm3s8962-ek/ostest/Make.defs163
-rw-r--r--nuttx/configs/lm3s8962-ek/ostest/appconfig39
-rwxr-xr-xnuttx/configs/lm3s8962-ek/ostest/defconfig339
-rwxr-xr-xnuttx/configs/lm3s8962-ek/ostest/ld.script108
-rwxr-xr-xnuttx/configs/lm3s8962-ek/ostest/setenv.sh46
-rw-r--r--nuttx/configs/lm3s8962-ek/src/Makefile90
-rw-r--r--nuttx/configs/lm3s8962-ek/src/README.txt1
-rw-r--r--nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h136
-rw-r--r--nuttx/configs/lm3s8962-ek/src/up_boot.c92
-rw-r--r--nuttx/configs/lm3s8962-ek/src/up_ethernet.c98
-rw-r--r--nuttx/configs/lm3s8962-ek/src/up_leds.c167
-rw-r--r--nuttx/configs/lm3s8962-ek/src/up_nsh.c159
-rw-r--r--nuttx/configs/lm3s8962-ek/src/up_oled.c172
-rw-r--r--nuttx/configs/lm3s8962-ek/src/up_ssi.c164
-rw-r--r--nuttx/configs/lpc4330-xplorer/Kconfig7
-rw-r--r--nuttx/configs/lpc4330-xplorer/README.txt949
-rw-r--r--nuttx/configs/lpc4330-xplorer/include/board.h333
-rw-r--r--nuttx/configs/lpc4330-xplorer/nsh/Make.defs219
-rw-r--r--nuttx/configs/lpc4330-xplorer/nsh/appconfig99
-rw-r--r--nuttx/configs/lpc4330-xplorer/nsh/defconfig604
-rwxr-xr-xnuttx/configs/lpc4330-xplorer/nsh/setenv.sh91
-rw-r--r--nuttx/configs/lpc4330-xplorer/ostest/Make.defs219
-rw-r--r--nuttx/configs/lpc4330-xplorer/ostest/appconfig39
-rw-r--r--nuttx/configs/lpc4330-xplorer/ostest/defconfig581
-rwxr-xr-xnuttx/configs/lpc4330-xplorer/ostest/setenv.sh91
-rwxr-xr-xnuttx/configs/lpc4330-xplorer/scripts/flash.sh153
-rw-r--r--nuttx/configs/lpc4330-xplorer/scripts/ramconfig.ld144
-rw-r--r--nuttx/configs/lpc4330-xplorer/scripts/spificonfig.ld140
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/Makefile124
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/up_autoleds.c203
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/up_boot.c81
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/up_buttons.c224
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/up_nsh.c148
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/up_ostest.c114
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/up_userleds.c157
-rw-r--r--nuttx/configs/lpc4330-xplorer/src/xplorer_internal.h129
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/Kconfig13
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/README.txt793
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/dhcpd/Make.defs175
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/dhcpd/appconfig43
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig481
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/dhcpd/ld.script110
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/dhcpd/setenv.sh59
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/include/board.h290
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/nsh/Make.defs175
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/nsh/appconfig58
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/nsh/defconfig491
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/nsh/ld.script110
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/nsh/setenv.sh59
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/nx/Make.defs175
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/nx/appconfig39
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/nx/defconfig543
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/nx/ld.script110
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/nx/setenv.sh59
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/ostest/Make.defs175
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/ostest/appconfig39
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/ostest/defconfig469
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/ostest/ld.script110
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/ostest/setenv.sh59
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/Makefile96
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h236
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c93
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c157
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c171
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c214
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c215
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c143
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/thttpd/Make.defs180
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/thttpd/appconfig43
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig508
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/thttpd/ld.script110
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/thttpd/setenv.sh61
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/tools/flash.sh146
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/usbstorage/Make.defs175
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/usbstorage/appconfig39
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig465
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/usbstorage/ld.script110
-rwxr-xr-xnuttx/configs/lpcxpresso-lpc1768/usbstorage/setenv.sh59
-rw-r--r--nuttx/configs/m68332evb/Kconfig4
-rw-r--r--nuttx/configs/m68332evb/Make.defs104
-rw-r--r--nuttx/configs/m68332evb/appconfig39
-rw-r--r--nuttx/configs/m68332evb/defconfig212
-rw-r--r--nuttx/configs/m68332evb/doc/m68k-defconfig111
-rw-r--r--nuttx/configs/m68332evb/include/README.txt1
-rw-r--r--nuttx/configs/m68332evb/ld.script84
-rwxr-xr-xnuttx/configs/m68332evb/setenv.sh46
-rw-r--r--nuttx/configs/m68332evb/src/Makefile74
-rw-r--r--nuttx/configs/m68332evb/src/README.txt1
-rw-r--r--nuttx/configs/mbed/Kconfig13
-rw-r--r--nuttx/configs/mbed/README.txt415
-rw-r--r--nuttx/configs/mbed/hidkbd/Make.defs163
-rw-r--r--nuttx/configs/mbed/hidkbd/appconfig39
-rw-r--r--nuttx/configs/mbed/hidkbd/defconfig473
-rw-r--r--nuttx/configs/mbed/hidkbd/ld.script109
-rw-r--r--nuttx/configs/mbed/hidkbd/setenv.sh47
-rw-r--r--nuttx/configs/mbed/include/board.h217
-rw-r--r--nuttx/configs/mbed/nsh/Make.defs163
-rw-r--r--nuttx/configs/mbed/nsh/appconfig44
-rwxr-xr-xnuttx/configs/mbed/nsh/defconfig444
-rwxr-xr-xnuttx/configs/mbed/nsh/ld.script109
-rwxr-xr-xnuttx/configs/mbed/nsh/setenv.sh47
-rw-r--r--nuttx/configs/mbed/src/Makefile90
-rw-r--r--nuttx/configs/mbed/src/mbed_internal.h94
-rw-r--r--nuttx/configs/mbed/src/up_boot.c82
-rw-r--r--nuttx/configs/mbed/src/up_leds.c222
-rw-r--r--nuttx/configs/mbed/src/up_nsh.c102
-rw-r--r--nuttx/configs/mcu123-lpc214x/Kconfig13
-rw-r--r--nuttx/configs/mcu123-lpc214x/README.txt395
-rw-r--r--nuttx/configs/mcu123-lpc214x/composite/Make.defs161
-rw-r--r--nuttx/configs/mcu123-lpc214x/composite/appconfig39
-rw-r--r--nuttx/configs/mcu123-lpc214x/composite/defconfig417
-rw-r--r--nuttx/configs/mcu123-lpc214x/composite/ld.script120
-rwxr-xr-xnuttx/configs/mcu123-lpc214x/composite/setenv.sh66
-rw-r--r--nuttx/configs/mcu123-lpc214x/include/README.txt1
-rw-r--r--nuttx/configs/mcu123-lpc214x/include/board.h79
-rw-r--r--nuttx/configs/mcu123-lpc214x/lpc21isp-1.60.diff102
-rw-r--r--nuttx/configs/mcu123-lpc214x/nsh/Make.defs161
-rw-r--r--nuttx/configs/mcu123-lpc214x/nsh/appconfig44
-rw-r--r--nuttx/configs/mcu123-lpc214x/nsh/defconfig342
-rw-r--r--nuttx/configs/mcu123-lpc214x/nsh/ld.script119
-rwxr-xr-xnuttx/configs/mcu123-lpc214x/nsh/setenv.sh47
-rw-r--r--nuttx/configs/mcu123-lpc214x/ostest/Make.defs161
-rw-r--r--nuttx/configs/mcu123-lpc214x/ostest/appconfig39
-rw-r--r--nuttx/configs/mcu123-lpc214x/ostest/defconfig336
-rw-r--r--nuttx/configs/mcu123-lpc214x/ostest/ld.script119
-rwxr-xr-xnuttx/configs/mcu123-lpc214x/ostest/setenv.sh47
-rwxr-xr-xnuttx/configs/mcu123-lpc214x/scripts/lpc21isp.sh65
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/Makefile97
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/README.txt2
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/up_composite.c155
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/up_leds.c115
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/up_nsh.c159
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/up_spi.c602
-rw-r--r--nuttx/configs/mcu123-lpc214x/src/up_usbmsc.c143
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbserial/Make.defs161
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbserial/appconfig39
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbserial/defconfig345
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbserial/ld.script119
-rwxr-xr-xnuttx/configs/mcu123-lpc214x/usbserial/setenv.sh47
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs161
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbstorage/appconfig39
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbstorage/defconfig358
-rw-r--r--nuttx/configs/mcu123-lpc214x/usbstorage/ld.script119
-rwxr-xr-xnuttx/configs/mcu123-lpc214x/usbstorage/setenv.sh47
-rw-r--r--nuttx/configs/micropendous3/Kconfig4
-rw-r--r--nuttx/configs/micropendous3/README.txt530
-rw-r--r--nuttx/configs/micropendous3/hello/Make.defs150
-rw-r--r--nuttx/configs/micropendous3/hello/appconfig39
-rw-r--r--nuttx/configs/micropendous3/hello/defconfig411
-rw-r--r--nuttx/configs/micropendous3/hello/ld.script211
-rwxr-xr-xnuttx/configs/micropendous3/hello/setenv.sh63
-rw-r--r--nuttx/configs/micropendous3/include/board.h101
-rw-r--r--nuttx/configs/micropendous3/src/Makefile97
-rw-r--r--nuttx/configs/micropendous3/src/micropendous3_internal.h101
-rw-r--r--nuttx/configs/micropendous3/src/up_boot.c93
-rw-r--r--nuttx/configs/mirtoo/Kconfig13
-rw-r--r--nuttx/configs/mirtoo/README.txt1007
-rw-r--r--nuttx/configs/mirtoo/include/board.h190
-rw-r--r--nuttx/configs/mirtoo/nsh/Make.defs197
-rw-r--r--nuttx/configs/mirtoo/nsh/appconfig43
-rw-r--r--nuttx/configs/mirtoo/nsh/defconfig495
-rwxr-xr-xnuttx/configs/mirtoo/nsh/setenv.sh80
-rw-r--r--nuttx/configs/mirtoo/nxffs/Make.defs197
-rw-r--r--nuttx/configs/mirtoo/nxffs/appconfig43
-rw-r--r--nuttx/configs/mirtoo/nxffs/defconfig538
-rwxr-xr-xnuttx/configs/mirtoo/nxffs/setenv.sh80
-rw-r--r--nuttx/configs/mirtoo/ostest/Make.defs197
-rw-r--r--nuttx/configs/mirtoo/ostest/appconfig39
-rw-r--r--nuttx/configs/mirtoo/ostest/defconfig471
-rwxr-xr-xnuttx/configs/mirtoo/ostest/setenv.sh80
-rw-r--r--nuttx/configs/mirtoo/scripts/c32-debug.ld313
-rw-r--r--nuttx/configs/mirtoo/scripts/c32-release.ld315
-rw-r--r--nuttx/configs/mirtoo/scripts/mips-elf-debug.ld313
-rw-r--r--nuttx/configs/mirtoo/scripts/mips-elf-release.ld315
-rw-r--r--nuttx/configs/mirtoo/scripts/xc32-debug.ld313
-rw-r--r--nuttx/configs/mirtoo/scripts/xc32-release.ld315
-rw-r--r--nuttx/configs/mirtoo/src/Makefile96
-rw-r--r--nuttx/configs/mirtoo/src/mirtoo-internal.h113
-rw-r--r--nuttx/configs/mirtoo/src/up_adc.c105
-rw-r--r--nuttx/configs/mirtoo/src/up_boot.c161
-rw-r--r--nuttx/configs/mirtoo/src/up_leds.c258
-rw-r--r--nuttx/configs/mirtoo/src/up_nsh.c155
-rw-r--r--nuttx/configs/mirtoo/src/up_spi2.c198
-rw-r--r--nuttx/configs/mx1ads/Kconfig13
-rw-r--r--nuttx/configs/mx1ads/README.txt138
-rw-r--r--nuttx/configs/mx1ads/include/README.txt1
-rw-r--r--nuttx/configs/mx1ads/include/board.h166
-rw-r--r--nuttx/configs/mx1ads/ostest/Make.defs134
-rw-r--r--nuttx/configs/mx1ads/ostest/appconfig39
-rw-r--r--nuttx/configs/mx1ads/ostest/defconfig324
-rw-r--r--nuttx/configs/mx1ads/ostest/ld.script84
-rwxr-xr-xnuttx/configs/mx1ads/ostest/setenv.sh46
-rw-r--r--nuttx/configs/mx1ads/src/Makefile77
-rw-r--r--nuttx/configs/mx1ads/src/README.txt1
-rw-r--r--nuttx/configs/mx1ads/src/up_boot.c107
-rw-r--r--nuttx/configs/mx1ads/src/up_leds.c107
-rw-r--r--nuttx/configs/mx1ads/src/up_network.c77
-rw-r--r--nuttx/configs/ne64badge/Kconfig7
-rw-r--r--nuttx/configs/ne64badge/README.txt481
-rw-r--r--nuttx/configs/ne64badge/include/board.h151
-rw-r--r--nuttx/configs/ne64badge/ostest/Make.defs153
-rw-r--r--nuttx/configs/ne64badge/ostest/appconfig39
-rwxr-xr-xnuttx/configs/ne64badge/ostest/defconfig402
-rwxr-xr-xnuttx/configs/ne64badge/ostest/ld.script.banked151
-rwxr-xr-xnuttx/configs/ne64badge/ostest/ld.script.nonbanked124
-rwxr-xr-xnuttx/configs/ne64badge/ostest/setenv.sh46
-rw-r--r--nuttx/configs/ne64badge/src/Makefile86
-rw-r--r--nuttx/configs/ne64badge/src/ne64badge_internal.h205
-rw-r--r--nuttx/configs/ne64badge/src/up_boot.c89
-rw-r--r--nuttx/configs/ne64badge/src/up_buttons.c130
-rw-r--r--nuttx/configs/ne64badge/src/up_leds.c158
-rw-r--r--nuttx/configs/ne64badge/src/up_nsh.c86
-rw-r--r--nuttx/configs/ne64badge/src/up_spi.c130
-rw-r--r--nuttx/configs/ntosd-dm320/Kconfig13
-rw-r--r--nuttx/configs/ntosd-dm320/README.txt371
-rw-r--r--nuttx/configs/ntosd-dm320/doc/README.txt74
-rw-r--r--nuttx/configs/ntosd-dm320/doc/test-result.txt468
-rw-r--r--nuttx/configs/ntosd-dm320/include/README.txt1
-rw-r--r--nuttx/configs/ntosd-dm320/include/board.h134
-rw-r--r--nuttx/configs/ntosd-dm320/nettest/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/nettest/appconfig43
-rw-r--r--nuttx/configs/ntosd-dm320/nettest/defconfig320
-rw-r--r--nuttx/configs/ntosd-dm320/nettest/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/nettest/setenv.sh46
-rw-r--r--nuttx/configs/ntosd-dm320/nsh/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/nsh/appconfig58
-rw-r--r--nuttx/configs/ntosd-dm320/nsh/defconfig351
-rw-r--r--nuttx/configs/ntosd-dm320/nsh/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/nsh/setenv.sh46
-rw-r--r--nuttx/configs/ntosd-dm320/ostest/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/ostest/appconfig39
-rw-r--r--nuttx/configs/ntosd-dm320/ostest/defconfig316
-rw-r--r--nuttx/configs/ntosd-dm320/ostest/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/ostest/setenv.sh46
-rw-r--r--nuttx/configs/ntosd-dm320/poll/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/poll/appconfig43
-rw-r--r--nuttx/configs/ntosd-dm320/poll/defconfig327
-rw-r--r--nuttx/configs/ntosd-dm320/poll/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/poll/setenv.sh46
-rw-r--r--nuttx/configs/ntosd-dm320/src/Makefile77
-rw-r--r--nuttx/configs/ntosd-dm320/src/README.txt1
-rw-r--r--nuttx/configs/ntosd-dm320/src/up_leds.c104
-rw-r--r--nuttx/configs/ntosd-dm320/src/up_network.c103
-rw-r--r--nuttx/configs/ntosd-dm320/thttpd/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/thttpd/appconfig44
-rw-r--r--nuttx/configs/ntosd-dm320/thttpd/defconfig395
-rw-r--r--nuttx/configs/ntosd-dm320/thttpd/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/thttpd/setenv.sh46
-rw-r--r--nuttx/configs/ntosd-dm320/udp/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/udp/appconfig43
-rw-r--r--nuttx/configs/ntosd-dm320/udp/defconfig328
-rw-r--r--nuttx/configs/ntosd-dm320/udp/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/udp/setenv.sh46
-rw-r--r--nuttx/configs/ntosd-dm320/uip/Make.defs172
-rw-r--r--nuttx/configs/ntosd-dm320/uip/appconfig46
-rw-r--r--nuttx/configs/ntosd-dm320/uip/defconfig328
-rw-r--r--nuttx/configs/ntosd-dm320/uip/ld.script85
-rwxr-xr-xnuttx/configs/ntosd-dm320/uip/setenv.sh46
-rw-r--r--nuttx/configs/nucleus2g/Kconfig13
-rw-r--r--nuttx/configs/nucleus2g/README.txt499
-rw-r--r--nuttx/configs/nucleus2g/include/board.h290
-rw-r--r--nuttx/configs/nucleus2g/nsh/Make.defs163
-rw-r--r--nuttx/configs/nucleus2g/nsh/appconfig44
-rwxr-xr-xnuttx/configs/nucleus2g/nsh/defconfig467
-rwxr-xr-xnuttx/configs/nucleus2g/nsh/ld.script109
-rwxr-xr-xnuttx/configs/nucleus2g/nsh/setenv.sh47
-rw-r--r--nuttx/configs/nucleus2g/ostest/Make.defs163
-rw-r--r--nuttx/configs/nucleus2g/ostest/appconfig39
-rwxr-xr-xnuttx/configs/nucleus2g/ostest/defconfig444
-rwxr-xr-xnuttx/configs/nucleus2g/ostest/ld.script109
-rwxr-xr-xnuttx/configs/nucleus2g/ostest/setenv.sh47
-rw-r--r--nuttx/configs/nucleus2g/ostest/test-result.txt432
-rw-r--r--nuttx/configs/nucleus2g/src/Makefile90
-rw-r--r--nuttx/configs/nucleus2g/src/nucleus2g_internal.h156
-rw-r--r--nuttx/configs/nucleus2g/src/up_boot.c115
-rw-r--r--nuttx/configs/nucleus2g/src/up_leds.c235
-rw-r--r--nuttx/configs/nucleus2g/src/up_nsh.c164
-rw-r--r--nuttx/configs/nucleus2g/src/up_outputs.c129
-rw-r--r--nuttx/configs/nucleus2g/src/up_ssp.c185
-rw-r--r--nuttx/configs/nucleus2g/src/up_usbmsc.c143
-rw-r--r--nuttx/configs/nucleus2g/tools/olimex-tiny.cfg61
-rw-r--r--nuttx/configs/nucleus2g/tools/olimex.cfg62
-rwxr-xr-xnuttx/configs/nucleus2g/tools/oocd.sh49
-rw-r--r--nuttx/configs/nucleus2g/tools/scarab.cfg63
-rw-r--r--nuttx/configs/nucleus2g/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/nucleus2g/usbserial/Make.defs163
-rw-r--r--nuttx/configs/nucleus2g/usbserial/appconfig39
-rwxr-xr-xnuttx/configs/nucleus2g/usbserial/defconfig457
-rwxr-xr-xnuttx/configs/nucleus2g/usbserial/ld.script109
-rwxr-xr-xnuttx/configs/nucleus2g/usbserial/setenv.sh47
-rw-r--r--nuttx/configs/nucleus2g/usbstorage/Make.defs163
-rw-r--r--nuttx/configs/nucleus2g/usbstorage/appconfig39
-rwxr-xr-xnuttx/configs/nucleus2g/usbstorage/defconfig458
-rwxr-xr-xnuttx/configs/nucleus2g/usbstorage/ld.script109
-rwxr-xr-xnuttx/configs/nucleus2g/usbstorage/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/Kconfig7
-rw-r--r--nuttx/configs/olimex-lpc1766stk/README.txt979
-rw-r--r--nuttx/configs/olimex-lpc1766stk/ftpc/Make.defs166
-rw-r--r--nuttx/configs/olimex-lpc1766stk/ftpc/appconfig57
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/ftpc/defconfig548
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/ftpc/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/ftpc/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/hidkbd/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig39
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/hidkbd/defconfig499
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/hidkbd/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/include/board.h462
-rw-r--r--nuttx/configs/olimex-lpc1766stk/nettest/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/nettest/appconfig42
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nettest/defconfig478
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nettest/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nettest/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/nsh/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/nsh/appconfig66
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nsh/defconfig523
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nsh/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nsh/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/nx/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/nx/appconfig39
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nx/defconfig573
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nx/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/nx/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/ostest/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/ostest/appconfig39
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/ostest/defconfig483
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/ostest/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/ostest/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/slip-httpd/Make.defs166
-rw-r--r--nuttx/configs/olimex-lpc1766stk/slip-httpd/appconfig44
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig521
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/slip-httpd/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/slip-httpd/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/Makefile104
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/lpc1766stk_internal.h266
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_boot.c93
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_buttons.c228
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_can.c146
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_lcd.c265
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_leds.c210
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_nsh.c329
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_ssp.c380
-rw-r--r--nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c156
-rw-r--r--nuttx/configs/olimex-lpc1766stk/thttpd/Make.defs166
-rw-r--r--nuttx/configs/olimex-lpc1766stk/thttpd/appconfig43
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/thttpd/defconfig516
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/thttpd/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/thttpd/setenv.sh47
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/tools/olimex.cfg86
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/tools/oocd.sh52
-rw-r--r--nuttx/configs/olimex-lpc1766stk/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/olimex-lpc1766stk/usbserial/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/usbserial/appconfig39
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/usbserial/defconfig484
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/usbserial/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/usbserial/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/usbstorage/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/usbstorage/appconfig39
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/usbstorage/defconfig485
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/usbstorage/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/usbstorage/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc1766stk/wlan/Make.defs163
-rw-r--r--nuttx/configs/olimex-lpc1766stk/wlan/appconfig42
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/wlan/defconfig491
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/wlan/ld.script109
-rwxr-xr-xnuttx/configs/olimex-lpc1766stk/wlan/setenv.sh47
-rw-r--r--nuttx/configs/olimex-lpc2378/Kconfig14
-rw-r--r--nuttx/configs/olimex-lpc2378/README.txt11
-rw-r--r--nuttx/configs/olimex-lpc2378/include/README.txt1
-rw-r--r--nuttx/configs/olimex-lpc2378/include/board.h90
-rw-r--r--nuttx/configs/olimex-lpc2378/nsh/Make.defs180
-rw-r--r--nuttx/configs/olimex-lpc2378/nsh/appconfig44
-rwxr-xr-xnuttx/configs/olimex-lpc2378/nsh/defconfig266
-rwxr-xr-xnuttx/configs/olimex-lpc2378/nsh/ld.script165
-rwxr-xr-xnuttx/configs/olimex-lpc2378/nsh/setenv.sh52
-rw-r--r--nuttx/configs/olimex-lpc2378/ostest/Make.defs180
-rw-r--r--nuttx/configs/olimex-lpc2378/ostest/appconfig39
-rwxr-xr-xnuttx/configs/olimex-lpc2378/ostest/defconfig266
-rwxr-xr-xnuttx/configs/olimex-lpc2378/ostest/ld.script166
-rwxr-xr-xnuttx/configs/olimex-lpc2378/ostest/setenv.sh52
-rw-r--r--nuttx/configs/olimex-lpc2378/src/Makefile93
-rw-r--r--nuttx/configs/olimex-lpc2378/src/up_leds.c141
-rw-r--r--nuttx/configs/olimex-lpc2378/src/up_nsh.c114
-rw-r--r--nuttx/configs/olimex-stm32-p107/Kconfig7
-rw-r--r--nuttx/configs/olimex-stm32-p107/include/board.h117
-rw-r--r--nuttx/configs/olimex-stm32-p107/nsh/Make.defs175
-rw-r--r--nuttx/configs/olimex-stm32-p107/nsh/appconfig54
-rw-r--r--nuttx/configs/olimex-stm32-p107/nsh/defconfig559
-rwxr-xr-xnuttx/configs/olimex-stm32-p107/nsh/setenv.sh75
-rw-r--r--nuttx/configs/olimex-stm32-p107/ostest/Make.defs175
-rw-r--r--nuttx/configs/olimex-stm32-p107/ostest/appconfig38
-rw-r--r--nuttx/configs/olimex-stm32-p107/ostest/defconfig513
-rwxr-xr-xnuttx/configs/olimex-stm32-p107/ostest/setenv.sh75
-rw-r--r--nuttx/configs/olimex-stm32-p107/scripts/ld.script106
-rw-r--r--nuttx/configs/olimex-stm32-p107/scripts/ld.script.dfu106
-rw-r--r--nuttx/configs/olimex-stm32-p107/src/Makefile89
-rw-r--r--nuttx/configs/olimex-stm32-p107/src/up_boot.c181
-rw-r--r--nuttx/configs/olimex-stm32-p107/src/up_can.c132
-rw-r--r--nuttx/configs/olimex-strp711/Kconfig7
-rw-r--r--nuttx/configs/olimex-strp711/README.txt435
-rw-r--r--nuttx/configs/olimex-strp711/include/README.txt1
-rw-r--r--nuttx/configs/olimex-strp711/include/board.h185
-rw-r--r--nuttx/configs/olimex-strp711/nettest/Make.defs161
-rw-r--r--nuttx/configs/olimex-strp711/nettest/appconfig43
-rwxr-xr-xnuttx/configs/olimex-strp711/nettest/defconfig398
-rwxr-xr-xnuttx/configs/olimex-strp711/nettest/ld.script122
-rwxr-xr-xnuttx/configs/olimex-strp711/nettest/setenv.sh47
-rw-r--r--nuttx/configs/olimex-strp711/nsh/Make.defs161
-rw-r--r--nuttx/configs/olimex-strp711/nsh/appconfig44
-rw-r--r--nuttx/configs/olimex-strp711/nsh/defconfig369
-rw-r--r--nuttx/configs/olimex-strp711/nsh/ld.script122
-rwxr-xr-xnuttx/configs/olimex-strp711/nsh/setenv.sh47
-rw-r--r--nuttx/configs/olimex-strp711/ostest/Make.defs161
-rw-r--r--nuttx/configs/olimex-strp711/ostest/appconfig39
-rw-r--r--nuttx/configs/olimex-strp711/ostest/defconfig369
-rw-r--r--nuttx/configs/olimex-strp711/ostest/ld.script122
-rwxr-xr-xnuttx/configs/olimex-strp711/ostest/setenv.sh47
-rw-r--r--nuttx/configs/olimex-strp711/ostest/test-results.txt405
-rw-r--r--nuttx/configs/olimex-strp711/scripts/oocd-reset41
-rwxr-xr-xnuttx/configs/olimex-strp711/scripts/oocd.sh79
-rw-r--r--nuttx/configs/olimex-strp711/scripts/oocd_flash.script26
-rwxr-xr-xnuttx/configs/olimex-strp711/scripts/oocd_ft2xx.cfg37
-rw-r--r--nuttx/configs/olimex-strp711/scripts/oocd_wiggler.cfg46
-rw-r--r--nuttx/configs/olimex-strp711/scripts/usb-driver.txt25
-rw-r--r--nuttx/configs/olimex-strp711/src/Makefile90
-rw-r--r--nuttx/configs/olimex-strp711/src/README.txt2
-rw-r--r--nuttx/configs/olimex-strp711/src/up_buttons.c130
-rw-r--r--nuttx/configs/olimex-strp711/src/up_enc28j60.c251
-rw-r--r--nuttx/configs/olimex-strp711/src/up_leds.c218
-rw-r--r--nuttx/configs/olimex-strp711/src/up_nsh.c167
-rw-r--r--nuttx/configs/olimex-strp711/src/up_spi.c1121
-rw-r--r--nuttx/configs/pcblogic-pic32mx/Kconfig4
-rw-r--r--nuttx/configs/pcblogic-pic32mx/README.txt550
-rw-r--r--nuttx/configs/pcblogic-pic32mx/include/board.h130
-rw-r--r--nuttx/configs/pcblogic-pic32mx/nsh/Make.defs161
-rw-r--r--nuttx/configs/pcblogic-pic32mx/nsh/appconfig61
-rw-r--r--nuttx/configs/pcblogic-pic32mx/nsh/defconfig472
-rw-r--r--nuttx/configs/pcblogic-pic32mx/nsh/ld.script317
-rwxr-xr-xnuttx/configs/pcblogic-pic32mx/nsh/setenv.sh61
-rw-r--r--nuttx/configs/pcblogic-pic32mx/ostest/Make.defs161
-rw-r--r--nuttx/configs/pcblogic-pic32mx/ostest/appconfig39
-rw-r--r--nuttx/configs/pcblogic-pic32mx/ostest/defconfig461
-rw-r--r--nuttx/configs/pcblogic-pic32mx/ostest/ld.script317
-rwxr-xr-xnuttx/configs/pcblogic-pic32mx/ostest/setenv.sh61
-rw-r--r--nuttx/configs/pcblogic-pic32mx/src/Makefile88
-rw-r--r--nuttx/configs/pcblogic-pic32mx/src/pcblogic-internal.h101
-rw-r--r--nuttx/configs/pcblogic-pic32mx/src/up_boot.c93
-rw-r--r--nuttx/configs/pic32-starterkit/Kconfig13
-rw-r--r--nuttx/configs/pic32-starterkit/README.txt1243
-rw-r--r--nuttx/configs/pic32-starterkit/include/board.h227
-rw-r--r--nuttx/configs/pic32-starterkit/nsh/Make.defs161
-rw-r--r--nuttx/configs/pic32-starterkit/nsh/appconfig115
-rw-r--r--nuttx/configs/pic32-starterkit/nsh/defconfig676
-rw-r--r--nuttx/configs/pic32-starterkit/nsh/ld.script317
-rwxr-xr-xnuttx/configs/pic32-starterkit/nsh/setenv.sh61
-rw-r--r--nuttx/configs/pic32-starterkit/nsh2/Make.defs161
-rw-r--r--nuttx/configs/pic32-starterkit/nsh2/appconfig115
-rw-r--r--nuttx/configs/pic32-starterkit/nsh2/defconfig675
-rw-r--r--nuttx/configs/pic32-starterkit/nsh2/ld.script317
-rwxr-xr-xnuttx/configs/pic32-starterkit/nsh2/setenv.sh61
-rw-r--r--nuttx/configs/pic32-starterkit/ostest/Make.defs161
-rw-r--r--nuttx/configs/pic32-starterkit/ostest/appconfig39
-rw-r--r--nuttx/configs/pic32-starterkit/ostest/defconfig673
-rw-r--r--nuttx/configs/pic32-starterkit/ostest/ld.script317
-rwxr-xr-xnuttx/configs/pic32-starterkit/ostest/setenv.sh61
-rw-r--r--nuttx/configs/pic32-starterkit/src/Makefile99
-rw-r--r--nuttx/configs/pic32-starterkit/src/starterkit_internal.h122
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_boot.c94
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_leds.c266
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_nsh.c381
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_spi.c223
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_usbdev.c163
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_usbmsc.c95
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_usbterm.c105
-rw-r--r--nuttx/configs/pic32mx7mmb/Kconfig13
-rw-r--r--nuttx/configs/pic32mx7mmb/README.txt843
-rw-r--r--nuttx/configs/pic32mx7mmb/include/board.h233
-rw-r--r--nuttx/configs/pic32mx7mmb/nsh/Make.defs161
-rw-r--r--nuttx/configs/pic32mx7mmb/nsh/appconfig132
-rw-r--r--nuttx/configs/pic32mx7mmb/nsh/defconfig793
-rw-r--r--nuttx/configs/pic32mx7mmb/nsh/ld.script317
-rwxr-xr-xnuttx/configs/pic32mx7mmb/nsh/setenv.sh61
-rw-r--r--nuttx/configs/pic32mx7mmb/ostest/Make.defs161
-rw-r--r--nuttx/configs/pic32mx7mmb/ostest/appconfig39
-rw-r--r--nuttx/configs/pic32mx7mmb/ostest/defconfig673
-rw-r--r--nuttx/configs/pic32mx7mmb/ostest/ld.script317
-rwxr-xr-xnuttx/configs/pic32mx7mmb/ostest/setenv.sh61
-rw-r--r--nuttx/configs/pic32mx7mmb/src/Makefile103
-rw-r--r--nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h166
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_boot.c101
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_leds.c275
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c554
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_nsh.c390
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_spi.c264
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_touchscreen.c1463
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_usbdev.c163
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_usbmsc.c95
-rw-r--r--nuttx/configs/pic32mx7mmb/src/up_usbterm.c106
-rw-r--r--nuttx/configs/pjrc-8051/Kconfig13
-rw-r--r--nuttx/configs/pjrc-8051/Make.defs98
-rw-r--r--nuttx/configs/pjrc-8051/README.txt37
-rw-r--r--nuttx/configs/pjrc-8051/appconfig39
-rw-r--r--nuttx/configs/pjrc-8051/defconfig211
-rw-r--r--nuttx/configs/pjrc-8051/include/README.txt1
-rw-r--r--nuttx/configs/pjrc-8051/include/board.h51
-rw-r--r--nuttx/configs/pjrc-8051/include/pjrc.h215
-rw-r--r--nuttx/configs/pjrc-8051/sdcc-2.6.0.patch28
-rwxr-xr-xnuttx/configs/pjrc-8051/setenv.sh45
-rw-r--r--nuttx/configs/pjrc-8051/src/Makefile76
-rw-r--r--nuttx/configs/pjrc-8051/src/README.txt1
-rw-r--r--nuttx/configs/pjrc-8051/src/up_leds.c207
-rw-r--r--nuttx/configs/qemu-i486/Kconfig4
-rw-r--r--nuttx/configs/qemu-i486/README.txt166
-rw-r--r--nuttx/configs/qemu-i486/include/README.txt1
-rw-r--r--nuttx/configs/qemu-i486/include/board.h101
-rw-r--r--nuttx/configs/qemu-i486/nsh/Make.defs135
-rw-r--r--nuttx/configs/qemu-i486/nsh/appconfig44
-rw-r--r--nuttx/configs/qemu-i486/nsh/defconfig312
-rwxr-xr-xnuttx/configs/qemu-i486/nsh/ld.script91
-rwxr-xr-xnuttx/configs/qemu-i486/nsh/setenv.sh48
-rw-r--r--nuttx/configs/qemu-i486/ostest/Make.defs135
-rw-r--r--nuttx/configs/qemu-i486/ostest/appconfig39
-rw-r--r--nuttx/configs/qemu-i486/ostest/defconfig228
-rwxr-xr-xnuttx/configs/qemu-i486/ostest/ld.script91
-rwxr-xr-xnuttx/configs/qemu-i486/ostest/setenv.sh48
-rw-r--r--nuttx/configs/qemu-i486/src/Makefile83
-rw-r--r--nuttx/configs/qemu-i486/src/README.txt1
-rw-r--r--nuttx/configs/qemu-i486/src/qemui486_internal.h69
-rw-r--r--nuttx/configs/qemu-i486/src/up_boot.c82
-rw-r--r--nuttx/configs/rgmp/Kconfig4
-rw-r--r--nuttx/configs/rgmp/README.txt93
-rw-r--r--nuttx/configs/rgmp/arm/default/Make.defs118
-rw-r--r--nuttx/configs/rgmp/arm/default/appconfig39
-rw-r--r--nuttx/configs/rgmp/arm/default/defconfig240
-rw-r--r--nuttx/configs/rgmp/arm/default/setenv.sh47
-rw-r--r--nuttx/configs/rgmp/arm/nsh/Make.defs118
-rw-r--r--nuttx/configs/rgmp/arm/nsh/appconfig55
-rw-r--r--nuttx/configs/rgmp/arm/nsh/defconfig241
-rw-r--r--nuttx/configs/rgmp/arm/nsh/setenv.sh47
-rw-r--r--nuttx/configs/rgmp/include/README.txt1
-rw-r--r--nuttx/configs/rgmp/include/stdarg.h8
-rw-r--r--nuttx/configs/rgmp/src/README.txt1
-rw-r--r--nuttx/configs/rgmp/x86/default/Make.defs117
-rw-r--r--nuttx/configs/rgmp/x86/default/appconfig39
-rw-r--r--nuttx/configs/rgmp/x86/default/defconfig254
-rw-r--r--nuttx/configs/rgmp/x86/default/setenv.sh47
-rw-r--r--nuttx/configs/rgmp/x86/nsh/Make.defs117
-rw-r--r--nuttx/configs/rgmp/x86/nsh/appconfig55
-rw-r--r--nuttx/configs/rgmp/x86/nsh/defconfig255
-rw-r--r--nuttx/configs/rgmp/x86/nsh/setenv.sh47
-rw-r--r--nuttx/configs/sam3u-ek/Kconfig7
-rw-r--r--nuttx/configs/sam3u-ek/README.txt368
-rw-r--r--nuttx/configs/sam3u-ek/include/board.h206
-rw-r--r--nuttx/configs/sam3u-ek/kernel/Makefile136
-rw-r--r--nuttx/configs/sam3u-ek/kernel/kernel.ld147
-rw-r--r--nuttx/configs/sam3u-ek/knsh/Make.defs163
-rw-r--r--nuttx/configs/sam3u-ek/knsh/appconfig44
-rwxr-xr-xnuttx/configs/sam3u-ek/knsh/defconfig480
-rwxr-xr-xnuttx/configs/sam3u-ek/knsh/ld.script127
-rwxr-xr-xnuttx/configs/sam3u-ek/knsh/setenv.sh46
-rw-r--r--nuttx/configs/sam3u-ek/nsh/Make.defs163
-rw-r--r--nuttx/configs/sam3u-ek/nsh/appconfig44
-rwxr-xr-xnuttx/configs/sam3u-ek/nsh/defconfig455
-rwxr-xr-xnuttx/configs/sam3u-ek/nsh/ld.script111
-rwxr-xr-xnuttx/configs/sam3u-ek/nsh/setenv.sh46
-rw-r--r--nuttx/configs/sam3u-ek/nx/Make.defs163
-rw-r--r--nuttx/configs/sam3u-ek/nx/appconfig39
-rwxr-xr-xnuttx/configs/sam3u-ek/nx/defconfig481
-rwxr-xr-xnuttx/configs/sam3u-ek/nx/ld.script111
-rwxr-xr-xnuttx/configs/sam3u-ek/nx/setenv.sh46
-rw-r--r--nuttx/configs/sam3u-ek/ostest/Make.defs163
-rw-r--r--nuttx/configs/sam3u-ek/ostest/appconfig39
-rwxr-xr-xnuttx/configs/sam3u-ek/ostest/defconfig455
-rwxr-xr-xnuttx/configs/sam3u-ek/ostest/ld.script111
-rwxr-xr-xnuttx/configs/sam3u-ek/ostest/setenv.sh46
-rw-r--r--nuttx/configs/sam3u-ek/src/Makefile96
-rw-r--r--nuttx/configs/sam3u-ek/src/sam3uek_internal.h257
-rw-r--r--nuttx/configs/sam3u-ek/src/up_boot.c113
-rw-r--r--nuttx/configs/sam3u-ek/src/up_buttons.c185
-rw-r--r--nuttx/configs/sam3u-ek/src/up_lcd.c1069
-rw-r--r--nuttx/configs/sam3u-ek/src/up_leds.c197
-rw-r--r--nuttx/configs/sam3u-ek/src/up_mmcsd.c139
-rw-r--r--nuttx/configs/sam3u-ek/src/up_nsh.c164
-rw-r--r--nuttx/configs/sam3u-ek/src/up_spi.c243
-rw-r--r--nuttx/configs/sam3u-ek/src/up_touchscreen.c292
-rw-r--r--nuttx/configs/sam3u-ek/src/up_usbdev.c111
-rw-r--r--nuttx/configs/sam3u-ek/src/up_usbmsc.c152
-rw-r--r--nuttx/configs/sam3u-ek/touchscreen/Make.defs163
-rw-r--r--nuttx/configs/sam3u-ek/touchscreen/appconfig49
-rwxr-xr-xnuttx/configs/sam3u-ek/touchscreen/defconfig565
-rwxr-xr-xnuttx/configs/sam3u-ek/touchscreen/ld.script111
-rwxr-xr-xnuttx/configs/sam3u-ek/touchscreen/setenv.sh47
-rw-r--r--nuttx/configs/shenzhou/Kconfig7
-rw-r--r--nuttx/configs/shenzhou/README.txt689
-rw-r--r--nuttx/configs/shenzhou/include/board.h377
-rw-r--r--nuttx/configs/shenzhou/nsh/Make.defs196
-rw-r--r--nuttx/configs/shenzhou/nsh/defconfig903
-rwxr-xr-xnuttx/configs/shenzhou/nsh/setenv.sh78
-rw-r--r--nuttx/configs/shenzhou/scripts/ld.script109
-rw-r--r--nuttx/configs/shenzhou/scripts/ld.script.dfu111
-rw-r--r--nuttx/configs/shenzhou/src/Makefile127
-rw-r--r--nuttx/configs/shenzhou/src/shenzhou-internal.h274
-rw-r--r--nuttx/configs/shenzhou/src/up_autoleds.c401
-rw-r--r--nuttx/configs/shenzhou/src/up_boot.c102
-rw-r--r--nuttx/configs/shenzhou/src/up_buttons.c169
-rw-r--r--nuttx/configs/shenzhou/src/up_can.c133
-rw-r--r--nuttx/configs/shenzhou/src/up_clockconfig.c167
-rw-r--r--nuttx/configs/shenzhou/src/up_composite.c106
-rw-r--r--nuttx/configs/shenzhou/src/up_cxxinitialize.c155
-rw-r--r--nuttx/configs/shenzhou/src/up_mmcsd.c124
-rw-r--r--nuttx/configs/shenzhou/src/up_nsh.c189
-rw-r--r--nuttx/configs/shenzhou/src/up_spi.c206
-rw-r--r--nuttx/configs/shenzhou/src/up_usb.c294
-rw-r--r--nuttx/configs/shenzhou/src/up_usbmsc.c103
-rw-r--r--nuttx/configs/shenzhou/src/up_userleds.c131
-rw-r--r--nuttx/configs/shenzhou/src/up_watchdog.c136
-rw-r--r--nuttx/configs/shenzhou/tools/olimex-arm-usb-ocd.cfg11
-rwxr-xr-xnuttx/configs/shenzhou/tools/oocd.sh92
-rw-r--r--nuttx/configs/shenzhou/tools/stm32.cfg69
-rw-r--r--nuttx/configs/shenzhou/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/sim/Kconfig7
-rw-r--r--nuttx/configs/sim/README.txt501
-rw-r--r--nuttx/configs/sim/doc/test-results.txt2914
-rw-r--r--nuttx/configs/sim/include/README.txt1
-rw-r--r--nuttx/configs/sim/mount/Make.defs139
-rw-r--r--nuttx/configs/sim/mount/appconfig39
-rw-r--r--nuttx/configs/sim/mount/defconfig226
-rwxr-xr-xnuttx/configs/sim/mount/setenv.sh45
-rw-r--r--nuttx/configs/sim/nettest/Make.defs139
-rw-r--r--nuttx/configs/sim/nettest/appconfig43
-rw-r--r--nuttx/configs/sim/nettest/defconfig225
-rwxr-xr-xnuttx/configs/sim/nettest/setenv.sh45
-rw-r--r--nuttx/configs/sim/nsh/Make.defs139
-rw-r--r--nuttx/configs/sim/nsh/appconfig44
-rw-r--r--nuttx/configs/sim/nsh/defconfig270
-rwxr-xr-xnuttx/configs/sim/nsh/setenv.sh45
-rw-r--r--nuttx/configs/sim/nsh2/Make.defs140
-rw-r--r--nuttx/configs/sim/nsh2/appconfig51
-rw-r--r--nuttx/configs/sim/nsh2/defconfig373
-rwxr-xr-xnuttx/configs/sim/nsh2/setenv.sh45
-rw-r--r--nuttx/configs/sim/nx/Make.defs139
-rw-r--r--nuttx/configs/sim/nx/appconfig42
-rw-r--r--nuttx/configs/sim/nx/defconfig327
-rwxr-xr-xnuttx/configs/sim/nx/setenv.sh45
-rw-r--r--nuttx/configs/sim/nx11/Make.defs139
-rw-r--r--nuttx/configs/sim/nx11/appconfig41
-rw-r--r--nuttx/configs/sim/nx11/defconfig322
-rwxr-xr-xnuttx/configs/sim/nx11/setenv.sh45
-rw-r--r--nuttx/configs/sim/nxffs/Make.defs139
-rw-r--r--nuttx/configs/sim/nxffs/appconfig39
-rw-r--r--nuttx/configs/sim/nxffs/defconfig235
-rwxr-xr-xnuttx/configs/sim/nxffs/setenv.sh45
-rw-r--r--nuttx/configs/sim/nxwm/Make.defs139
-rw-r--r--nuttx/configs/sim/nxwm/appconfig40
-rw-r--r--nuttx/configs/sim/nxwm/defconfig405
-rwxr-xr-xnuttx/configs/sim/nxwm/setenv.sh45
-rw-r--r--nuttx/configs/sim/ostest/Make.defs139
-rw-r--r--nuttx/configs/sim/ostest/appconfig39
-rw-r--r--nuttx/configs/sim/ostest/defconfig219
-rwxr-xr-xnuttx/configs/sim/ostest/setenv.sh45
-rw-r--r--nuttx/configs/sim/pashello/Make.defs141
-rw-r--r--nuttx/configs/sim/pashello/appconfig42
-rw-r--r--nuttx/configs/sim/pashello/defconfig214
-rwxr-xr-xnuttx/configs/sim/pashello/setenv.sh45
-rw-r--r--nuttx/configs/sim/src/Makefile83
-rw-r--r--nuttx/configs/sim/src/README.txt1
-rw-r--r--nuttx/configs/sim/src/up_touchscreen.c182
-rw-r--r--nuttx/configs/sim/touchscreen/Make.defs139
-rw-r--r--nuttx/configs/sim/touchscreen/appconfig39
-rw-r--r--nuttx/configs/sim/touchscreen/defconfig321
-rwxr-xr-xnuttx/configs/sim/touchscreen/setenv.sh45
-rw-r--r--nuttx/configs/skp16c26/Kconfig7
-rw-r--r--nuttx/configs/skp16c26/README.txt116
-rw-r--r--nuttx/configs/skp16c26/include/README.txt2
-rw-r--r--nuttx/configs/skp16c26/include/board.h138
-rw-r--r--nuttx/configs/skp16c26/ostest/Make.defs107
-rw-r--r--nuttx/configs/skp16c26/ostest/appconfig39
-rw-r--r--nuttx/configs/skp16c26/ostest/defconfig320
-rw-r--r--nuttx/configs/skp16c26/ostest/ld.script139
-rwxr-xr-xnuttx/configs/skp16c26/ostest/setenv.sh46
-rw-r--r--nuttx/configs/skp16c26/src/Makefile77
-rw-r--r--nuttx/configs/skp16c26/src/README.txt2
-rw-r--r--nuttx/configs/skp16c26/src/skp16c26_internal.h67
-rw-r--r--nuttx/configs/skp16c26/src/up_buttons.c111
-rw-r--r--nuttx/configs/skp16c26/src/up_lcd.c282
-rw-r--r--nuttx/configs/skp16c26/src/up_lcdconsole.c141
-rw-r--r--nuttx/configs/skp16c26/src/up_leds.c245
-rw-r--r--nuttx/configs/stm3210e-eval/Kconfig147
-rw-r--r--nuttx/configs/stm3210e-eval/README.txt915
-rw-r--r--nuttx/configs/stm3210e-eval/RIDE/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/RIDE/README.txt38
-rw-r--r--nuttx/configs/stm3210e-eval/RIDE/appconfig39
-rw-r--r--nuttx/configs/stm3210e-eval/RIDE/bigfatstub.c31
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/defconfig470
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/nuttx.ctx40
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/nuttx.dbi23
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/nuttx.elf.ld19
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/nuttx.rapp83
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/nuttx.rdbbin0 -> 116746 bytes
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/nuttx.rprj4
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/setenv.sh47
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/stm32-ld.sh18
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/stm32-nuttx.ld111
-rw-r--r--nuttx/configs/stm3210e-eval/buttons/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/buttons/appconfig39
-rw-r--r--nuttx/configs/stm3210e-eval/buttons/defconfig497
-rwxr-xr-xnuttx/configs/stm3210e-eval/buttons/setenv.sh47
-rw-r--r--nuttx/configs/stm3210e-eval/composite/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/composite/appconfig39
-rwxr-xr-xnuttx/configs/stm3210e-eval/composite/defconfig562
-rwxr-xr-xnuttx/configs/stm3210e-eval/composite/setenv.sh67
-rw-r--r--nuttx/configs/stm3210e-eval/include/README.txt1
-rw-r--r--nuttx/configs/stm3210e-eval/include/board.h323
-rw-r--r--nuttx/configs/stm3210e-eval/nsh/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/nsh/appconfig42
-rwxr-xr-xnuttx/configs/stm3210e-eval/nsh/defconfig482
-rwxr-xr-xnuttx/configs/stm3210e-eval/nsh/setenv.sh47
-rw-r--r--nuttx/configs/stm3210e-eval/nsh2/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/nsh2/appconfig63
-rw-r--r--nuttx/configs/stm3210e-eval/nsh2/defconfig723
-rwxr-xr-xnuttx/configs/stm3210e-eval/nsh2/setenv.sh67
-rw-r--r--nuttx/configs/stm3210e-eval/nx/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/nx/appconfig39
-rw-r--r--nuttx/configs/stm3210e-eval/nx/defconfig602
-rwxr-xr-xnuttx/configs/stm3210e-eval/nx/setenv.sh62
-rw-r--r--nuttx/configs/stm3210e-eval/nxconsole/Make.defs177
-rw-r--r--nuttx/configs/stm3210e-eval/nxconsole/appconfig55
-rw-r--r--nuttx/configs/stm3210e-eval/nxconsole/defconfig629
-rwxr-xr-xnuttx/configs/stm3210e-eval/nxconsole/setenv.sh62
-rw-r--r--nuttx/configs/stm3210e-eval/nxlines/Make.defs177
-rw-r--r--nuttx/configs/stm3210e-eval/nxlines/appconfig38
-rw-r--r--nuttx/configs/stm3210e-eval/nxlines/defconfig626
-rwxr-xr-xnuttx/configs/stm3210e-eval/nxlines/setenv.sh53
-rw-r--r--nuttx/configs/stm3210e-eval/nxtext/Make.defs177
-rw-r--r--nuttx/configs/stm3210e-eval/nxtext/appconfig39
-rw-r--r--nuttx/configs/stm3210e-eval/nxtext/defconfig626
-rwxr-xr-xnuttx/configs/stm3210e-eval/nxtext/setenv.sh62
-rw-r--r--nuttx/configs/stm3210e-eval/ostest/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/ostest/appconfig39
-rwxr-xr-xnuttx/configs/stm3210e-eval/ostest/defconfig490
-rwxr-xr-xnuttx/configs/stm3210e-eval/ostest/setenv.sh47
-rw-r--r--nuttx/configs/stm3210e-eval/pm/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/pm/appconfig63
-rw-r--r--nuttx/configs/stm3210e-eval/pm/defconfig768
-rwxr-xr-xnuttx/configs/stm3210e-eval/pm/setenv.sh67
-rw-r--r--nuttx/configs/stm3210e-eval/scripts/ld.script112
-rw-r--r--nuttx/configs/stm3210e-eval/scripts/ld.script.dfu111
-rw-r--r--nuttx/configs/stm3210e-eval/src/Makefile131
-rw-r--r--nuttx/configs/stm3210e-eval/src/README.txt1
-rw-r--r--nuttx/configs/stm3210e-eval/src/stm3210e-internal.h322
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_adc.c164
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_boot.c108
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_buttons.c170
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_can.c134
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_composite.c163
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_deselectlcd.c97
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_deselectnor.c95
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_deselectsram.c97
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_extcontext.c117
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_extmem.c191
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_idle.c450
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_lcd.c1867
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_leds.c401
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_lm75.c128
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_nsh.c213
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_pm.c107
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_pmbuttons.c319
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_selectlcd.c146
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_selectnor.c140
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_selectsram.c146
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_spi.c178
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_usbdev.c116
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_usbmsc.c164
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_watchdog.c136
-rw-r--r--nuttx/configs/stm3210e-eval/tools/olimex-arm-usb-ocd.cfg13
-rwxr-xr-xnuttx/configs/stm3210e-eval/tools/oocd.sh90
-rw-r--r--nuttx/configs/stm3210e-eval/tools/stm32.cfg69
-rw-r--r--nuttx/configs/stm3210e-eval/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/stm3210e-eval/usbserial/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/usbserial/appconfig39
-rwxr-xr-xnuttx/configs/stm3210e-eval/usbserial/defconfig516
-rwxr-xr-xnuttx/configs/stm3210e-eval/usbserial/setenv.sh47
-rw-r--r--nuttx/configs/stm3210e-eval/usbstorage/Make.defs175
-rw-r--r--nuttx/configs/stm3210e-eval/usbstorage/appconfig39
-rwxr-xr-xnuttx/configs/stm3210e-eval/usbstorage/defconfig503
-rwxr-xr-xnuttx/configs/stm3210e-eval/usbstorage/setenv.sh47
-rw-r--r--nuttx/configs/stm3220g-eval/Kconfig42
-rw-r--r--nuttx/configs/stm3220g-eval/README.txt1015
-rw-r--r--nuttx/configs/stm3220g-eval/dhcpd/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/dhcpd/appconfig43
-rw-r--r--nuttx/configs/stm3220g-eval/dhcpd/defconfig635
-rw-r--r--nuttx/configs/stm3220g-eval/dhcpd/ld.script121
-rwxr-xr-xnuttx/configs/stm3220g-eval/dhcpd/setenv.sh75
-rw-r--r--nuttx/configs/stm3220g-eval/include/board.h536
-rw-r--r--nuttx/configs/stm3220g-eval/nettest/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/nettest/appconfig42
-rw-r--r--nuttx/configs/stm3220g-eval/nettest/defconfig628
-rw-r--r--nuttx/configs/stm3220g-eval/nettest/ld.script121
-rwxr-xr-xnuttx/configs/stm3220g-eval/nettest/setenv.sh75
-rw-r--r--nuttx/configs/stm3220g-eval/nsh/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/nsh/appconfig102
-rw-r--r--nuttx/configs/stm3220g-eval/nsh/defconfig850
-rw-r--r--nuttx/configs/stm3220g-eval/nsh/ld.script121
-rwxr-xr-xnuttx/configs/stm3220g-eval/nsh/setenv.sh75
-rw-r--r--nuttx/configs/stm3220g-eval/nsh2/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/nsh2/appconfig102
-rw-r--r--nuttx/configs/stm3220g-eval/nsh2/defconfig837
-rw-r--r--nuttx/configs/stm3220g-eval/nsh2/ld.script121
-rwxr-xr-xnuttx/configs/stm3220g-eval/nsh2/setenv.sh74
-rw-r--r--nuttx/configs/stm3220g-eval/nxwm/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/nxwm/appconfig53
-rw-r--r--nuttx/configs/stm3220g-eval/nxwm/defconfig871
-rw-r--r--nuttx/configs/stm3220g-eval/nxwm/ld.script121
-rwxr-xr-xnuttx/configs/stm3220g-eval/nxwm/setenv.sh75
-rw-r--r--nuttx/configs/stm3220g-eval/ostest/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/ostest/appconfig39
-rw-r--r--nuttx/configs/stm3220g-eval/ostest/defconfig729
-rw-r--r--nuttx/configs/stm3220g-eval/ostest/ld.script120
-rwxr-xr-xnuttx/configs/stm3220g-eval/ostest/setenv.sh75
-rw-r--r--nuttx/configs/stm3220g-eval/src/Makefile131
-rw-r--r--nuttx/configs/stm3220g-eval/src/stm3220g-internal.h374
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_adc.c168
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_autoleds.c260
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_boot.c108
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_buttons.c170
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_can.c142
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_cxxinitialize.c155
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_deselectlcd.c98
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_deselectsram.c97
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_extmem.c188
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_lcd.c1210
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_nsh.c232
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_pwm.c120
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_selectlcd.c169
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_selectsram.c194
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_spi.c161
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_stmpe811.c353
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_usb.c292
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_userleds.c131
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_watchdog.c136
-rw-r--r--nuttx/configs/stm3220g-eval/telnetd/Make.defs198
-rw-r--r--nuttx/configs/stm3220g-eval/telnetd/appconfig44
-rw-r--r--nuttx/configs/stm3220g-eval/telnetd/defconfig644
-rw-r--r--nuttx/configs/stm3220g-eval/telnetd/ld.script121
-rwxr-xr-xnuttx/configs/stm3220g-eval/telnetd/setenv.sh75
-rw-r--r--nuttx/configs/stm3220g-eval/tools/olimex-arm-usb-ocd.cfg13
-rw-r--r--nuttx/configs/stm3220g-eval/tools/oocd.sh90
-rw-r--r--nuttx/configs/stm3220g-eval/tools/stm32.cfg69
-rw-r--r--nuttx/configs/stm3220g-eval/tools/usb-driver.txt25
-rw-r--r--nuttx/configs/stm3240g-eval/Kconfig42
-rw-r--r--nuttx/configs/stm3240g-eval/README.txt1330
-rw-r--r--nuttx/configs/stm3240g-eval/dhcpd/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/dhcpd/appconfig43
-rw-r--r--nuttx/configs/stm3240g-eval/dhcpd/defconfig641
-rwxr-xr-xnuttx/configs/stm3240g-eval/dhcpd/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/discover/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/discover/defconfig866
-rwxr-xr-xnuttx/configs/stm3240g-eval/discover/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/include/board.h553
-rw-r--r--nuttx/configs/stm3240g-eval/nettest/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/nettest/appconfig42
-rw-r--r--nuttx/configs/stm3240g-eval/nettest/defconfig634
-rwxr-xr-xnuttx/configs/stm3240g-eval/nettest/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/nsh/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/nsh/appconfig102
-rw-r--r--nuttx/configs/stm3240g-eval/nsh/defconfig843
-rwxr-xr-xnuttx/configs/stm3240g-eval/nsh/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/nsh2/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/nsh2/appconfig89
-rw-r--r--nuttx/configs/stm3240g-eval/nsh2/defconfig699
-rwxr-xr-xnuttx/configs/stm3240g-eval/nsh2/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/nxconsole/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/nxconsole/appconfig99
-rw-r--r--nuttx/configs/stm3240g-eval/nxconsole/defconfig806
-rwxr-xr-xnuttx/configs/stm3240g-eval/nxconsole/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/nxwm/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/nxwm/appconfig53
-rw-r--r--nuttx/configs/stm3240g-eval/nxwm/defconfig876
-rwxr-xr-xnuttx/configs/stm3240g-eval/nxwm/setenv.sh67
-rw-r--r--nuttx/configs/stm3240g-eval/ostest/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/ostest/appconfig39
-rw-r--r--nuttx/configs/stm3240g-eval/ostest/defconfig734
-rwxr-xr-xnuttx/configs/stm3240g-eval/ostest/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/scripts/ld.script122
-rw-r--r--nuttx/configs/stm3240g-eval/src/Makefile135
-rw-r--r--nuttx/configs/stm3240g-eval/src/stm3240g-internal.h373
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_adc.c168
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_autoleds.c260
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_boot.c109
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_buttons.c170
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_can.c142
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_cxxinitialize.c155
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_deselectlcd.c98
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_deselectsram.c97
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_extmem.c188
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_lcd.c1210
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_nsh.c235
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_ostest.c114
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_pwm.c120
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_selectlcd.c169
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_selectsram.c194
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_spi.c161
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_stmpe811.c353
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_usb.c294
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_userleds.c131
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_watchdog.c136
-rw-r--r--nuttx/configs/stm3240g-eval/telnetd/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/telnetd/appconfig44
-rw-r--r--nuttx/configs/stm3240g-eval/telnetd/defconfig650
-rwxr-xr-xnuttx/configs/stm3240g-eval/telnetd/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/webserver/Make.defs197
-rw-r--r--nuttx/configs/stm3240g-eval/webserver/appconfig38
-rw-r--r--nuttx/configs/stm3240g-eval/webserver/defconfig844
-rw-r--r--nuttx/configs/stm3240g-eval/webserver/setenv.sh75
-rw-r--r--nuttx/configs/stm3240g-eval/xmlrpc/Make.defs198
-rw-r--r--nuttx/configs/stm3240g-eval/xmlrpc/defconfig866
-rw-r--r--nuttx/configs/stm3240g-eval/xmlrpc/setenv.sh75
-rw-r--r--nuttx/configs/stm32f4discovery/Kconfig57
-rw-r--r--nuttx/configs/stm32f4discovery/README.txt1195
-rw-r--r--nuttx/configs/stm32f4discovery/include/board.h323
-rw-r--r--nuttx/configs/stm32f4discovery/nsh/Make.defs198
-rw-r--r--nuttx/configs/stm32f4discovery/nsh/appconfig67
-rw-r--r--nuttx/configs/stm32f4discovery/nsh/defconfig713
-rwxr-xr-xnuttx/configs/stm32f4discovery/nsh/setenv.sh75
-rw-r--r--nuttx/configs/stm32f4discovery/nxlines/Make.defs198
-rw-r--r--nuttx/configs/stm32f4discovery/nxlines/appconfig38
-rw-r--r--nuttx/configs/stm32f4discovery/nxlines/defconfig731
-rwxr-xr-xnuttx/configs/stm32f4discovery/nxlines/setenv.sh75
-rw-r--r--nuttx/configs/stm32f4discovery/ostest/Make.defs198
-rw-r--r--nuttx/configs/stm32f4discovery/ostest/appconfig39
-rw-r--r--nuttx/configs/stm32f4discovery/ostest/defconfig747
-rwxr-xr-xnuttx/configs/stm32f4discovery/ostest/setenv.sh75
-rw-r--r--nuttx/configs/stm32f4discovery/pm/Make.defs198
-rw-r--r--nuttx/configs/stm32f4discovery/pm/appconfig67
-rw-r--r--nuttx/configs/stm32f4discovery/pm/defconfig736
-rw-r--r--nuttx/configs/stm32f4discovery/pm/setenv.sh75
-rw-r--r--nuttx/configs/stm32f4discovery/scripts/ld.script122
-rw-r--r--nuttx/configs/stm32f4discovery/src/Makefile139
-rw-r--r--nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h253
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_autoleds.c260
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_boot.c103
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_buttons.c165
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_cxxinitialize.c155
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_extmem.c188
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_idle.c277
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_nsh.c134
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_pm.c107
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_pmbuttons.c149
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_pwm.c142
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_qencoder.c187
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_spi.c165
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_ssd1289.c426
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_usb.c294
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_userleds.c248
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_watchdog.c136
-rw-r--r--nuttx/configs/sure-pic32mx/Kconfig7
-rw-r--r--nuttx/configs/sure-pic32mx/README.txt716
-rw-r--r--nuttx/configs/sure-pic32mx/include/board.h214
-rw-r--r--nuttx/configs/sure-pic32mx/nsh/Make.defs161
-rw-r--r--nuttx/configs/sure-pic32mx/nsh/appconfig77
-rw-r--r--nuttx/configs/sure-pic32mx/nsh/defconfig532
-rw-r--r--nuttx/configs/sure-pic32mx/nsh/ld.script317
-rwxr-xr-xnuttx/configs/sure-pic32mx/nsh/setenv.sh61
-rw-r--r--nuttx/configs/sure-pic32mx/ostest/Make.defs161
-rw-r--r--nuttx/configs/sure-pic32mx/ostest/appconfig39
-rw-r--r--nuttx/configs/sure-pic32mx/ostest/defconfig462
-rw-r--r--nuttx/configs/sure-pic32mx/ostest/ld.script317
-rwxr-xr-xnuttx/configs/sure-pic32mx/ostest/setenv.sh61
-rw-r--r--nuttx/configs/sure-pic32mx/src/Makefile108
-rw-r--r--nuttx/configs/sure-pic32mx/src/sure-internal.h122
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_boot.c102
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_buttons.c223
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_leds.c218
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_nsh.c360
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_spi.c272
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_usbdev.c175
-rw-r--r--nuttx/configs/sure-pic32mx/src/up_usbterm.c108
-rw-r--r--nuttx/configs/sure-pic32mx/usbnsh/Make.defs161
-rw-r--r--nuttx/configs/sure-pic32mx/usbnsh/appconfig47
-rw-r--r--nuttx/configs/sure-pic32mx/usbnsh/defconfig529
-rw-r--r--nuttx/configs/sure-pic32mx/usbnsh/ld.script317
-rwxr-xr-xnuttx/configs/sure-pic32mx/usbnsh/setenv.sh61
-rw-r--r--nuttx/configs/teensy/Kconfig13
-rw-r--r--nuttx/configs/teensy/README.txt544
-rw-r--r--nuttx/configs/teensy/hello/Make.defs150
-rw-r--r--nuttx/configs/teensy/hello/appconfig39
-rw-r--r--nuttx/configs/teensy/hello/defconfig411
-rw-r--r--nuttx/configs/teensy/hello/ld.script210
-rwxr-xr-xnuttx/configs/teensy/hello/setenv.sh63
-rw-r--r--nuttx/configs/teensy/include/board.h99
-rw-r--r--nuttx/configs/teensy/nsh/Make.defs150
-rw-r--r--nuttx/configs/teensy/nsh/appconfig55
-rwxr-xr-xnuttx/configs/teensy/nsh/defconfig410
-rwxr-xr-xnuttx/configs/teensy/nsh/ld.script210
-rwxr-xr-xnuttx/configs/teensy/nsh/setenv.sh63
-rw-r--r--nuttx/configs/teensy/src/Makefile103
-rw-r--r--nuttx/configs/teensy/src/teensy_internal.h101
-rw-r--r--nuttx/configs/teensy/src/up_boot.c93
-rw-r--r--nuttx/configs/teensy/src/up_leds.c194
-rw-r--r--nuttx/configs/teensy/src/up_spi.c202
-rw-r--r--nuttx/configs/teensy/src/up_usbmsc.c137
-rw-r--r--nuttx/configs/teensy/usbstorage/Make.defs150
-rw-r--r--nuttx/configs/teensy/usbstorage/appconfig39
-rwxr-xr-xnuttx/configs/teensy/usbstorage/defconfig430
-rwxr-xr-xnuttx/configs/teensy/usbstorage/ld.script210
-rwxr-xr-xnuttx/configs/teensy/usbstorage/setenv.sh63
-rw-r--r--nuttx/configs/twr-k60n512/Kconfig7
-rw-r--r--nuttx/configs/twr-k60n512/README.txt640
-rw-r--r--nuttx/configs/twr-k60n512/include/board.h438
-rw-r--r--nuttx/configs/twr-k60n512/nsh/Make.defs163
-rw-r--r--nuttx/configs/twr-k60n512/nsh/appconfig42
-rw-r--r--nuttx/configs/twr-k60n512/nsh/defconfig465
-rw-r--r--nuttx/configs/twr-k60n512/nsh/ld.script135
-rw-r--r--nuttx/configs/twr-k60n512/nsh/setenv.sh61
-rw-r--r--nuttx/configs/twr-k60n512/ostest/Make.defs163
-rw-r--r--nuttx/configs/twr-k60n512/ostest/appconfig39
-rw-r--r--nuttx/configs/twr-k60n512/ostest/defconfig462
-rw-r--r--nuttx/configs/twr-k60n512/ostest/ld.script135
-rw-r--r--nuttx/configs/twr-k60n512/ostest/setenv.sh61
-rw-r--r--nuttx/configs/twr-k60n512/src/Makefile105
-rw-r--r--nuttx/configs/twr-k60n512/src/twrk60-internal.h309
-rw-r--r--nuttx/configs/twr-k60n512/src/up_boot.c102
-rw-r--r--nuttx/configs/twr-k60n512/src/up_buttons.c168
-rw-r--r--nuttx/configs/twr-k60n512/src/up_leds.c263
-rw-r--r--nuttx/configs/twr-k60n512/src/up_nsh.c267
-rw-r--r--nuttx/configs/twr-k60n512/src/up_spi.c164
-rw-r--r--nuttx/configs/twr-k60n512/src/up_usbdev.c115
-rw-r--r--nuttx/configs/twr-k60n512/src/up_usbmsc.c118
-rw-r--r--nuttx/configs/ubw32/Kconfig7
-rw-r--r--nuttx/configs/ubw32/README.txt651
-rw-r--r--nuttx/configs/ubw32/include/board.h244
-rw-r--r--nuttx/configs/ubw32/nsh/Make.defs161
-rw-r--r--nuttx/configs/ubw32/nsh/appconfig87
-rw-r--r--nuttx/configs/ubw32/nsh/defconfig507
-rw-r--r--nuttx/configs/ubw32/nsh/ld.script317
-rwxr-xr-xnuttx/configs/ubw32/nsh/setenv.sh61
-rw-r--r--nuttx/configs/ubw32/ostest/Make.defs161
-rw-r--r--nuttx/configs/ubw32/ostest/appconfig39
-rw-r--r--nuttx/configs/ubw32/ostest/defconfig506
-rw-r--r--nuttx/configs/ubw32/ostest/ld.script317
-rwxr-xr-xnuttx/configs/ubw32/ostest/setenv.sh61
-rw-r--r--nuttx/configs/ubw32/src/Makefile99
-rw-r--r--nuttx/configs/ubw32/src/ubw32-internal.h101
-rw-r--r--nuttx/configs/ubw32/src/up_boot.c93
-rw-r--r--nuttx/configs/ubw32/src/up_buttons.c198
-rw-r--r--nuttx/configs/ubw32/src/up_leds.c266
-rw-r--r--nuttx/configs/ubw32/src/up_nsh.c119
-rw-r--r--nuttx/configs/ubw32/src/up_usbdev.c148
-rw-r--r--nuttx/configs/ubw32/src/up_usbterm.c105
-rw-r--r--nuttx/configs/us7032evb1/Kconfig13
-rw-r--r--nuttx/configs/us7032evb1/README.txt138
-rw-r--r--nuttx/configs/us7032evb1/bin/README.txt2
-rw-r--r--nuttx/configs/us7032evb1/include/README.txt2
-rw-r--r--nuttx/configs/us7032evb1/include/board.h100
-rw-r--r--nuttx/configs/us7032evb1/nsh/Make.defs105
-rw-r--r--nuttx/configs/us7032evb1/nsh/appconfig44
-rw-r--r--nuttx/configs/us7032evb1/nsh/defconfig325
-rw-r--r--nuttx/configs/us7032evb1/nsh/ld.script91
-rwxr-xr-xnuttx/configs/us7032evb1/nsh/setenv.sh47
-rw-r--r--nuttx/configs/us7032evb1/ostest/Make.defs105
-rw-r--r--nuttx/configs/us7032evb1/ostest/appconfig39
-rw-r--r--nuttx/configs/us7032evb1/ostest/defconfig325
-rw-r--r--nuttx/configs/us7032evb1/ostest/ld.script91
-rwxr-xr-xnuttx/configs/us7032evb1/ostest/setenv.sh47
-rw-r--r--nuttx/configs/us7032evb1/shterm/Makefile51
-rw-r--r--nuttx/configs/us7032evb1/shterm/shterm.c737
-rw-r--r--nuttx/configs/us7032evb1/src/Makefile77
-rw-r--r--nuttx/configs/us7032evb1/src/README.txt3
-rw-r--r--nuttx/configs/us7032evb1/src/up_leds.c135
-rw-r--r--nuttx/configs/vsn/Kconfig4
-rw-r--r--nuttx/configs/vsn/README.txt257
-rw-r--r--nuttx/configs/vsn/include/board.h243
-rw-r--r--nuttx/configs/vsn/include/muxbus.h84
-rw-r--r--nuttx/configs/vsn/include/nsh_romfsimg.h89
-rw-r--r--nuttx/configs/vsn/include/power.h72
-rwxr-xr-xnuttx/configs/vsn/include/rcS.template14
-rw-r--r--nuttx/configs/vsn/nsh/Make.defs179
-rwxr-xr-xnuttx/configs/vsn/nsh/appconfig75
-rwxr-xr-xnuttx/configs/vsn/nsh/defconfig521
-rwxr-xr-xnuttx/configs/vsn/nsh/ld.script111
-rwxr-xr-xnuttx/configs/vsn/nsh/ld.script.dfu110
-rwxr-xr-xnuttx/configs/vsn/nsh/setenv.sh46
-rw-r--r--nuttx/configs/vsn/src/Makefile111
-rw-r--r--nuttx/configs/vsn/src/README.txt58
-rw-r--r--nuttx/configs/vsn/src/boot.c90
-rw-r--r--nuttx/configs/vsn/src/buttons.c88
-rw-r--r--nuttx/configs/vsn/src/chipcon.c83
-rw-r--r--nuttx/configs/vsn/src/leds.c120
-rw-r--r--nuttx/configs/vsn/src/muxbus.c198
-rw-r--r--nuttx/configs/vsn/src/power.c108
-rw-r--r--nuttx/configs/vsn/src/rtac.c106
-rw-r--r--nuttx/configs/vsn/src/sif.c721
-rw-r--r--nuttx/configs/vsn/src/spi.c193
-rw-r--r--nuttx/configs/vsn/src/sysclock.c194
-rw-r--r--nuttx/configs/vsn/src/usbdev.c123
-rw-r--r--nuttx/configs/vsn/src/usbmsc.c156
-rw-r--r--nuttx/configs/vsn/src/vsn.h239
-rw-r--r--nuttx/configs/xtrs/Kconfig4
-rw-r--r--nuttx/configs/xtrs/README.txt169
-rw-r--r--nuttx/configs/xtrs/include/README.txt1
-rw-r--r--nuttx/configs/xtrs/include/board.h71
-rw-r--r--nuttx/configs/xtrs/include/trs80-m3.h185
-rw-r--r--nuttx/configs/xtrs/nsh/Make.defs111
-rw-r--r--nuttx/configs/xtrs/nsh/appconfig44
-rw-r--r--nuttx/configs/xtrs/nsh/defconfig220
-rwxr-xr-xnuttx/configs/xtrs/nsh/setenv.sh45
-rw-r--r--nuttx/configs/xtrs/ostest/Make.defs111
-rw-r--r--nuttx/configs/xtrs/ostest/appconfig39
-rw-r--r--nuttx/configs/xtrs/ostest/defconfig205
-rwxr-xr-xnuttx/configs/xtrs/ostest/setenv.sh45
-rw-r--r--nuttx/configs/xtrs/pashello/Make.defs111
-rw-r--r--nuttx/configs/xtrs/pashello/appconfig43
-rw-r--r--nuttx/configs/xtrs/pashello/defconfig205
-rwxr-xr-xnuttx/configs/xtrs/pashello/setenv.sh45
-rw-r--r--nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch11
-rw-r--r--nuttx/configs/xtrs/src/Make.defs37
-rw-r--r--nuttx/configs/xtrs/src/Makefile77
-rw-r--r--nuttx/configs/xtrs/src/README.txt1
-rw-r--r--nuttx/configs/xtrs/src/xtr_irq.c116
-rw-r--r--nuttx/configs/xtrs/src/xtr_lowputc.c105
-rw-r--r--nuttx/configs/xtrs/src/xtr_serial.c411
-rw-r--r--nuttx/configs/xtrs/src/xtr_timerisr.c94
-rw-r--r--nuttx/configs/xtrs/src/xtrs_head.asm276
-rw-r--r--nuttx/configs/z16f2800100zcog/Kconfig4
-rw-r--r--nuttx/configs/z16f2800100zcog/README.txt90
-rw-r--r--nuttx/configs/z16f2800100zcog/include/board.h84
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/Make.defs172
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/README.txt12
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/appconfig39
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/defconfig218
-rwxr-xr-xnuttx/configs/z16f2800100zcog/ostest/ostest.linkcmd92
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/ostest.zfpproj238
-rwxr-xr-xnuttx/configs/z16f2800100zcog/ostest/setenv.sh51
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/test-result.txt529
-rw-r--r--nuttx/configs/z16f2800100zcog/pashello/Make.defs172
-rw-r--r--nuttx/configs/z16f2800100zcog/pashello/README.txt12
-rw-r--r--nuttx/configs/z16f2800100zcog/pashello/appconfig42
-rw-r--r--nuttx/configs/z16f2800100zcog/pashello/defconfig218
-rwxr-xr-xnuttx/configs/z16f2800100zcog/pashello/pashello.linkcmd92
-rwxr-xr-xnuttx/configs/z16f2800100zcog/pashello/pashello.zfpproj238
-rwxr-xr-xnuttx/configs/z16f2800100zcog/pashello/setenv.sh51
-rw-r--r--nuttx/configs/z16f2800100zcog/src/Makefile84
-rw-r--r--nuttx/configs/z16f2800100zcog/src/z16f_leds.c105
-rw-r--r--nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c90
-rw-r--r--nuttx/configs/z80sim/Kconfig4
-rw-r--r--nuttx/configs/z80sim/README.txt142
-rw-r--r--nuttx/configs/z80sim/include/README.txt1
-rw-r--r--nuttx/configs/z80sim/include/board.h66
-rw-r--r--nuttx/configs/z80sim/nsh/Make.defs111
-rw-r--r--nuttx/configs/z80sim/nsh/appconfig44
-rw-r--r--nuttx/configs/z80sim/nsh/defconfig216
-rwxr-xr-xnuttx/configs/z80sim/nsh/setenv.sh45
-rw-r--r--nuttx/configs/z80sim/ostest/Make.defs111
-rw-r--r--nuttx/configs/z80sim/ostest/appconfig39
-rw-r--r--nuttx/configs/z80sim/ostest/defconfig201
-rwxr-xr-xnuttx/configs/z80sim/ostest/setenv.sh45
-rw-r--r--nuttx/configs/z80sim/pashello/Make.defs111
-rw-r--r--nuttx/configs/z80sim/pashello/appconfig43
-rw-r--r--nuttx/configs/z80sim/pashello/defconfig201
-rwxr-xr-xnuttx/configs/z80sim/pashello/setenv.sh45
-rw-r--r--nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch11
-rw-r--r--nuttx/configs/z80sim/src/Makefile76
-rw-r--r--nuttx/configs/z80sim/src/README.txt1
-rw-r--r--nuttx/configs/z80sim/src/z80_irq.c116
-rw-r--r--nuttx/configs/z80sim/src/z80_lowputc.c103
-rw-r--r--nuttx/configs/z80sim/src/z80_serial.c361
-rw-r--r--nuttx/configs/z80sim/src/z80_timerisr.c95
-rw-r--r--nuttx/configs/z8encore000zco/Kconfig4
-rw-r--r--nuttx/configs/z8encore000zco/README.txt60
-rw-r--r--nuttx/configs/z8encore000zco/include/board.h76
-rw-r--r--nuttx/configs/z8encore000zco/ostest/Make.defs198
-rw-r--r--nuttx/configs/z8encore000zco/ostest/README.txt12
-rw-r--r--nuttx/configs/z8encore000zco/ostest/appconfig39
-rw-r--r--nuttx/configs/z8encore000zco/ostest/defconfig222
-rwxr-xr-xnuttx/configs/z8encore000zco/ostest/ostest.linkcmd80
-rw-r--r--nuttx/configs/z8encore000zco/ostest/ostest.zdsproj291
-rwxr-xr-xnuttx/configs/z8encore000zco/ostest/setenv.sh52
-rw-r--r--nuttx/configs/z8encore000zco/ostest/test-result.txt529
-rw-r--r--nuttx/configs/z8encore000zco/src/Makefile84
-rw-r--r--nuttx/configs/z8encore000zco/src/z8_leds.c243
-rw-r--r--nuttx/configs/z8encore000zco/src/z8_lowinit.c66
-rw-r--r--nuttx/configs/z8f64200100kit/Kconfig4
-rw-r--r--nuttx/configs/z8f64200100kit/README.txt60
-rw-r--r--nuttx/configs/z8f64200100kit/include/board.h76
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/Make.defs198
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/README.txt12
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/appconfig39
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/defconfig222
-rwxr-xr-xnuttx/configs/z8f64200100kit/ostest/ostest.linkcmd80
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/ostest.zdsproj291
-rwxr-xr-xnuttx/configs/z8f64200100kit/ostest/setenv.sh52
-rw-r--r--nuttx/configs/z8f64200100kit/ostest/test-result.txt529
-rw-r--r--nuttx/configs/z8f64200100kit/src/Makefile84
-rw-r--r--nuttx/configs/z8f64200100kit/src/z8_leds.c89
-rw-r--r--nuttx/configs/z8f64200100kit/src/z8_lowinit.c66
1692 files changed, 296252 insertions, 0 deletions
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig
new file mode 100644
index 000000000..c017192d2
--- /dev/null
+++ b/nuttx/configs/Kconfig
@@ -0,0 +1,890 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+choice
+ prompt "Select target board"
+ default ARCH_BOARD_CUSTOM
+ ---help---
+ Select the board hosting the architure. You must first select the
+ exact MCU part number, then the boards supporting that part will
+ be available for selection. Use ARCH_BOARD_CUSTOM to create a new
+ board configuration.
+
+config ARCH_BOARD_AMBER
+ bool "Amber Web Server"
+ depends on ARCH_CHIP_ATMEGA128
+ ---help---
+ This is placeholder for the SoC Robotics Amber Web Server that is based
+ on the Atmel AVR ATMega128 MCU. There is not much there yet and what is
+ there is untested due to tool-related issues.
+
+config ARCH_BOARD_AVR32DEV1
+ bool "Atmel AVR32DEV1 board"
+ depends on ARCH_CHIP_AT32UC3B0256
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ This is a port of NuttX to the Atmel AVR32DEV1 board. That board is
+ based on the Atmel AT32UC3B0256 MCU and uses a specially patched
+ version of the GNU toolchain: The patches provide support for the
+ AVR32 family. That patched GNU toolchain is available only from the
+ Atmel website. STATUS: This port is functional but very basic. There
+ are configurations for NSH and the OS test.
+
+config ARCH_BOARD_C5471EVM
+ bool "Spectrum Digital C5471 evaluation board"
+ depends on ARCH_CHIP_C5471
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is a port to the Spectrum Digital C5471 evaluation board. The
+ TMS320C5471 is a dual core processor from TI with an ARM7TDMI general
+ purpose processor and a c54 DSP. It is also known as TMS320DA180 or just DA180.
+ NuttX runs on the ARM core and is built with a GNU arm-elf toolchain*.
+ This port is complete and verified.
+
+config ARCH_BOARD_COMPALE88
+ bool "Compal e88 phone"
+ depends on ARCH_CHIP_CALYPSO
+ ---help---
+ These directories contain the board support for compal e88 and e99 phones.
+ These ports are based on patches contributed by Denis Carikli for both the
+ compal e99 and e88. The patches were made by Alan Carvalho de Assis and
+ Denis Carikli using the Stefan Richter's Osmocom-bb patches.
+
+config ARCH_BOARD_COMPALE99
+ bool "Compal e99 phone"
+ depends on ARCH_CHIP_CALYPSO
+ ---help---
+ These directories contain the board support for compal e88 and e99 phones.
+ These ports are based on patches contributed by Denis Carikli for both the
+ compal e99 and e88. The patches were made by Alan Carvalho de Assis and
+ Denis Carikli using the Stefan Richter's Osmocom-bb patches.
+
+config ARCH_BOARD_DEMOS92S12NEC64
+ bool "Freescale DMO9S12NE64 board"
+ depends on ARCH_CHIP_MCS92S12NEC64
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ Freescale DMO9S12NE64 board based on the MC9S12NE64 hcs12 cpu. This
+ port uses the m9s12x GCC toolchain. STATUS: (Still) under development; it
+ is code complete but has not yet been verified.
+
+config ARCH_BOARD_EA3131
+ bool "Embedded Artists EA3131 Development board"
+ depends on ARCH_CHIP_LPC3131
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ Embedded Artists EA3131 Development board. This board is based on the
+ an NXP LPC3131 MCU. This OS is built with the arm-elf toolchain*.
+ STATUS: This port is complete and mature.
+
+config ARCH_BOARD_EA3152
+ bool "Embedded Artists EA3152 Development board"
+ depends on ARCH_CHIP_LPC3152
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ Embedded Artists EA3152 Development board. This board is based on the
+ an NXP LPC3152 MCU. This OS is built with the arm-elf toolchain*.
+ STATUS: This port is has not be exercised well, but since it is
+ a simple derivative of the ea3131, it should be fully functional.
+
+config ARCH_BOARD_EAGLE100
+ bool "Micromint Eagle-100 Development board"
+ depends on ARCH_CHIP_LM3S6918
+ select ARCH_HAVE_LEDS
+ ---help---
+ Micromint Eagle-100 Development board. This board is based on the
+ an ARM Cortex-M3 MCU, the Luminary LM3S6918. This OS is built with the
+ arm-elf toolchain*. STATUS: This port is complete and mature.
+
+config ARCH_BOARD_EKK_LM3S9B96
+ bool "TI/Stellaris EKK-LM3S9B96"
+ depends on ARCH_CHIP_LM3S9B96
+ select ARCH_HAVE_LEDS
+ ---help---
+ TI/Stellaris EKK-LM3S9B96 board. This board is based on the
+ an EKK-LM3S9B96 which is a Cortex-M3.
+
+config ARCH_BOARD_EZ80F910200KITG
+ bool "ZiLOG ez80f0910200kitg development kit"
+ depends on ARCH_CHIP_EZ80F91
+ select ARCH_HAVE_LEDS
+ ---help---
+ ez80Acclaim! Microcontroller. This port use the ZiLOG ez80f0910200kitg
+ development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+config ARCH_BOARD_EZ80F910200ZCO
+ bool "ZiLOG ez80f0910200zco development kit"
+ depends on ARCH_CHIP_EZ80F91
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ ez80Acclaim! Microcontroller. This port use the Zilog ez80f0910200zco
+ development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+config ARCH_BOARD_FIRE_STM32V2
+ bool "M3 Wildfire STM32v2 board"
+ depends on ARCH_CHIP_STM32F103VET6
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ A configuration for the M3 Wildfile board. This board is based on the
+ STM32F103VET6 chip. See http://firestm32.taobao.com
+
+config ARCH_BOARD_HYMINI_STM32V
+ bool "HY-Mini STM32v board"
+ depends on ARCH_CHIP_STM32F103VCT
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ A configuration for the HY-Mini STM32v board. This board is based on the
+ STM32F103VCT chip.
+
+config ARCH_BOARD_LINCOLN60
+ bool "Micromint Lincoln 60 board"
+ depends on ARCH_CHIP_LPC1769
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ Micromint Lincoln 60 board using the NXP LPC1769 MCU.
+
+config ARCH_BOARD_KWIKSTIK_K40
+ bool "FreeScale KwikStik-K40 development board"
+ depends on ARCH_CHIP_MK40X256VLQ100
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ Kinetis K40 Cortex-M4 MCU. This port uses the FreeScale KwikStik-K40
+ development board.
+
+config ARCH_BOARD_LM3S6432S2E
+ bool "Stellaris RDK-S2E Reference Design Kit"
+ depends on ARCH_CHIP_LM3S6432
+ select ARCH_HAVE_LEDS
+ ---help---
+ Stellaris RDK-S2E Reference Design Kit and the MDL-S2E Ethernet to
+ Serial module.
+
+config ARCH_BOARD_LM3S6965EK
+ bool "Stellaris LM3S6965 Evaluation Kit"
+ depends on ARCH_CHIP_LM3S6965
+ select ARCH_HAVE_LEDS
+ ---help---
+ Stellaris LM3S6965 Evaluation Kit. This board is based on the
+ an ARM Cortex-M3 MCU, the Luminary/TI LM3S6965. This OS is built with the
+ arm-elf toolchain*. STATUS: This port is complete and mature.
+
+config ARCH_BOARD_LM3S8962EK
+ bool "Stellaris LMS38962 Evaluation Kit"
+ depends on ARCH_CHIP_LM3S8962
+ select ARCH_HAVE_LEDS
+ ---help---
+ Stellaris LMS38962 Evaluation Kit.
+
+config ARCH_BOARD_LPCXPRESSO
+ bool "NXP LPCExpresso LPC1768"
+ depends on ARCH_CHIP_LPC1768
+ ---help---
+ Embedded Artists base board with NXP LPCExpresso LPC1768. This board
+ is based on the NXP LPC1768. The Code Red toolchain is used by default.
+
+config ARCH_BOARD_LPC4330_XPLORER
+ bool "NXG LPC4330-Xplorer"
+ depends on ARCH_CHIP_LPC4330FET100
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ NXG Technologoies LPC4330 Xplorer board. This board is based on the
+ LPC4330FET100. The Code Red toolchain is used by default.
+
+config ARCH_BOARD_M68332EVB
+ bool "Motoroloa M68332EVB"
+ depends on ARCH_M68332
+ ---help---
+ This is a work in progress for the venerable m68322evb board from
+ Motorola. This OS is also built with the arm-elf toolchain. STATUS:
+ This port was never completed.
+
+config ARCH_BOARD_MBED
+ bool "mbed LCP1768"
+ depends on ARCH_CHIP_LPC1768
+ select ARCH_HAVE_LEDS
+ ---help---
+ The configurations in this directory support the mbed board (http://mbed.org)
+ that features the NXP LPC1768 microcontroller. This OS is also built
+ with the arm-elf toolchain*. STATUS: Contributed.
+
+config ARCH_BOARD_MCU123
+ bool "mcu123.com LPC2148 Development Board"
+ depends on ARCH_CHIP_LPC2148
+ select ARCH_HAVE_LEDS
+ ---help---
+ This port is for the NXP LPC2148 as provided on the mcu123.com
+ lpc214x development board. This OS is also built with the arm-elf
+ toolchain*. The port supports serial, timer0, spi, and usb.
+
+config ARCH_BOARD_MICROPENDOUS3
+ bool "Opendous Micropendous 3 board"
+ depends on ARCH_CHIP_AT90USB646 || ARCH_CHIP_AT90USB647 || ARCH_CHIP_AT90USB1286 || ARCH_CHIP_AT90USB1287
+ ---help---
+ This is a port to the Opendous Micropendous 3 board. This board may
+ be populated with either an AVR AT90USB646, 647, 1286, or 1287 MCU.
+ Support is configured for the AT90USB647.
+
+config ARCH_BOARD_MX1ADS
+ bool "Motorola MX1ADS development board"
+ depends on ARCH_CHIP_IMX1
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is a port to the Motorola MX1ADS development board. That board
+ is based on the Freescale i.MX1 processor. The i.MX1 is an ARM920T.
+ STATUS: This port is nearly code complete but was never fully
+ integrated due to tool-related issues.
+
+config ARCH_BOARD_NE64BADGE
+ bool "FEG NE64 /PoE Badge board"
+ depends on ARCH_CHIP_MCS92S12NEC64
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ Future Electronics Group NE64 /PoE Badge board based on the
+ MC9S12NE64 hcs12 cpu. This port uses the m9s12x GCC toolchain.
+ STATUS: Under development. The port is code-complete but has
+ not yet been fully tested.
+
+config ARCH_BOARD_NTOSD_DM320
+ bool "Neuros OSD v1.0 Dev Board"
+ depends on ARCH_CHIP_DM320
+ select ARCH_HAVE_LEDS
+ ---help---
+ This port uses the Neuros OSD v1.0 Dev Board with a GNU arm-elf
+ toolchain*: see
+
+ http://wiki.neurostechnology.com/index.php/OSD_1.0_Developer_Home
+
+ There are some differences between the Dev Board and the currently
+ available commercial v1.0 Boards. See
+
+ http://wiki.neurostechnology.com/index.php/OSD_Developer_Board_v1
+
+ NuttX operates on the ARM9EJS of this dual core processor.
+ STATUS: This port is code complete, verified, and included in the
+ NuttX 0.2.1 release.
+
+config ARCH_BOARD_NUCLEUS2G
+ bool "Nucleus 2G board"
+ depends on ARCH_CHIP_LPC1768
+ select ARCH_HAVE_LEDS
+ ---help---
+ This port uses the Nucleus 2G board (with Babel CAN board). This board
+ features an NXP LPC1768 processor. See the 2G website (http://www.2g-eng.com/)
+ for more information about the Nucleus 2G.
+
+config ARCH_BOARD_LPC1766STK
+ bool "Olimex LPC1766-STK board"
+ depends on ARCH_CHIP_LPC1766
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ This port uses the Olimex LPC1766-STK board and a GNU GCC toolchain* under
+ Linux or Cygwin. STATUS: Complete and mature.
+
+config ARCH_BOARD_MIRTOO
+ bool "Mirtoo PIC32 Module from Dimitech"
+ depends on ARCH_CHIP_PIC32MX250F128D
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is the port to the DTX1-4000L "Mirtoo" module. This module uses MicroChip
+ PIC32MX250F128D. See http://www.dimitech.com/ for further information.
+
+config ARCH_BOARD_OLIMEXLPC2378
+ bool "Olimex-lpc2378 board"
+ depends on ARCH_CHIP_LPC2378
+ select ARCH_HAVE_LEDS
+ ---help---
+ This port uses the Olimex-lpc2378 board and a GNU arm-elf toolchain* under
+ Linux or Cygwin. STATUS: ostest and NSH configurations available.
+ This port for the NXP LPC2378 was contributed by Rommel Marcelo.
+
+config ARCH_BOARD_OLIMEX_STRP711
+ bool "Olimex STR-P711 board"
+ depends on ARCH_CHIP_STR71X
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ This port uses the Olimex STR-P711 board and a GNU arm-elf toolchain* under
+ Linux or Cygwin. See the http://www.olimex.com/dev/str-p711.html" for
+ further information. STATUS: Configurations for the basic OS test and NSH
+ are complete and verified.
+
+config ARCH_BOARD_OLIMEX_STM32P107
+ bool "Olimex STM32 P107 board"
+ depends on ARCH_CHIP_STM32F107VC
+ ---help---
+ This port uses the Olimex STM32 P107 board and a GNU arm-elf toolchain* under
+ Linux or Cygwin. See the http://www.olimex.com for further information. This
+ board features the STMicro STM32F107VC MCU
+
+config ARCH_BOARD_PCBLOGICPIC32MX
+ bool "PIC32MX board from PCB Logic Design Co"
+ depends on ARCH_CHIP_PIC32MX460F512L
+ ---help---
+ This is the port of NuttX to the PIC32MX board from PCB Logic Design Co.
+ This board features the MicroChip PIC32MX460F512L.
+ The board is a very simple -- little more than a carrier for the PIC32
+ MCU plus voltage regulation, debug interface, and an OTG connector.
+ STATUS: Code complete but testing has been stalled due to tool related problems
+ (PICkit 2 does not work with the PIC32).
+
+config ARCH_BOARD_PIC32_STARTERKIT
+ bool "Microchip PIC32 Ethernet Starter Kit (DM320004)"
+ depends on ARCH_CHIP_PIC32MX795F512L
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is the port of NuttX to the Microchip PIC32 Ethernet Starter Kit
+ (DM320004) with the Multimedia Expansion Board (MEB, DM320005).
+ See www.microchip.com for further information.
+
+config ARCH_BOARD_PIC32_PIC32MX7MMB
+ bool "Mikroelektronika PIC32MX7 MMB"
+ depends on ARCH_CHIP_PIC32MX795F512L
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is the port NuttX to the Mikroelektronika PIC32MX7 Multimedia Board
+ (MMB). See http://www.mikroe.com/ for further information.
+
+config ARCH_BOARD_PJRC_87C52
+ bool "PJRC 87C52 development system"
+ depends on ARCH_CHIP_8052
+ select ARCH_HAVE_LEDS
+ ---help---
+ 8051 Microcontroller. This port uses the PJRC 87C52 development system
+ and the SDCC toolchain. This port is not quite ready for prime time.
+
+config ARCH_BOARD_QEMU_I486
+ bool "Qemu i486 Mode"
+ depends on ARCH_X86 || ARCH_I486
+ ---help---
+ Port of NuttX to QEMU in i486 mode. This port will also run on real i486
+ hardwared (Google the Bifferboard).
+
+config ARCH_BOARD_RGMP
+ bool "RGMP"
+ depends on ARCH_RGMP
+ ---help---
+ RGMP stands for RTOS and GPOS on Multi-Processor. RGMP is a project for
+ running GPOS and RTOS simultaneously on multi-processor platforms. You can
+ port your favorite RTOS to RGMP together with an unmodified Linux to form a
+ hybrid operating system. This makes your application able to use both RTOS
+ and GPOS features.
+
+ See http://rgmp.sourceforge.net/wiki/index.php/Main_Page for further information
+ about RGMP.
+
+config ARCH_BOARD_SAM3UEK
+ bool "Atmel SAM3U-EK development board"
+ depends on ARCH_CHIP_AT91SAM3U4E
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ The port of NuttX to the Atmel SAM3U-EK development board.
+
+config ARCH_BOARD_SHENZHOU
+ bool "Shenzhou STM32F107 board"
+ depends on ARCH_CHIP_STM32F107VC
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ This port uses the Shenzhou STM32 F107 board and a GNU arm-elf toolchain* under
+ Linux or Cygwin. See the http://www.armjishu.com for further information. This
+ board features the STMicro STM32F107VC MCU
+
+config ARCH_BOARD_SKP16C26
+ bool "Renesas SKP16C26 StarterKit"
+ depends on ARCH_CHIP_M30262F8
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ Renesas M16C processor on the Renesas SKP16C26 StarterKit. This port
+ uses the GNU m32c toolchain. STATUS: The port is complete but untested
+ due to issues with compiler internal errors.
+
+config ARCH_BOARD_STM3210E_EVAL
+ bool "STMicro STM3210E-EVAL development board"
+ depends on ARCH_CHIP_STM32F103ZET6
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ STMicro STM3210E-EVAL development board based on the STMicro STM32F103ZET6
+ microcontroller (ARM Cortex-M3). This port uses the GNU Cortex-M3
+ toolchain.
+
+config ARCH_BOARD_STM3220G_EVAL
+ bool "STMicro STM3220G-EVAL development board"
+ depends on ARCH_CHIP_STM32F207IG
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ STMicro STM3220G-EVAL development board based on the STMicro STM32F407IG
+ microcontroller (ARM Cortex-M3).
+
+config ARCH_BOARD_STM3240G_EVAL
+ bool "STMicro STM3240G-EVAL development board"
+ depends on ARCH_CHIP_STM32F407IG
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ STMicro STM3240G-EVAL development board based on the STMicro STM32F103ZET6
+ microcontroller (ARM Cortex-M4 with FPU). This port uses a GNU Cortex-M4
+ toolchain (such as CodeSourcery).
+
+config ARCH_BOARD_STM32F4_DISCOVERY
+ bool "STMicro STM32F4-Discovery board"
+ depends on ARCH_CHIP_STM32F407VG
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ STMicro STM32F4-Discovery board boased on the STMIcro STM32F407VGT6 MCU.
+
+config ARCH_BOARD_SUREPIC32MX
+ bool "Sure PIC32MX boards"
+ depends on ARCH_CHIP_PIC32MX440F512H
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ The "Advanced USB Storage Demo Board," Model DB-DP11215, from Sure
+ Electronics (http://www.sureelectronics.net/). This board features
+ the MicroChip PIC32MX440F512H. See also
+ http://www.sureelectronics.net/goods.php?id=1168 for further
+ information about the Sure DB-DP11215 board.
+
+config ARCH_BOARD_TEENSY
+ bool "PJRC Teensy++ 2.0 board"
+ depends on ARCH_CHIP_AT90USB1286
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is the port of NuttX to the PJRC Teensy++ 2.0 board. This board is
+ developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
+ on an Atmel AT90USB1286 MCU.
+
+config ARCH_BOARD_TWR_K60N512
+ bool "FreeScale TWR-K60N512d evelopment board"
+ depends on ARCH_CHIP_MK60N512VMD100
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ Kinetis K60 Cortex-M4 MCU. This port uses the FreeScale TWR-K60N512
+ development board.
+
+config ARCH_BOARD_UBW32
+ bool "UBW32 v2.4 board from Sparkfun"
+ depends on ARCH_CHIP_PIC32MX460F512L
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ This is the port to the Sparkfun UBW32 board. This port uses the original v2.4
+ board which is based on the MicroChip PIC32MX460F512L. See
+ http://www.sparkfun.com/products/8971. This older version has been replaced
+ with this board http://www.sparkfun.com/products/9713. See also
+ http://www.schmalzhaus.com/UBW32/.
+
+config ARCH_BOARD_US7032EVB1
+ bool "Hitachi SH-1/US7032EVB1 board"
+ depends on ARCH_CHIP_SH7032
+ select ARCH_HAVE_LEDS
+ ---help---
+ This is a port of the Hitachi SH-1 on the Hitachi SH-1/US7032EVB1 board.
+ STATUS: Work has just began on this port.
+
+config ARCH_BOARD_VSN
+ bool "SOTEL NetClamps VSN sensor network platform"
+ depends on ARCH_CHIP_STM32F103RET6
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ ISOTEL NetClamps VSN V1.2 ready2go sensor network platform based on the
+ STMicro STM32F103RET6. Contributed by Uros Platise. See
+ http://isotel.eu/NetClamps/
+
+config ARCH_BOARD_XTRS
+ bool "XTRS TRS80 Model 3 emulation"
+ depends on ARCH_CHIP_Z80
+ ---help---
+ TRS80 Model 3. This port uses a vintage computer based on the Z80.
+ An emulator for this computer is available to run TRS80 programs on a
+ linux platform (http://www.tim-mann.org/xtrs.html).
+
+config ARCH_BOARD_Z16F2800100ZCOG
+ bool "Zilog Z16F2800100ZCOG Development Kit"
+ depends on ARCH_CHIP_Z16F281
+ select ARCH_HAVE_LEDS
+ ---help---
+ z16f Microcontroller. This port use the ZiLIG z16f2800100zcog
+ development kit and the Zilog ZDS-II Windows command line tools. The
+ development environment is Cygwin under WinXP.
+
+config ARCH_BOARD_Z80SIM
+ bool "Z80 Instruction Set Simulator"
+ depends on ARCH_CHIP_Z80
+ ---help---
+ z80 Microcontroller. This port uses a Z80 instruction set simulator.
+ That simulator can be found in the NuttX SVN at
+ http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/misc/sims/z80sim.
+ This port also uses the SDCC toolchain (http://sdcc.sourceforge.net/")
+ (verified with version 2.6.0).
+
+config ARCH_BOARD_Z8ENCORE000ZCO
+ bool "ZiLOG z8encore000zco Development Kit"
+ depends on ARCH_CHIP_Z8F6403
+ select ARCH_HAVE_LEDS
+ ---help---
+ z8Encore! Microcontroller. This port use the ZiLOG z8encore000zco
+ development kit, Z8F6403 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+config ARCH_BOARD_Z8F64200100KI
+ bool "ZiLOG Z8F64200100KIT Development Kit"
+ depends on ARCH_CHIP_Z8F642X
+ select ARCH_HAVE_LEDS
+ ---help---
+ z8Encore! Microcontroller. This port use the Zilog z8f64200100kit
+ development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+config ARCH_BOARD_SIM
+ bool "User mode simulation"
+ depends on ARCH_SIM
+ ---help---
+ A user-mode port of NuttX to the x86 Linux/Cygwin platform is available.
+ The purpose of this port is primarily to support OS feature development.
+ This port does not support interrupts or a real timer (and hence no
+ round robin scheduler) Otherwise, it is complete.
+
+config ARCH_BOARD_CUSTOM
+ bool "Custom development board"
+ ---help---
+ Select this option if there is no directory for the board under configs/.
+
+ Don't see the board you want? You must first select the exact MCU part
+ number, then the boards supporting that part will be available for selection.
+
+endchoice
+
+config ARCH_BOARD
+ string
+ default "amber" if ARCH_BOARD_AMBER
+ default "avr32dev1" if ARCH_BOARD_AVR32DEV1
+ default "c5471evm" if ARCH_BOARD_C5471EVM
+ default "compal_e88" if ARCH_BOARD_COMPALE88
+ default "compal_e99" if ARCH_BOARD_COMPALE99
+ default "demo9s12ne64" if ARCH_BOARD_DEMOS92S12NEC64
+ default "ea3131" if ARCH_BOARD_EA3131
+ default "ea3152" if ARCH_BOARD_EA3152
+ default "eagle100" if ARCH_BOARD_EAGLE100
+ default "ekk-lm3s9b96" if ARCH_BOARD_EKK_LM3S9B96
+ default "ez80f0910200kitg" if ARCH_BOARD_EZ80F910200KITG
+ default "ez80f0910200zco" if ARCH_BOARD_EZ80F910200ZCO
+ default "fire-stm32v2" if ARCH_BOARD_FIRE_STM32V2
+ default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V
+ default "kwikstik-k40" if ARCH_BOARD_KWIKSTIK_K40
+ default "lincoln60" if ARCH_BOARD_LINCOLN60
+ default "lm3s6432-s2e" if ARCH_BOARD_LM3S6432S2E
+ default "lm3s6965-ek" if ARCH_BOARD_LM3S6965EK
+ default "lm3s8962-ek" if ARCH_BOARD_LM3S8962EK
+ default "lpc4330-xplorer" if ARCH_BOARD_LPC4330_XPLORER
+ default "lpcxpresso-lpc1768" if ARCH_BOARD_LPCXPRESSO
+ default "m68322evb" if ARCH_BOARD_M68332EVB
+ default "mbed" if ARCH_BOARD_MBED
+ default "mcu123-lpc214x" if ARCH_BOARD_MCU123
+ default "micropendous3" if ARCH_BOARD_MICROPENDOUS3
+ default "mirtoo" if ARCH_BOARD_MIRTOO
+ default "mx1ads" if ARCH_BOARD_MX1ADS
+ default "ne64badge" if ARCH_BOARD_NE64BADGE
+ default "ntosd-dm320" if ARCH_BOARD_NTOSD_DM320
+ default "nucleus2g" if ARCH_BOARD_NUCLEUS2G
+ default "olimex-lpc1766stk" if ARCH_BOARD_LPC1766STK
+ default "olimex-lpc2378" if ARCH_BOARD_OLIMEXLPC2378
+ default "olimex-stm32-p107" if ARCH_BOARD_OLIMEX_STM32P107
+ default "olimex-strp711" if ARCH_BOARD_OLIMEX_STRP711
+ default "pcblogic-pic32mx" if ARCH_BOARD_PCBLOGICPIC32MX
+ default "pic32-starterkit" if ARCH_BOARD_PIC32_STARTERKIT
+ default "pic32mx7mmb" if ARCH_BOARD_PIC32_PIC32MX7MMB
+ default "pjrc-8051" if ARCH_BOARD_PJRC_87C52
+ default "qemu-i486" if ARCH_BOARD_QEMU_I486
+ default "rgmp" if ARCH_BOARD_RGMP
+ default "sam3u-ek" if ARCH_BOARD_SAM3UEK
+ default "shenzhou" if ARCH_BOARD_SHENZHOU
+ default "skp16c26" if ARCH_BOARD_SKP16C26
+ default "stm3210e-eval" if ARCH_BOARD_STM3210E_EVAL
+ default "stm3220g-eval" if ARCH_BOARD_STM3220G_EVAL
+ default "stm3240g-eval" if ARCH_BOARD_STM3240G_EVAL
+ default "stm32f4discovery" if ARCH_BOARD_STM32F4_DISCOVERY
+ default "sure-pic32mx" if ARCH_BOARD_SUREPIC32MX
+ default "teensy" if ARCH_BOARD_TEENSY
+ default "twr-k60n512" if ARCH_BOARD_TWR_K60N512
+ default "ubw32" if ARCH_BOARD_UBW32
+ default "us7032evb1" if ARCH_BOARD_US7032EVB1
+ default "vsn" if ARCH_BOARD_VSN
+ default "xtrs" if ARCH_BOARD_XTRS
+ default "z16f2800100zcog" if ARCH_BOARD_Z16F2800100ZCOG
+ default "z80sim" if ARCH_BOARD_Z80SIM
+ default "z8encore000zco" if ARCH_BOARD_Z8ENCORE000ZCO
+ default "z8f64200100kit" if ARCH_BOARD_Z8F64200100KI
+ default "sim" if ARCH_BOARD_SIM
+ default "" if ARCH_BOARD_CUSTOM
+
+comment "Common Board Options"
+
+config ARCH_HAVE_LEDS
+ bool
+
+config ARCH_LEDS
+ bool "Board LEDs support"
+ default y
+ depends on ARCH_HAVE_LEDS
+ ---help---
+ Use board LEDs to show NuttX execution status state. Unique to boards that have LEDs
+
+config ARCH_HAVE_BUTTONS
+ bool
+
+config ARCH_BUTTONS
+ bool "Board button support"
+ default n
+ depends on ARCH_HAVE_BUTTONS
+ ---help---
+ "Support interfaces to use buttons provided by the board."
+
+config ARCH_HAVE_IRQBUTTONS
+ bool
+
+config ARCH_IRQBUTTONS
+ bool "Button interrupt support"
+ default n
+ depends on ARCH_BUTTONS && ARCH_HAVE_IRQBUTTONS
+ ---help---
+ "Support interrupts on button presses and releases."
+
+config NSH_MMCSDMINOR
+ int "MMC/SD minor number"
+ default 0
+ depends on NSH_LIBRARY && MMCSD
+ ---help---
+ If board-specific NSH start-up logic needs to mount an MMC/SD device, then the setting should be provided to identify the MMC/SD minor device number (i.e., the N in /dev/mmcsdN). Default 0
+
+config NSH_MMCSDSLOTNO
+ int "MMC/SD slot number"
+ default 0
+ depends on NSH_LIBRARY && MMCSD
+ ---help---
+ If board-specific NSH start-up supports more than one MMC/SD slot, then this setting should be provided to indicate which slot should be used. Default: 0.
+
+config NSH_MMCSDSPIPORTNO
+ int "MMC/SD SPI device number"
+ default 0
+ depends on NSH_LIBRARY && MMCSD && SPI
+ ---help---
+ If board-specif NSH start-up logic will mount an SPI-based MMC/SD volume, then this setting may be needed to tell the board logic which SPI bus to use. Default: 0 (meaning is board-specific).
+
+comment "Board-Specific Options"
+
+if ARCH_BOARD_AMBER
+source "configs/amber/Kconfig"
+endif
+if ARCH_BOARD_AVR32DEV1
+source "configs/avr32dev1/Kconfig"
+endif
+if ARCH_BOARD_C5471EVM
+source "configs/c5471evm/Kconfig"
+endif
+if ARCH_BOARD_COMPALE88
+source "configs/compal_e88/Kconfig"
+endif
+if ARCH_BOARD_COMPALE99
+source "configs/compal_e99/Kconfig"
+endif
+if ARCH_BOARD_DEMOS92S12NEC64
+source "configs/demo9s12ne64/Kconfig"
+endif
+if ARCH_BOARD_EA3131
+source "configs/ea3131/Kconfig"
+endif
+if ARCH_BOARD_EA3152
+source "configs/ea3152/Kconfig"
+endif
+if ARCH_BOARD_EAGLE100
+source "configs/eagle100/Kconfig"
+endif
+if ARCH_BOARD_EKK_LM3S9B96
+source "configs/ekk-lm3s9b96/Kconfig"
+endif
+if ARCH_BOARD_EZ80F910200KITG
+source "configs/ez80f910200kitg/Kconfig"
+endif
+if ARCH_BOARD_EZ80F910200ZCO
+source "configs/ez80f910200zco/Kconfig"
+endif
+if ARCH_BOARD_FIRE_STM32V2
+source "configs/fire-stm32v2/Kconfig"
+endif
+if ARCH_BOARD_HYMINI_STM32V
+source "configs/hymini-stm32v/Kconfig"
+endif
+if ARCH_BOARD_KWIKSTIK_K40
+source "configs/kwikstik-k40/Kconfig"
+endif
+if ARCH_BOARD_LINCOLN60
+source "configs/lincoln60/Kconfig"
+endif
+if ARCH_BOARD_LM3S6432S2E
+source "configs/lm3s6432-s2e/Kconfig"
+endif
+if ARCH_BOARD_LM3S6965EK
+source "configs/lm3s6965-ek/Kconfig"
+endif
+if ARCH_BOARD_LM3S8962EK
+source "configs/lm3s8962-ek/Kconfig"
+endif
+if ARCH_BOARD_LPC4330_XPLORER
+source "configs/lpc4330-xplorer/Kconfig"
+endif
+if ARCH_BOARD_LPCXPRESSO
+source "configs/lpcxpresso-lpc1768/Kconfig"
+endif
+if ARCH_BOARD_M68332EVB
+source "configs/m68332evb/Kconfig"
+endif
+if ARCH_BOARD_MBED
+source "configs/mbed/Kconfig"
+endif
+if ARCH_BOARD_MCU123
+source "configs/mcu123-lpc214x/Kconfig"
+endif
+if ARCH_BOARD_MICROPENDOUS3
+source "configs/micropendous3/Kconfig"
+endif
+if ARCH_BOARD_MIRTOO
+source "configs/mirtoo/Kconfig"
+endif
+if ARCH_BOARD_MX1ADS
+source "configs/mx1ads/Kconfig"
+endif
+if ARCH_BOARD_NE64BADGE
+source "configs/ne64badge/Kconfig"
+endif
+if ARCH_BOARD_NTOSD_DM320
+source "configs/ntosd-dm320/Kconfig"
+endif
+if ARCH_BOARD_NUCLEUS2G
+source "configs/nucleus2g/Kconfig"
+endif
+if ARCH_BOARD_LPC1766STK
+source "configs/olimex-lpc1766stk/Kconfig"
+endif
+if ARCH_BOARD_OLIMEXLPC2378
+source "configs/olimex-lpc2378/Kconfig"
+endif
+if ARCH_BOARD_OLIMEX_STM32P107
+source "configs/olimex-stm32-p107/Kconfig"
+endif
+if ARCH_BOARD_OLIMEX_STRP711
+source "configs/olimex-strp711/Kconfig"
+endif
+if ARCH_BOARD_PCBLOGICPIC32MX
+source "configs/pcblogic-pic32mx/Kconfig"
+endif
+if ARCH_BOARD_PIC32_STARTERKIT
+source "configs/pic32-starterkit/Kconfig"
+endif
+if ARCH_BOARD_PIC32_PIC32MX7MMB
+source "configs/pic32mx7mmb/Kconfig"
+endif
+if ARCH_BOARD_PJRC_87C52
+source "configs/pjrc-8051/Kconfig"
+endif
+if ARCH_BOARD_QEMU_I486
+source "configs/qemu-i486/Kconfig"
+endif
+if ARCH_BOARD_RGMP
+source "configs/rgmp/Kconfig"
+endif
+if ARCH_BOARD_SAM3UEK
+source "configs/sam3u-ek/Kconfig"
+endif
+if ARCH_BOARD_SHENZHOU
+source "configs/shenzhou/Kconfig"
+endif
+if ARCH_BOARD_SKP16C26
+source "configs/skp16c26/Kconfig"
+endif
+if ARCH_BOARD_STM3210E_EVAL
+source "configs/stm3210e-eval/Kconfig"
+endif
+if ARCH_BOARD_STM3220G_EVAL
+source "configs/stm3220g-eval/Kconfig"
+endif
+if ARCH_BOARD_STM3240G_EVAL
+source "configs/stm3240g-eval/Kconfig"
+endif
+if ARCH_BOARD_STM32F4_DISCOVERY
+source "configs/stm32f4discovery/Kconfig"
+endif
+if ARCH_BOARD_SUREPIC32MX
+source "configs/sure-pic32mx/Kconfig"
+endif
+if ARCH_BOARD_TEENSY
+source "configs/teensy/Kconfig"
+endif
+if ARCH_BOARD_TWR_K60N512
+source "configs/twr-k60n512/Kconfig"
+endif
+if ARCH_BOARD_UBW32
+source "configs/ubw32/Kconfig"
+endif
+if ARCH_BOARD_US7032EVB1
+source "configs/us7032evb1/Kconfig"
+endif
+if ARCH_BOARD_VSN
+source "configs/vsn/Kconfig"
+endif
+if ARCH_BOARD_XTRS
+source "configs/xtrs/Kconfig"
+endif
+if ARCH_BOARD_Z16F2800100ZCOG
+source "configs/z16f2800100zcog/Kconfig"
+endif
+if ARCH_BOARD_Z80SIM
+source "configs/z80sim/Kconfig"
+endif
+if ARCH_BOARD_Z8ENCORE000ZCO
+source "configs/z8encore000zco/Kconfig"
+endif
+if ARCH_BOARD_Z8F64200100KI
+source "configs/z8f64200100kit/Kconfig"
+endif
+if ARCH_BOARD_SIM
+source "configs/sim/Kconfig"
+endif
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
new file mode 100644
index 000000000..1c14e8388
--- /dev/null
+++ b/nuttx/configs/README.txt
@@ -0,0 +1,1873 @@
+Board-Specific Configurations
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Table of Contents
+^^^^^^^^^^^^^^^^^
+
+ o Board-Specific Configurations
+ o Summary of Files
+ o Supported Architectures
+ o Configuring NuttX
+ o Building Symbol Tables
+
+Board-Specific Configurations
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The NuttX configuration consists of:
+
+o Processor architecture specific files. These are the files contained
+ in the arch/<arch-name>/ directory.
+
+o Chip/SoC specific files. Each processor processor architecture
+ is embedded in chip or System-on-a-Chip (SoC) architecture. The
+ full chip architecture includes the processor architecture plus
+ chip-specific interrupt logic, general purpose I/O (GIO) logic, and
+ specialized, internal peripherals (such as UARTs, USB, etc.).
+
+ These chip-specific files are contained within chip-specific
+ sub-directories in the arch/<arch-name>/ directory and are selected
+ via the CONFIG_ARCH_name selection
+
+o Board specific files. In order to be usable, the chip must be
+ contained in a board environment. The board configuration defines
+ additional properties of the board including such things as
+ peripheral LEDs, external peripherals (such as network, USB, etc.).
+
+ These board-specific configuration files can be found in the
+ configs/<board-name>/ sub-directories and are discussed in this
+ README. Additional configuration information maybe available in
+ board-specific configs/<board-name>/README.txt files.
+
+The configs/ subdirectory contains configuration data for each board. These
+board-specific configurations plus the architecture-specific configurations in
+the arch/ subdirectory completely define a customized port of NuttX.
+
+Directory Structure
+^^^^^^^^^^^^^^^^^^^
+
+The configs directory contains board specific configurationlogic. Each
+board must provide a subdirectory <board-name> under configs/ with the
+following characteristics:
+
+
+ <board-name>
+ |-- README.txt
+ |-- include/
+ | `-- (board-specific header files)
+ |-- src/
+ | |-- Makefile
+ | `-- (board-specific source files)
+ |-- <config1-dir>
+ | |-- Make.defs
+ | |-- defconfig
+ | |-- appconfig*
+ | `-- setenv.sh
+ |-- <config2-dir>
+ | |-- Make.defs
+ | |-- defconfig
+ | |-- appconfig*
+ | `-- setenv.sh
+ ...
+
+ *optional
+
+Summary of Files
+^^^^^^^^^^^^^^^^
+
+README.txt -- This text file provides additional information unique to
+ each board configuration sub-directory.
+
+include/ -- This directory contains board specific header files. This
+ directory will be linked as include/arch/board at configuration time and
+ can be included via '#include <arch/board/header.h>'. These header file
+ can only be included by files in arch/<arch-name>include/ and
+ arch/<arch-name>/src
+
+src/ -- This directory contains board specific drivers. This
+ directory will be linked as arch/<arch-name>/src/board at configuration
+ time and will be integrated into the build system.
+
+src/Makefile -- This makefile will be invoked to build the board specific
+ drivers. It must support the following targets: libext$(LIBEXT), clean,
+ and distclean.
+
+A board may have various different configurations using these common source
+files. Each board configuration is described by three files: Make.defs,
+defconfig, and setenv.sh. Typically, each set of configuration files is
+retained in a separate configuration sub-directory (<config1-dir>,
+<config2-dir>, .. in the above diagram).
+
+Make.defs -- This makefile fragment provides architecture and
+ tool-specific build options. It will be included by all other
+ makefiles in the build (once it is installed). This make fragment
+ should define:
+
+ Tools: CC, LD, AR, NM, OBJCOPY, OBJDUMP
+ Tool options: CFLAGS, LDFLAGS
+ COMPILE, ASSEMBLE, ARCHIVE, CLEAN, and MKDEP macros
+
+ When this makefile fragment runs, it will be passed TOPDIR which
+ is the path to the root directory of the build. This makefile
+ fragment may include ${TOPDIR}/.config to perform configuration
+ specific settings. For example, the CFLAGS will most likely be
+ different if CONFIG_DEBUG=y.
+
+defconfig -- This is a configuration file similar to the Linux
+ configuration file. In contains variable/value pairs like:
+
+ CONFIG_VARIABLE=value
+
+ This configuration file will be used at build time:
+
+ (1) as a makefile fragment included in other makefiles, and
+ (2) to generate include/nuttx/config.h which is included by
+ most C files in the system.
+
+ The following variables are recognized by the build (you may
+ also include architecture/board-specific settings).
+
+ Architecture selection:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory
+ CONFIG_ARCH_name - For use in C code
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+ CONFIG_ARCH_CHIP_name - For use in C code
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+ CONFIG_ARCH_BOARD_name - For use in C code
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+ CONFIG_ARCH_NOINTC - define if the architecture does not
+ support an interrupt controller or otherwise cannot support
+ APIs like up_enable_irq() and up_disable_irq().
+ CONFIG_ARCH_VECNOTIRQ - Usually the interrupt vector number provided
+ to interfaces like irq_attach() and irq_detach are the same as IRQ
+ numbers that are provied to IRQ management functions like
+ up_enable_irq() and up_disable_irq(). But that is not true for all
+ interrupt controller implementations. For example, the PIC32MX
+ interrupt controller manages interrupt sources that have a many-to-one
+ relationship to interrupt vectors. In such cases, CONFIG_ARCH_VECNOTIRQ
+ must defined so that the OS logic will know not to assume it can use
+ a vector number to enable or disable interrupts.
+ CONFIG_ARCH_IRQPRIO
+ Define if the architecture suports prioritizaton of interrupts
+ and the up_prioritize_irq() API.
+
+ Some architectures require a description of the RAM configuration:
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM.
+ CONFIG_DRAM_START - The start address of DRAM (physical)
+ CONFIG_DRAM_VSTART - The start address of DRAM (virtual)
+
+ General build options:
+
+ CONFIG_RRLOAD_BINARY - make the rrload binary format used with
+ BSPs from www.ridgerun.com using the tools/mkimage.sh script.
+ CONFIG_INTELHEX_BINARY - make the Intel HEX binary format
+ used with many different loaders using the GNU objcopy program
+ Should not be selected if you are not using the GNU toolchain.
+ CONFIG_MOTOROLA_SREC - make the Motorola S-Record binary format
+ used with many different loaders using the GNU objcopy program
+ Should not be selected if you are not using the GNU toolchain.
+ CONFIG_RAW_BINARY - make a raw binary format file used with many
+ different loaders using the GNU objcopy program. This option
+ should not be selected if you are not using the GNU toolchain.
+ CONFIG_HAVE_LIBM - toolchain supports libm.a
+ CONFIG_HAVE_CXX - toolchain supports C++ and CXX, CXXFLAGS, and
+ COMPILEXX have been defined in the configurations Make.defs
+ file.
+ CONFIG_HAVE_CXXINITIALIZE - The platform-specific logic includes support
+ for initialization of static C++ instances for this architecture
+ and for the selected toolchain (via up_cxxinitialize()).
+
+ Building application code:
+
+ CONFIG_APPS_DIR - Identifies the directory that builds the
+ application to link with NuttX. Default: ../apps This symbol must be assigned
+ to the path to the application build directory *relative* to
+ the NuttX top build direcory. If you had an application
+ directory and the NuttX directory each in separate directory
+ trees like this:
+
+ build
+ |-nuttx
+ | |
+ | `- Makefile
+ `-application
+ |
+ `- Makefile
+
+ Then you would set CONFIG_APPS_DIR=../application.
+
+ The application direction must contain Makefile and this make
+ file must support the following targets:
+
+ - libapps$(LIBEXT) (usually libapps.a). libapps.a is a static
+ library ( an archive) that contains all of application object
+ files.
+ - clean. Do whatever is appropriate to clean the application
+ directories for a fresh build.
+ - distclean. Clean everthing -- auto-generated files, symbolic
+ links etc. -- so that the directory contents are the same as
+ the contents in your configuration management system.
+ This is only done when you change the NuttX configuration.
+ - depend. Make or update the application build dependencies.
+
+ When this application is invoked it will receive the setting TOPDIR like:
+
+ $(MAKE) -C $(CONFIG_APPS_DIR) TOPDIR="$(TOPDIR)" <target>
+
+ TOPDIR is the full path to the NuttX directory. It can be used, for
+ example, to include makefile fragments (e.g., .config or Make.defs)
+ or to set up include file paths.
+
+ Two-pass build options. If the 2 pass build option is selected, then these
+ options configure the make system build a extra link object. This link object
+ is assumed to be an incremental (relative) link object, but could be a static
+ library (archive) (some modification to this Makefile would be required if
+ CONFIG_PASS1_TARGET generates an archive). Pass 1 1ncremental (relative) link
+ objects should be put into the processor-specific source directory (where other
+ link objects will be created). If the pass1 obect is an archive, it could
+ go anywhere.
+
+ CONFIG_BUILD_2PASS - Enables the two pass build options.
+
+ When the two pass build option is enabled, the following also apply:
+
+ CONFIG_PASS1_TARGET - The name of the first pass build target. This
+ can be specific build target, a special build target (all, default, etc.)
+ or may just be left undefined.
+ CONFIG_PASS1_BUILDIR - The path, relative to the top NuttX build
+ directory to directory that contains the Makefile to build the
+ first pass object. The Makefile must support the following targets:
+ - The special target CONFIG_PASS1_TARGET (if defined)
+ - and the usual depend, clean, and distclean targets.
+ CONFIG_PASS1_OBJECT - May be used to include an extra, pass1 object
+ into the final link. This would probably be the object generated
+ from the CONFIG_PASS1_TARGET. It may be available at link time
+ in the arch/<architecture>/src directory.
+
+ General OS setup
+
+ CONFIG_DEBUG - enables built-in debug options
+ CONFIG_DEBUG_VERBOSE - enables verbose debug output
+ CCONFIG_DEBUG_ENABLE - Support an interface to enable or disable debug output.
+ CONFIG_DEBUG_SYMBOLS - build without optimization and with
+ debug symbols (needed for use with a debugger).
+ CONFIG_DEBUG_SCHED - enable OS debug output (disabled by
+ default)
+ CONFIG_DEBUG_MM - enable memory management debug output
+ (disabled by default)
+ CONFIG_DEBUG_NET - enable network debug output (disabled
+ by default)
+ CONFIG_DEBUG_USB - enable usb debug output (disabled by
+ default)
+ CONFIG_DEBUG_FS - enable filesystem debug output (disabled
+ by default)
+ CONFIG_DEBUG_LIB - enable C library debug output (disabled
+ by default)
+ CONFIG_DEBUG_BINFMT - enable binary loader debug output (disabled
+ by default)
+ CONFIG_DEBUG_GRAPHICS - enable NX graphics debug output
+ (disabled by default)
+
+ CONFIG_MM_REGIONS - If the architecture includes multiple
+ regions of memory to allocate from, this specifies the
+ number of memory regions that the memory manager must
+ handle and enables the API mm_addregion(start, end);
+ CONFIG_MM_SMALL - Each memory allocation has a small allocation
+ overhead. The size of that overhead is normally determined by
+ the "width" of the address support by the MCU. MCUs that support
+ 16-bit addressability have smaller overhead than devices that
+ support 32-bit addressability. However, there are many MCUs
+ that support 32-bit addressability *but* have internal SRAM
+ of size less than or equal to 64Kb. In this case, CONFIG_MM_SMALL
+ can be defined so that those MCUs will also benefit from the
+ smaller, 16-bit-based allocation overhead.
+ CONFIG_HEAP2_BASE and CONFIG_HEAP2_SIZE
+ Some architectures use these settings to specify the size of
+ a second heap region.
+ CONFIG_GRAN
+ Enable granual allocator support. Allocations will be aligned to the
+ granule size; allocations will be in units of the granule size.
+ Larger granules will give better performance and less overhead but
+ more losses of memory due to alignment and quantization waste.
+ NOTE: The current implementation also restricts the maximum
+ allocation size to 32 granaules. That restriction could be
+ eliminated with some additional coding effort.
+ CONFIG_GRAN_SINGLE
+ Select if there is only one instance of the granule allocator (i.e.,
+ gran_initialize will be called only once. In this case, (1) there
+ are a few optimizations that can can be done and (2) the GRAN_HANDLE
+ is not needed.
+ CONFIG_GRAN_INTR - Normally mutual exclusive access to granule allocator
+ data is assured using a semaphore. If this option is set then, instead,
+ mutual exclusion logic will disable interrupts. While this options is
+ more invasive to system performance, it will also support use of the
+ granule allocator from interrupt level logic.
+ CONFIG_DEBUG_GRAM
+ Just like CONFIG_DEBUG_MM, but only generates ouput from the gran
+ allocation logic.
+
+ CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
+ time console output
+ CONFIG_MSEC_PER_TICK - The default system timer is 100Hz
+ or MSEC_PER_TICK=10. This setting may be defined to
+ inform NuttX that the processor hardware is providing
+ system timer interrupts at some interrupt interval other
+ than 10 msec.
+ CONFIG_RR_INTERVAL - The round robin timeslice will be set
+ this number of milliseconds; Round robin scheduling can
+ be disabled by setting this value to zero.
+ CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
+ scheduler to monitor system performance
+ CONFIG_TASK_NAME_SIZE - Specifies that maximum size of a
+ task name to save in the TCB. Useful if scheduler
+ instrumentation is selected. Set to zero to disable.
+ CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
+ Used to initialize the internal time logic.
+ CONFIG_GREGORIAN_TIME - Enables Gregorian time conversions.
+ You would only need this if you are concerned about accurate
+ time conversions in the past or in the distant future.
+ CONFIG_JULIAN_TIME - Enables Julian time conversions. You
+ would only need this if you are concerned about accurate
+ time conversion in the distand past. You must also define
+ CONFIG_GREGORIAN_TIME in order to use Julian time.
+ CONFIG_DEV_CONSOLE - Set if architecture-specific logic
+ provides /dev/console. Enables stdout, stderr, stdin.
+ This implies the "normal" serial driver provides the
+ console unless another console device is specified
+ (See CONFIG_DEV_LOWCONSOLE).
+ CONFIG_MUTEX_TYPES - Set to enable support for recursive and
+ errorcheck mutexes. Enables pthread_mutexattr_settype().
+ CONFIG_PRIORITY_INHERITANCE - Set to enable support for
+ priority inheritance on mutexes and semaphores.
+ Priority inheritance is a strategy for addressing priority
+ inversion.
+ CONFIG_SEM_PREALLOCHOLDERS: This setting is only used if priority
+ inheritance is enabled. It defines the maximum number of
+ different threads (minus one) that can take counts on a
+ semaphore with priority inheritance support. This may be
+ set to zero if priority inheritance is disabled OR if you
+ are only using semaphores as mutexes (only one holder) OR
+ if no more than two threads participate using a counting
+ semaphore. If defined, then this should be a relatively
+ large number because this is the total number of counts on
+ the total number of semaphores (like 64 or 100).
+ CONFIG_SEM_NNESTPRIO. If priority inheritance is enabled,
+ then this setting is the maximum number of higher priority
+ threads (minus 1) than can be waiting for another thread
+ to release a count on a semaphore. This value may be set
+ to zero if no more than one thread is expected to wait for
+ a semaphore. If defined, then this should be a relatively
+ small number because this the number of maximumum of waiters
+ on one semaphore (like 4 or 8).
+ CONFIG_FDCLONE_DISABLE. Disable cloning of all file descriptors
+ by task_create() when a new task is started. If set, all
+ files/drivers will appear to be closed in the new task.
+ CONFIG_FDCLONE_STDIO. Disable cloning of all but the first
+ three file descriptors (stdin, stdout, stderr) by task_create()
+ when a new task is started. If set, all files/drivers will
+ appear to be closed in the new task except for stdin, stdout,
+ and stderr.
+ CONFIG_SDCLONE_DISABLE. Disable cloning of all socket
+ desciptors by task_create() when a new task is started. If
+ set, all sockets will appear to be closed in the new task.
+ CONFIG_NXFLAT. Enable support for the NXFLAT binary format.
+ This format will support execution of NuttX binaries located
+ in a ROMFS filesystem (see examples/nxflat).
+ CONFIG_SCHED_WORKQUEUE. Create a dedicated "worker" thread to
+ handle delayed processing from interrupt handlers. This feature
+ is required for some drivers but, if there are not complaints,
+ can be safely disabled. The worker thread also performs
+ garbage collection -- completing any delayed memory deallocations
+ from interrupt handlers. If the worker thread is disabled,
+ then that clean will be performed by the IDLE thread instead
+ (which runs at the lowest of priority and may not be appropriate
+ if memory reclamation is of high priority). If CONFIG_SCHED_WORKQUEUE
+ is enabled, then the following options can also be used:
+ CONFIG_SCHED_WORKPRIORITY - The execution priority of the worker
+ thread. Default: 192
+ CONFIG_SCHED_WORKPERIOD - How often the worker thread checks for
+ work in units of microseconds. Default: 50*1000 (50 MS).
+ CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker
+ thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
+ CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up
+ the worker thread. Default: 4
+ CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single
+ work queue is created by default. If CONFIG_SCHED_LPWORK is also defined
+ then an additional, lower-priority work queue will also be created. This
+ lower priority work queue is better suited for more extended processing
+ (such as file system clean-up operations)
+ CONFIG_SCHED_LPWORKPRIORITY - The execution priority of the lower priority
+ worker thread. Default: 50
+ CONFIG_SCHED_LPWORKPERIOD - How often the lower priority worker thread
+ checks for work in units of microseconds. Default: 50*1000 (50 MS).
+ CONFIG_SCHED_LPWORKSTACKSIZE - The stack size allocated for the lower
+ priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
+ CONFIG_SCHED_WAITPID - Enables the waitpid() API
+ CONFIG_SCHED_ATEXIT - Enables the atexit() API
+ CONFIG_SCHED_ATEXIT_MAX - By default if CONFIG_SCHED_ATEXIT is
+ selected, only a single atexit() function is supported. That number
+ can be increased by defined this setting to the number that you require.
+ CONFIG_SCHED_ONEXIT - Enables the on_exit() API
+ CONFIG_SCHED_ONEXIT_MAX - By default if CONFIG_SCHED_ONEXIT is selected,
+ only a single on_exit() function is supported. That number can be
+ increased by defined this setting to the number that you require.
+ CONFIG_USER_ENTRYPOINT - The name of the entry point for user
+ applications. For the example applications this is of the form 'app_main'
+ where 'app' is the application name. If not defined, CONFIG_USER_ENTRYPOINT
+ defaults to user_start.
+
+ System Logging:
+ CONFIG_SYSLOG enables general system logging support.
+ CONFIG_SYSLOG_DEVPATH - The full path to the system logging device. Default
+ "/dev/ramlog" (RAMLOG) or "dev/ttyS1" (character device)
+
+ At present, there are two system loggins devices available. If CONFIG_SYSLOG
+ is selected, then these options are also available.
+
+ CONFIG_SYSLOG_CHAR - Enable the generic character device for the SYSLOG.
+ A disadvantage of using the generic character device for the SYSLOG is that
+ it cannot handle debug output generated from interrupt level handlers.
+ NOTE: No more than one SYSLOG device should be configured.
+
+ CONFIG_RAMLOG - Enables the RAM logging feature. The RAM log is a circular
+ buffer in RAM. NOTE: No more than one SYSLOG device should be configured.
+ CONFIG_RAMLOG_CONSOLE - Use the RAM logging device as a system console.
+ If this feature is enabled (along with CONFIG_DEV_CONSOLE), then all
+ console output will be re-directed to a circular buffer in RAM. This
+ is useful, for example, if the only console is a Telnet console. Then
+ in that case, console output from non-Telnet threads will go to the
+ circular buffer and can be viewed using the NSH 'dmesg' command.
+ CONFIG_RAMLOG_SYSLOG - Use the RAM logging device for the syslogging
+ interface. If this feature is enabled (along with CONFIG_SYSLOG),
+ then all debug output (only) will be re-directed to the circular
+ buffer in RAM. This RAM log can be view from NSH using the 'dmesg'
+ command. NOTE: Unlike the limited, generic character driver SYSLOG
+ device, the RAMLOG *can* be used to generate debug output from interrupt
+ level handlers.
+ CONFIG_RAMLOG_NPOLLWAITERS - The number of threads than can be waiting
+ for this driver on poll(). Default: 4
+
+ If CONFIG_RAMLOG_CONSOLE or CONFIG_RAMLOG_SYSLOG is selected, then the
+ following may also be provided:
+
+ CONFIG_RAMLOG_CONSOLE_BUFSIZE - Size of the console RAM log. Default: 1024
+
+ Kernel build options:
+ CONFIG_NUTTX_KERNEL - Builds NuttX as a separately compiled kernel.
+ CONFIG_SYS_RESERVED - Reserved system call values for use
+ by architecture-specific logic.
+
+ OS setup related to on-demand paging:
+
+ CONFIG_PAGING - If set =y in your configation file, this setting will
+ enable the on-demand paging feature as described in
+ http://www.nuttx.org/NuttXDemandPaging.html.
+
+ If CONFIG_PAGING is selected, then you will probabaly need CONFIG_BUILD_2PASS to
+ correctly position the code and the following configuration options also apply:
+
+ CONFIG_PAGING_PAGESIZE - The size of one managed page. This must
+ be a value supported by the processor's memory management unit.
+ CONFIG_PAGING_NLOCKED - This is the number of locked pages in the
+ memory map. The locked address region will then be from
+ CONFIG_DRAM_VSTART through (CONFIG_DRAM_VSTART +
+ CONFIG_PAGING_PAGESIZE*CONFIG_PAGING_NLOCKED)
+ CONFIG_PAGING_LOCKED_PBASE and CONFIG_PAGING_LOCKED_VBASE - These
+ may be defined to determine the base address of the locked page
+ regions. If neither are defined, the logic will be set the bases
+ to CONFIG_DRAM_START and CONFIG_DRAM_VSTART (i.e., it assumes
+ that the base address of the locked region is at the beginning
+ of RAM).
+ NOTE: In some architectures, it may be necessary to take some
+ memory from the beginning of this region for vectors or for a
+ page table. In such cases, CONFIG_PAGING_LOCKED_P/VBASE should
+ take that into consideration to prevent overlapping the locked
+ memory region and the system data at the beginning of SRAM.
+ CONFIG_PAGING_NPPAGED - This is the number of physical pages
+ available to support the paged text region. This paged region
+ begins at (CONFIG_PAGING_LOCKED_PBASE + CONFIG_PAGING_PAGESIZE*CONFIG_PAGING_NPPAGED)
+ and continues until (CONFIG_PAGING_LOCKED_PBASE + CONFIG_PAGING_PAGESIZE*(CONFIG_PAGING_NLOCKED +
+ CONFIG_PAGING_NPPAGED)
+ CONFIG_PAGING_NVPAGED - This actual size of the paged text region
+ (in pages). This is also the number of virtual pages required to
+ support the entire paged region. The on-demand paging feature is
+ intended to support only the case where the virtual paged text
+ area is much larger the available physical pages. Otherwise, why
+ would you enable on-demand paging?
+ CONFIG_PAGING_NDATA - This is the number of data pages in the memory
+ map. The data region will extend to the end of RAM unless overridden
+ by a setting in the configuration file.
+ NOTE: In some architectures, it may be necessary to take some memory
+ from the end of RAM for page tables or other system usage. The
+ configuration settings and linker directives must be cognizant of that:
+ CONFIG_PAGING_NDATA should be defined to prevent the data region from
+ extending all the way to the end of memory.
+ CONFIG_PAGING_DEFPRIO - The default, minimum priority of the page fill
+ worker thread. The priority of the page fill work thread will be boosted
+ boosted dynmically so that it matches the priority of the task on behalf
+ of which it peforms the fill. This defines the minimum priority that
+ will be used. Default: 50.
+ CONFIG_PAGING_STACKSIZE - Defines the size of the allocated stack
+ for the page fill worker thread. Default: 1024.
+ CONFIG_PAGING_BLOCKINGFILL - The architecture specific up_fillpage()
+ function may be blocking or non-blocking. If defined, this setting
+ indicates that the up_fillpage() implementation will block until the
+ transfer is completed. Default: Undefined (non-blocking).
+ CONFIG_PAGING_WORKPERIOD - The page fill worker thread will wake periodically
+ even if there is no mapping to do. This selection controls that wake-up
+ period (in microseconds). This wake-up a failsafe that will handle any
+ cases where a single is lost (that would really be a bug and shouldn't
+ happen!) and also supports timeouts for case of non-blocking, asynchronous
+ fills (see CONFIG_PAGING_TIMEOUT_TICKS).
+ CONFIG_PAGING_TIMEOUT_TICKS - If defined, the implementation will monitor
+ the (asynchronous) page fill logic. If the fill takes longer than this
+ number if microseconds, then a fatal error will be declared.
+ Default: No timeouts monitored.
+
+ Some architecture-specific settings. Defaults are architecture specific.
+ If you don't know what you are doing, it is best to leave these undefined
+ and try the system defaults:
+
+ CONFIG_PAGING_VECPPAGE - This the physical address of the page in
+ memory to be mapped to the vector address.
+ CONFIG_PAGING_VECL2PADDR - This is the physical address of the L2
+ page table entry to use for the vector mapping.
+ CONFIG_PAGING_VECL2VADDR - This is the virtual address of the L2
+ page table entry to use for the vector mapping.
+ CONFIG_PAGING_BINPATH - If CONFIG_PAGING_BINPATH is defined, then it
+ is the full path to a file on a mounted file system that contains
+ a binary image of the NuttX executable. Pages will be filled by
+ reading from offsets into this file that correspond to virtual
+ fault addresses.
+ CONFIG_PAGING_MOUNTPT - If CONFIG_PAGING_BINPATH is defined, additional
+ options may be provided to control the initialization of underlying
+ devices. CONFIG_PAGING_MOUNTPT identifies the mountpoint to be used
+ if a device is mounted.
+ CONFIG_PAGING_MINOR - Some mount operations require a "minor" number
+ to identify the specific device instance. Default: 0
+ CONFIG_PAGING_SDSLOT - If CONFIG_PAGING_BINPATH is defined, additional
+ options may be provided to control the initialization of underlying
+ devices. CONFIG_PAGING_SDSLOT identifies the slot number of the SD
+ device to initialize. This must be undefined if SD is not being used.
+ This should be defined to be zero for the typical device that has
+ only a single slot (See CONFIG_MMCSD_NSLOTS). If defined,
+ CONFIG_PAGING_SDSLOT will instruct certain board-specific logic to
+ initialize the media in this SD slot.
+ CONFIG_PAGING_M25PX - Use the m25px.c FLASH driver. If this is selected,
+ then the MTD interface to the M25Px device will be used to support
+ paging.
+ CONFIG_PAGING_AT45DB - Use the at45db.c FLASH driver. If this is selected,
+ then the MTD interface to the Atmel AT45DB device will be used to support
+ paging.
+ CONFIG_PAGING_BINOFFSET - If CONFIG_PAGING_M25PX or is CONFIG_PAGING_AT45DB
+ defined then CONFIG_PAGING_BINOFFSET will be used to specify the offset
+ in bytes into the FLASH device where the NuttX binary image is located.
+ Default: 0
+ CONFIG_PAGING_SPIPORT - If CONFIG_PAGING_M25PX CONFIG_PAGING_AT45DB is
+ defined and the device has multiple SPI busses (ports), then this
+ configuration should be set to indicate which SPI port the device is
+ connected. Default: 0
+
+ The following can be used to disable categories of APIs supported
+ by the OS. If the compiler supports weak functions, then it
+ should not be necessary to disable functions unless you want to
+ restrict usage of those APIs.
+
+ There are certain dependency relationships in these features.
+
+ o mq_notify logic depends on signals to awaken tasks
+ waiting for queues to become full or empty.
+ o pthread_condtimedwait() depends on signals to wake
+ up waiting tasks.
+
+ CONFIG_DISABLE_CLOCK, CONFIG_DISABLE_POSIX_TIMERS, CONFIG_DISABLE_PTHREAD.
+ CONFIG_DISABLE_SIGNALS, CONFIG_DISABLE_MQUEUE, CONFIG_DISABLE_MOUNTPOUNT,
+ CONFIG_DISABLE_ENVIRON, CONFIG_DISABLE_POLL
+
+ Misc libc settings
+
+ CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a little smaller
+ if we do not support fieldwidthes
+ CONFIG_LIBC_FLOATINGPOINT - By default, floating point support in printf,
+ sscanf, etc. is disabled.
+ CONFIG_LIBC_STRERROR - strerror() is useful because it decodes 'errno'
+ values into a human readable strings. But it can also require
+ a lot of memory. If this option is selected, strerror() will still
+ exist in the build but it will not decode error values. This option
+ should be used by other logic to decide if it should use strerror() or
+ not. For example, the NSH application will not use strerror() if this
+ option is not selected; perror() will not use strerror() is this option
+ is not selected (see also CONFIG_NSH_STRERROR).
+ CONFIG_LIBC_STRERROR_SHORT - If this option is selected, then strerror()
+ will use a shortened string when it decodes the error. Specifically,
+ strerror() is simply use the string that is the common name for the
+ error. For example, the 'errno' value of 2 will produce the string
+ "No such file or directory" if CONFIG_LIBC_STRERROR_SHORT is not
+ defined but the string "ENOENT" if CONFIG_LIBC_STRERROR_SHORT is
+ defined.
+ CONFIG_LIBC_PERROR_STDOUT - POSIX requires that perror() provide its output
+ on stderr. This option may be defined, however, to provide perror() output
+ that is serialized with other stdout messages.
+
+ Allow for architecture optimized implementations
+
+ The architecture can provide optimized versions of the
+ following to improve system performance
+
+ CONFIG_ARCH_MEMCPY, CONFIG_ARCH_MEMCMP, CONFIG_ARCH_MEMMOVE
+ CONFIG_ARCH_MEMSET, CONFIG_ARCH_STRCMP, CONFIG_ARCH_STRCPY
+ CONFIG_ARCH_STRNCPY, CONFIG_ARCH_STRLEN, CONFIG_ARCH_STRNLEN
+ CONFIG_ARCH_BZERO
+
+ The architecture may provide custom versions of certain standard header
+ files:
+
+ CONFIG_ARCH_STDBOOL_H - The stdbool.h header file can be found at
+ nuttx/include/stdbool.h. However, that header includes logic to redirect
+ the inclusion of an architecture specific header file like:
+
+ #ifdef CONFIG_ARCH_STDBOOL_H
+ # include <arch/stdbool.h>
+ #else
+ ...
+ #endif
+
+ Recall that that include path, include/arch, is a symbolic link and
+ will refer to a version of stdbool.h at nuttx/arch/<architecture>/include/stdbool.h.
+
+ CONFIG_ARCH_STDINT_H - Similar logic exists for the stdint.h header
+ file can also be found at nuttx/include/stdint.h.
+
+ #ifdef CONFIG_ARCH_STDBOOL_H
+ # include <arch/stdinit.h>
+ #else
+ ...
+ #endif
+
+ CONFIG_ARCH_MATH_H - There is also a re-directing version of math.h in
+ the source tree. However, it resides out-of-the-way at include/nuttx/math.h
+ because it conflicts too often with the system math.h. If CONFIG_ARCH_MATH_H=y
+ is defined, however, the top-level makefile will copy the redirecting
+ math.h header file from include/nuttx/math.h to include/math.h. math.h
+ will then include the architecture-specific version of math.h that you
+ must provide at nuttx/arch/>architecture</include/math.h.
+
+ #ifdef CONFIG_ARCH_MATH_H
+ # include <arch/math.h>
+ #endif
+
+ So for the architectures that define CONFIG_ARCH_MATH_H=y, include/math.h
+ will be the redirecting math.h header file; for the architectures that
+ don't select CONFIG_ARCH_MATH_H, the redirecting math.h header file will
+ stay out-of-the-way in include/nuttx/.
+
+ CONFIG_ARCH_STDARG_H - There is also a redirecting version of stdarg.h in
+ the source tree as well. It also resides out-of-the-way at include/nuttx/stdarg.h.
+ This is because you should normally use your toolchain's stdarg.h file. But
+ sometimes, your toolchain's stdarg.h file may have other header file
+ dependencies and so may not be usable in the NuttX build environment. In
+ those cases, you may have to create a architecture-specific stdarg.h header
+ file at nuttx/arch/>architecture</include/stdarg.h
+
+ If CONFIG_ARCH_STDARG_H=y is defined, the top-level makefile will copy the
+ re-directing stdarg.h header file from include/nuttx/stdarg.h to
+ include/stdarg.h. So for the architectures that cannot use their toolchain's
+ stdarg.h file, they can use this alternative by defining CONFIG_ARCH_STDARG_H=y
+ and providing. If CONFIG_ARCH_STDARG_H, is not defined, then the stdarg.h
+ header file will stay out-of-the-way in include/nuttx/.
+
+ CONFIG_ARCH_ROMGETC - In Harvard architectures, data accesses and
+ instruction accesses occur on different busses, perhaps
+ concurrently. All data accesses are performed on the data bus
+ unless special machine instructions are used to read data
+ from the instruction address space. Also, in the typical
+ MCU, the available SRAM data memory is much smaller that the
+ non-volatile FLASH instruction memory. So if the application
+ requires many constant strings, the only practical solution may
+ be to store those constant strings in FLASH memory where they
+ can only be accessed using architecture-specific machine
+ instructions.
+
+ If CONFIG_ARCH_ROMGETC is defined, then the architecture logic
+ must export the function up_romgetc(). up_romgetc() will simply
+ read one byte of data from the instruction space.
+
+ If CONFIG_ARCH_ROMGETC, certain C stdio functions are effected:
+ (1) All format strings in printf, fprintf, sprintf, etc. are
+ assumed to lie in FLASH (string arguments for %s are still assumed
+ to reside in SRAM). And (2), the string argument to puts and fputs
+ is assumed to reside in FLASH. Clearly, these assumptions may have
+ to modified for the particular needs of your environment. There
+ is no "one-size-fits-all" solution for this problem.
+
+ Sizes of configurable things (0 disables)
+
+ CONFIG_MAX_TASKS - The maximum number of simultaneously
+ active tasks. This value must be a power of two.
+ CONFIG_NPTHREAD_KEYS - The number of items of thread-
+ specific data that can be retained
+ CONFIG_NFILE_DESCRIPTORS - The maximum number of file
+ descriptors (one for each open)
+ CONFIG_NFILE_STREAMS - The maximum number of streams that
+ can be fopen'ed
+ CONFIG_NAME_MAX - Maximum number of bytes in a filename (not including
+ terminating null). Default: 32
+ CONFIG_PATH_MAX - Maximum number of bytes in a pathname, including the
+ terminating null character. Default: MIN(256,(4*CONFIG_NAME_MAX+1))
+ CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
+ on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
+ CONFIG_STDIO_LINEBUFFER - If standard C buffered I/O is enabled
+ (CONFIG_STDIO_BUFFER_SIZE > 0), then this option may be added
+ to force automatic, line-oriented flushing the output buffer
+ for putc(), fputc(), putchar(), puts(), fputs(), printf(),
+ fprintf(), and vfprintf(). When a newline is encountered in
+ the output string, the output buffer will be flushed. This
+ (slightly) increases the NuttX footprint but supports the kind
+ of behavior that people expect for printf().
+ CONFIG_NUNGET_CHARS - Number of characters that can be
+ buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
+ CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
+ structures. The system manages a pool of preallocated
+ message structures to minimize dynamic allocations
+ CONFIG_PREALLOC_IGMPGROUPS - Pre-allocated IGMP groups are used
+ only if needed from interrupt level group created (by the IGMP server).
+ Default: 4.
+ CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
+ a fixed payload size given by this settin (does not include
+ other message structure overhead.
+ CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
+ structures. The system manages a pool of preallocated
+ watchdog structures to minimize dynamic allocations
+ CONFIG_DEV_PIPE_SIZE - Size, in bytes, of the buffer to allocated
+ for pipe and FIFO support
+
+ Filesystem configuration
+
+ CONFIG_FS_FAT - Enable FAT filesystem support
+ CONFIG_FAT_LCNAMES - Enable use of the NT-style upper/lower case 8.3
+ file name support.
+ CONFIG_FAT_LFN - Enable FAT long file names. NOTE: Microsoft claims
+ patents on FAT long file name technology. Please read the
+ disclaimer in the top-level COPYING file and only enable this
+ feature if you understand these issues.
+ CONFIG_FAT_MAXFNAME - If CONFIG_FAT_LFN is defined, then the
+ default, maximum long file name is 255 bytes. This can eat up
+ a lot of memory (especially stack space). If you are willing
+ to live with some non-standard, short long file names, then
+ define this value. A good choice would be the same value as
+ selected for CONFIG_NAME_MAX which will limit the visibility
+ of longer file names anyway.
+ CONFIG_FS_FATTIME: Support FAT date and time. NOTE: There is not
+ much sense in supporting FAT date and time unless you have a
+ hardware RTC or other way to get the time and date.
+ CONFIG_FS_NXFFS: Enable NuttX FLASH file system (NXFF) support.
+ CONFIG_NXFFS_ERASEDSTATE: The erased state of FLASH.
+ This must have one of the values of 0xff or 0x00.
+ Default: 0xff.
+ CONFIG_NXFFS_PACKTHRESHOLD: When packing flash file data,
+ don't both with file chunks smaller than this number of data bytes.
+ Default: 32.
+ CONFIG_NXFFS_MAXNAMLEN: The maximum size of an NXFFS file name.
+ Default: 255.
+ CONFIG_NXFFS_PACKTHRESHOLD: When packing flash file data,
+ don't both with file chunks smaller than this number of data bytes.
+ Default: 32.
+ CONFIG_NXFFS_TAILTHRESHOLD: clean-up can either mean
+ packing files together toward the end of the file or, if file are
+ deleted at the end of the file, clean up can simply mean erasing
+ the end of FLASH memory so that it can be re-used again. However,
+ doing this can also harm the life of the FLASH part because it can
+ mean that the tail end of the FLASH is re-used too often. This
+ threshold determines if/when it is worth erased the tail end of FLASH
+ and making it available for re-use (and possible over-wear).
+ Default: 8192.
+ CONFIG_FS_ROMFS - Enable ROMFS filesystem support
+ CONFIG_NFS - Enable Network File System (NFS) client file system support.
+ Provided support is version 3 using UDP. In addition to common
+ prerequisites for mount-able file systems in general, this option
+ requires UDP networking support; this would include CONFIG_NETand
+ CONFIG_NET_UDP at a minimum.
+ CONFIG_FS_RAMMAP - For file systems that do not support XIP, this
+ option will enable a limited form of memory mapping that is
+ implemented by copying whole files into memory.
+
+ RTC
+
+ CONFIG_RTC - Enables general support for a hardware RTC. Specific
+ architectures may require other specific settings.
+ CONFIG_RTC_DATETIME - There are two general types of RTC: (1) A simple
+ battery backed counter that keeps the time when power is down, and (2)
+ A full date / time RTC the provides the date and time information, often
+ in BCD format. If CONFIG_RTC_DATETIME is selected, it specifies this
+ second kind of RTC. In this case, the RTC is used to "seed" the normal
+ NuttX timer and the NuttX system timer provides for higher resoution
+ time.
+ CONFIG_RTC_HIRES - If CONFIG_RTC_DATETIME not selected, then the simple,
+ battery backed counter is used. There are two different implementations
+ of such simple counters based on the time resolution of the counter:
+ The typical RTC keeps time to resolution of 1 second, usually
+ supporting a 32-bit time_t value. In this case, the RTC is used to
+ "seed" the normal NuttX timer and the NuttX timer provides for higher
+ resoution time. If CONFIG_RTC_HIRES is enabled in the NuttX configuration,
+ then the RTC provides higher resolution time and completely replaces the
+ system timer for purpose of date and time.
+ CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the frequency
+ of the high resolution RTC must be provided. If CONFIG_RTC_HIRES is
+ not defined, CONFIG_RTC_FREQUENCY is assumed to be one.
+ CONFIG_RTC_ALARM - Enable if the RTC hardware supports setting of an
+ alarm. A callback function will be executed when the alarm goes off
+
+ CAN driver
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. If the driver does support loopback mode, the setting
+ will enable it. (If the driver does not, this setting will have no effect).
+
+ SPI driver
+
+ CONFIG_SPI_OWNBUS - Set if there is only one active device
+ on the SPI bus. No locking or SPI configuration will be performed.
+ It is not necessary for clients to lock, re-configure, etc..
+ CONFIG_SPI_EXCHANGE - Driver supports a single exchange method
+ (vs a recvblock() and sndblock ()methods)
+
+ SPI-based MMC/SD driver
+
+ CONFIG_MMCSD_NSLOTS - Number of MMC/SD slots supported by the
+ driver. Default is one.
+ CONFIG_MMCSD_READONLY - Provide read-only access. Default is
+ Read/Write
+ CONFIG_MMCSD_SPICLOCK - Maximum SPI clock to drive MMC/SD card.
+ Default is 20MHz.
+
+ SDIO/SDHC driver:
+
+ CONFIG_SDIO_DMA - SDIO driver supports DMA
+ CONFIG_SDIO_MUXBUS - Set this SDIO interface if the SDIO interface
+ or hardware resources are shared with other drivers.
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+ CONFIG_MMCSD_MULTIBLOCK_DISABLE - Use only the single block transfer method.
+ This setting is used to work around buggy SDIO drivers that cannot handle
+ multiple block transfers.
+
+ SDIO-based MMC/SD driver
+
+ CONFIG_FS_READAHEAD - Enable read-ahead buffering
+ CONFIG_FS_WRITEBUFFER - Enable write buffering
+ CONFIG_MMCSD_MMCSUPPORT - Enable support for MMC cards
+ CONFIG_MMCSD_HAVECARDDETECT - SDIO driver card detection is
+ 100% accurate
+
+ RiT P14201 OLED driver
+
+ CONFIG_LCD_P14201 - Enable P14201 support
+ CONFIG_P14201_SPIMODE - Controls the SPI mode
+ CONFIG_P14201_FREQUENCY - Define to use a different bus frequency
+ CONFIG_P14201_NINTERFACES - Specifies the number of physical P14201
+ devices that will be supported.
+ CONFIG_P14201_FRAMEBUFFER - If defined, accesses will be performed
+ using an in-memory copy of the OLEDs GDDRAM. This cost of this
+ buffer is 128 * 96 / 2 = 6Kb. If this is defined, then the driver
+ will be fully functional. If not, then it will have the following
+ limitations:
+ - Reading graphics memory cannot be supported, and
+ - All pixel writes must be aligned to byte boundaries.
+ The latter limitation effectively reduces the 128x96 disply to 64x96.
+
+ Nokia 6100 Configuration Settings:
+
+ CONFIG_NOKIA6100_SPIMODE - Controls the SPI mode
+ CONFIG_NOKIA6100_FREQUENCY - Define to use a different bus frequency
+ CONFIG_NOKIA6100_NINTERFACES - Specifies the number of physical Nokia
+ 6100 devices that will be supported.
+ CONFIG_NOKIA6100_BPP - Device supports 8, 12, and 16 bits per pixel.
+ CONFIG_NOKIA6100_S1D15G10 - Selects the Epson S1D15G10 display controller
+ CONFIG_NOKIA6100_PCF8833 - Selects the Phillips PCF8833 display controller
+ CONFIG_NOKIA6100_BLINIT - Initial backlight setting
+
+ The following may need to be tuned for your hardware:
+ CONFIG_NOKIA6100_INVERT - Display inversion, 0 or 1, Default: 1
+ CONFIG_NOKIA6100_MY - Display row direction, 0 or 1, Default: 0
+ CONFIG_NOKIA6100_MX - Display column direction, 0 or 1, Default: 1
+ CONFIG_NOKIA6100_V - Display address direction, 0 or 1, Default: 0
+ CONFIG_NOKIA6100_ML - Display scan direction, 0 or 1, Default: 0
+ CONFIG_NOKIA6100_RGBORD - Display RGB order, 0 or 1, Default: 0
+
+ Required LCD driver settings:
+ CONFIG_LCD_NOKIA6100 - Enable Nokia 6100 support
+ CONFIG_LCD_MAXCONTRAST - must be 63 with the Epson controller and 127 with
+ the Phillips controller.
+ CONFIG_LCD_MAXPOWER - Maximum value of backlight setting. The backlight
+ control is managed outside of the 6100 driver so this value has no
+ meaning to the driver. Board-specific logic may place restrictions on
+ this value.
+
+ Input Devices
+
+ CONFIG_INPUT
+ Enables general support for input devices
+
+ CONFIG_INPUT_TSC2007
+ If CONFIG_INPUT is selected, then this setting will enable building
+ of the TI TSC2007 touchscreen driver.
+ CONFIG_TSC2007_MULTIPLE
+ Normally only a single TI TSC2007 touchscreen is used. But if
+ there are multiple TSC2007 touchscreens, this setting will enable
+ multiple touchscreens with the same driver.
+
+ CONFIG_INPUT_STMPE811
+ Enables support for the STMPE811 driver (Needs CONFIG_INPUT)
+ CONFIG_STMPE811_SPI
+ Enables support for the SPI interface (not currenly supported)
+ CONFIG_STMPE811_I2C
+ Enables support for the I2C interface
+ CONFIG_STMPE811_MULTIPLE
+ Can be defined to support multiple STMPE811 devices on board.
+ CONFIG_STMPE811_ACTIVELOW
+ Interrupt is generated by an active low signal (or falling edge).
+ CONFIG_STMPE811_EDGE
+ Interrupt is generated on an edge (vs. on the active level)
+ CONFIG_STMPE811_NPOLLWAITERS
+ Maximum number of threads that can be waiting on poll() (ignored if
+ CONFIG_DISABLE_POLL is set).
+ CONFIG_STMPE811_TSC_DISABLE
+ Disable driver touchscreen functionality.
+ CONFIG_STMPE811_ADC_DISABLE
+ Disable driver ADC functionality.
+ CONFIG_STMPE811_GPIO_DISABLE
+ Disable driver GPIO functionlaity.
+ CONFIG_STMPE811_GPIOINT_DISABLE
+ Disable driver GPIO interrupt functionality (ignored if GPIO
+ functionality is disabled).
+ CONFIG_STMPE811_SWAPXY
+ Reverse the meaning of X and Y to handle different LCD orientations.
+ CONFIG_STMPE811_TEMP_DISABLE
+ Disable driver temperature sensor functionality.
+ CONFIG_STMPE811_REGDEBUG
+ Enabled very low register-level debug output. Requires CONFIG_DEBUG.
+ CONFIG_STMPE811_THRESHX and CONFIG_STMPE811_THRESHY
+ STMPE811 touchscreen data comes in a a very high rate. New touch positions
+ will only be reported when the X or Y data changes by these thresholds.
+ This trades reduces data rate for some loss in dragging accuracy. The
+ STMPE811 is configure for 12-bit values so the raw ranges are 0-4095. So
+ for example, if your display is 320x240, then THRESHX=13 and THRESHY=17
+ would correspond to one pixel. Default: 12
+
+ Analog Devices
+
+ CONFIG_DAC
+ Enables general support for Digital-to-Analog conversion devices.
+ CONFIG_ADC
+ Enables general support for Analog-to-Digital conversion devices.
+ CONFIG_ADC_ADS125X
+ Adds support for the TI ADS 125x ADC.
+
+ ENC28J60 Ethernet Driver Configuration Settings:
+
+ CONFIG_ENC28J60 - Enabled ENC28J60 support
+ CONFIG_ENC28J60_SPIMODE - Controls the SPI mode
+ CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency
+ CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60
+ devices that will be supported.
+ CONFIG_ENC28J60_STATS - Collect network statistics
+ CONFIG_ENC28J60_HALFDUPPLEX - Default is full duplex
+
+ Networking support via uIP
+
+ CONFIG_NET - Enable or disable all network features
+ CONFIG_NET_NOINTS -- CONFIG_NET_NOINT indicates that uIP not called from
+ the interrupt level. If CONFIG_NET_NOINTS is defined, critical sections
+ will be managed with semaphores; Otherwise, it assumed that uIP will be
+ called from interrupt level handling and critical sections will be
+ managed by enabling and disabling interrupts.
+ CONFIG_NET_MULTIBUFFER - Traditionally, uIP has used a single buffer
+ for all incoming and outgoing traffic. If this configuration is
+ selected, then the driver can manage multiple I/O buffers and can,
+ for example, be filling one input buffer while sending another
+ output buffer. Or, as another example, the driver may support
+ queuing of concurrent input/ouput and output transfers for better
+ performance.
+ CONFIG_NET_IPv6 - Build in support for IPv6
+ CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors
+ per task/thread.
+ CONFIG_NET_NACTIVESOCKETS - Maximum number of concurrent socket
+ operations (recv, send, etc.). Default: CONFIG_NET_TCP_CONNS+CONFIG_NET_UDP_CONNS
+ CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
+
+ CONFIG_NET_BUFSIZE - uIP buffer size
+ CONFIG_NET_TCPURGDATA - Determines if support for TCP urgent data
+ notification should be compiled in. Urgent data (out-of-band data)
+ is a rarely used TCP feature that is very seldom would be required.
+ CONFIG_NET_TCP - TCP support on or off
+ CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
+ CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
+ CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
+ CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers
+ (may be zero to disable TCP/IP read-ahead buffering)
+ CONFIG_NET_TCP_RECVDELAY - Delay (in deciseconds) after a TCP/IP packet
+ is received. This delay may allow catching of additional packets
+ when TCP/IP read-ahead is disabled. Default: 0
+ CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
+ accept() is called. The size of the backlog is selected when listen()
+ is called.
+ CONFIG_NET_UDP - UDP support on or off
+ CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+ CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP
+ connections
+ CONFIG_NET_ICMP - Enable minimal ICMP support. Includes built-in support
+ for sending replies to received ECHO (ping) requests.
+ CONFIG_NET_ICMP_PING - Provide interfaces to support application level
+ support for sending ECHO (ping) requests and associating ECHO
+ replies.
+ CONFIG_NET_IGMP - Enable IGMPv2 client support.
+ CONFIG_PREALLOC_IGMPGROUPS - Pre-allocated IGMP groups are used
+ only if needed from interrupt level group created (by the IGMP server).
+ Default: 4.
+ CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
+ CONFIG_NET_STATISTICS - uIP statistics on or off
+ CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's
+ window
+ CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
+ CONFIG_NET_ARP_IPIN - Harvest IP/MAC address mappings from the ARP table
+ from incoming IP packets.
+ CONFIG_NET_BROADCAST - Incoming UDP broadcast support
+ CONFIG_NET_MULTICAST - Outgoing multi-cast address support
+
+ SLIP Driver. SLIP supports point-to-point IP communications over a serial
+ port. The default data link layer for uIP is Ethernet. If CONFIG_NET_SLIP
+ is defined in the NuttX configuration file, then SLIP will be supported.
+ The basic differences between the SLIP and Ethernet configurations is that
+ when SLIP is selected:
+
+ * The link level header (that comes before the IP header) is omitted.
+ * All MAC address processing is suppressed.
+ * ARP is disabled.
+
+ If CONFIG_NET_SLIP is not selected, then Ethernet will be used (there is
+ no need to define anything special in the configuration file to use
+ Ethernet -- it is the default).
+
+ CONFIG_NET_SLIP -- Enables building of the SLIP driver. SLIP requires
+ at least one IP protocols selected and the following additional
+ network settings: CONFIG_NET_NOINTS and CONFIG_NET_MULTIBUFFER.
+ CONFIG_NET_BUFSIZE *must* be set to 296. Other optional configuration
+ settings that affect the SLIP driver: CONFIG_NET_STATISTICS.
+ Default: Ethernet
+
+ If SLIP is selected, then the following SLIP options are available:
+
+ CONFIG_CLIP_NINTERFACES -- Selects the number of physical SLIP
+ interfaces to support. Default: 1
+ CONFIG_SLIP_STACKSIZE -- Select the stack size of the SLIP RX and
+ TX tasks. Default: 2048
+ CONFIG_SLIP_DEFPRIO - The priority of the SLIP RX and TX tasks.
+ Default: 128
+
+ UIP Network Utilities
+
+ CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
+ CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
+
+ THTTPD
+
+ CONFIG_THTTPD_PORT - THTTPD Server port number
+ CONFIG_THTTPD_IPADDR - Server IP address (no host name)
+ CONFIG_THTTPD_SERVER_ADDRESS - SERVER_ADDRESS: response
+ CONFIG_THTTPD_SERVER_SOFTWARE - SERVER_SOFTWARE: response
+ CONFIG_THTTPD_PATH - Server working directory
+ CONFIG_THTTPD_CGI_PATH - Path to CGI executables
+ CONFIG_THTTPD_CGI_PATTERN - Only CGI programs matching this
+ pattern will be executed. In fact, if this value is not defined
+ then no CGI logic will be built.
+ CONFIG_THTTPD_CGI_PRIORITY - Provides the priority of CGI child tasks
+ CONFIG_THTTPD_CGI_STACKSIZE - Provides the initial stack size of
+ CGI child task (will be overridden by the stack size in the NXFLAT
+ header)
+ CONFIG_THTTPD_CGI_BYTECOUNT - Byte output limit for CGI tasks.
+ CONFIG_THTTPD_CGI_TIMELIMIT - How many seconds to allow CGI programs
+ to run before killing them.
+ CONFIG_THTTPD_CHARSET- The default character set name to use with
+ text MIME types.
+ CONFIG_THTTPD_IOBUFFERSIZE -
+ CONFIG_THTTPD_INDEX_NAMES - A list of index filenames to check. The
+ files are searched for in this order.
+ CONFIG_AUTH_FILE - The file to use for authentication. If this is
+ defined then thttpd checks for this file in the local directory
+ before every fetch. If the file exists then authentication is done,
+ otherwise the fetch proceeds as usual. If you leave this undefined
+ then thttpd will not implement authentication at all and will not
+ check for auth files, which saves a bit of CPU time. A typical
+ value is ".htpasswd"
+ CONFIG_THTTPD_LISTEN_BACKLOG - The listen() backlog queue length.
+ CONFIG_THTTPD_LINGER_MSEC - How many milliseconds to leave a connection
+ open while doing a lingering close.
+ CONFIG_THTTPD_OCCASIONAL_MSEC - How often to run the occasional
+ cleanup job.
+ CONFIG_THTTPD_IDLE_READ_LIMIT_SEC - How many seconds to allow for
+ reading the initial request on a new connection.
+ CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC - How many seconds before an
+ idle connection gets closed.
+ CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2 - Tilde mapping.
+ Many URLs use ~username to indicate a user's home directory. thttpd
+ provides two options for mapping this construct to an actual filename.
+ 1) Map ~username to <prefix>/username. This is the recommended choice.
+ Each user gets a subdirectory in the main web tree, and the tilde
+ construct points there. The prefix could be something like "users",
+ or it could be empty.
+ 2) Map ~username to <user's homedir>/<postfix>. The postfix would be
+ the name of a subdirectory off of the user's actual home dir,
+ something like "public_html".
+ You can also leave both options undefined, and thttpd will not do
+ anything special about tildes. Enabling both options is an error.
+ Typical values, if they're defined, are "users" for
+ CONFIG_THTTPD_TILDE_MAP1 and "public_html"forCONFIG_THTTPD_TILDE_MAP2.
+ CONFIG_THTTPD_GENERATE_INDICES
+ CONFIG_THTTPD_URLPATTERN - If defined, then it will be used to match
+ and verify referrers.
+
+ FTP Server
+
+ CONFIG_FTPD_VENDORID - The vendor name to use in FTP communications.
+ Default: "NuttX"
+ CONFIG_FTPD_SERVERID - The server name to use in FTP communications.
+ Default: "NuttX FTP Server"
+ CONFIG_FTPD_CMDBUFFERSIZE - The maximum size of one command. Default:
+ 128 bytes.
+ CONFIG_FTPD_DATABUFFERSIZE - The size of the I/O buffer for data
+ transfers. Default: 512 bytes.
+ CONFIG_FTPD_WORKERSTACKSIZE - The stacksize to allocate for each
+ FTP daemon worker thread. Default: 2048 bytes.
+
+ Other required configuration settings: Of course TCP networking support
+ is required. But here are a couple that are less obvious:
+
+ CONFIG_DISABLE_PTHREAD - pthread support is required
+ CONFIG_DISABLE_POLL - poll() support is required
+
+ USB device controller driver
+
+ CONFIG_USBDEV - Enables USB device support
+ CONFIG_USBDEV_COMPOSITE
+ Enables USB composite device support
+ CONFIG_USBDEV_ISOCHRONOUS - Build in extra support for isochronous
+ endpoints
+ CONFIG_USBDEV_DUALSPEED -Hardware handles high and full speed
+ operation (USB 2.0)
+ CONFIG_USBDEV_SELFPOWERED - Will cause USB features to indicate
+ that the device is self-powered
+ CONFIG_USBDEV_MAXPOWER - Maximum power consumption in mA
+ CONFIG_USBDEV_TRACE - Enables USB tracing for debug
+ CONFIG_USBDEV_TRACE_NRECORDS - Number of trace entries to remember
+
+ USB host controller driver
+
+ CONFIG_USBHOST
+ Enables USB host support
+ CONFIG_USBHOST_NPREALLOC
+ Number of pre-allocated class instances
+ CONFIG_USBHOST_BULK_DISABLE
+ On some architectures, selecting this setting will reduce driver size
+ by disabling bulk endpoint support
+ CONFIG_USBHOST_INT_DISABLE
+ On some architectures, selecting this setting will reduce driver size
+ by disabling interrupt endpoint support
+ CONFIG_USBHOST_ISOC_DISABLE
+ On some architectures, selecting this setting will reduce driver size
+ by disabling isochronous endpoint support
+
+ USB host HID class driver. Requires CONFIG_USBHOST=y,
+ CONFIG_USBHOST_INT_DISABLE=n, CONFIG_NFILE_DESCRIPTORS > 0,
+ CONFIG_SCHED_WORKQUEUE=y, and CONFIG_DISABLE_SIGNALS=n.
+
+ CONFIG_HIDKBD_POLLUSEC
+ Device poll rate in microseconds. Default: 100 milliseconds.
+ CONFIG_HIDKBD_DEFPRIO
+ Priority of the polling thread. Default: 50.
+ CONFIG_HIDKBD_STACKSIZE
+ Stack size for polling thread. Default: 1024
+ CONFIG_HIDKBD_BUFSIZE
+ Scancode buffer size. Default: 64.
+ CONFIG_HIDKBD_NPOLLWAITERS
+ If the poll() method is enabled, this defines the maximum number
+ of threads that can be waiting for keyboard events. Default: 2.
+ CONFIG_HIDKBD_RAWSCANCODES
+ If set to y no conversion will be made on the raw keyboard scan
+ codes. Default: ASCII conversion.
+ CONFIG_HIDKBD_ALLSCANCODES'
+ If set to y all 231 possible scancodes will be converted to
+ something. Default: 104 key US keyboard.
+ CONFIG_HIDKBD_NODEBOUNCE
+ If set to y normal debouncing is disabled. Default:
+ Debounce enabled (No repeat keys).
+
+ USB host mass storage class driver. Requires CONFIG_USBHOST=y,
+ CONFIG_USBHOST_BULK_DISABLE=n, CONFIG_NFILE_DESCRIPTORS > 0,
+ and CONFIG_SCHED_WORKQUEUE=y
+
+ USB serial device class driver (Prolific PL2303 Emulation)
+
+ CONFIG_PL2303
+ Enable compilation of the USB serial driver
+ CONFIG_PL2303_EPINTIN
+ The logical 7-bit address of a hardware endpoint that supports
+ interrupt IN operation
+ CONFIG_PL2303_EPBULKOUT
+ The logical 7-bit address of a hardware endpoint that supports
+ bulk OUT operation
+ CONFIG_PL2303_EPBULKIN
+ The logical 7-bit address of a hardware endpoint that supports
+ bulk IN operation
+ CONFIG_PL2303_NWRREQS and CONFIG_PL2303_NRDREQS
+ The number of write/read requests that can be in flight
+ CONFIG_PL2303_VENDORID and CONFIG_PL2303_VENDORSTR
+ The vendor ID code/string
+ CONFIG_PL2303_PRODUCTID and CONFIG_PL2303_PRODUCTSTR
+ The product ID code/string
+ CONFIG_PL2303_RXBUFSIZE and CONFIG_PL2303_TXBUFSIZE
+ Size of the serial receive/transmit buffers
+
+ USB serial device class driver (Standard CDC ACM class)
+
+ CONFIG_CDCACM
+ Enable compilation of the USB serial driver
+ CONFIG_CDCACM_COMPOSITE
+ Configure the CDC serial driver as part of a composite driver
+ (only if CONFIG_USBDEV_COMPOSITE is also defined)
+ CONFIG_CDCACM_IFNOBASE
+ If the CDC driver is part of a composite device, then this may need to
+ be defined to offset the CDC/ACM interface numbers so that they are
+ unique and contiguous. When used with the Mass Storage driver, the
+ correct value for this offset is zero.
+ CONFIG_CDCACM_STRBASE
+ If the CDC driver is part of a composite device, then this may need to
+ be defined to offset the CDC/ACM string numbers so that they are
+ unique and contiguous. When used with the Mass Storage driver, the
+ correct value for this offset is four (this value actuallly only needs
+ to be defined if names are provided for the Notification interface,
+ CONFIG_CDCACM_NOTIFSTR, or the data interface, CONFIG_CDCACM_DATAIFSTR).
+ CONFIG_CDCACM_EP0MAXPACKET
+ Endpoint 0 max packet size. Default 64.
+ CONFIG_CDCACM_EPINTIN
+ The logical 7-bit address of a hardware endpoint that supports
+ interrupt IN operation. Default 2.
+ CONFIG_CDCACM_EPINTIN_FSSIZE
+ Max package size for the interrupt IN endpoint if full speed mode.
+ Default 64.
+ CONFIG_CDCACM_EPINTIN_HSSIZE
+ Max package size for the interrupt IN endpoint if high speed mode.
+ Default 64.
+ CONFIG_CDCACM_EPBULKOUT
+ The logical 7-bit address of a hardware endpoint that supports
+ bulk OUT operation
+ CONFIG_CDCACM_EPBULKOUT_FSSIZE
+ Max package size for the bulk OUT endpoint if full speed mode.
+ Default 64.
+ CONFIG_CDCACM_EPBULKOUT_HSSIZE
+ Max package size for the bulk OUT endpoint if high speed mode.
+ Default 512.
+ CONFIG_CDCACM_EPBULKIN
+ The logical 7-bit address of a hardware endpoint that supports
+ bulk IN operation
+ CONFIG_CDCACM_EPBULKIN_FSSIZE
+ Max package size for the bulk IN endpoint if full speed mode.
+ Default 64.
+ CONFIG_CDCACM_EPBULKIN_HSSIZE
+ Max package size for the bulk IN endpoint if high speed mode.
+ Default 512.
+ CONFIG_CDCACM_NWRREQS and CONFIG_CDCACM_NRDREQS
+ The number of write/read requests that can be in flight.
+ CONFIG_CDCACM_NWRREQS includes write requests used for both the
+ interrupt and bulk IN endpoints. Default 4.
+ CONFIG_CDCACM_VENDORID and CONFIG_CDCACM_VENDORSTR
+ The vendor ID code/string. Default 0x0525 and "NuttX"
+ 0x0525 is the Netchip vendor and should not be used in any
+ products. This default VID was selected for compatibility with
+ the Linux CDC ACM default VID.
+ CONFIG_CDCACM_PRODUCTID and CONFIG_CDCACM_PRODUCTSTR
+ The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial"
+ 0xa4a7 was selected for compatibility with the Linux CDC ACM
+ default PID.
+ CONFIG_CDCACM_RXBUFSIZE and CONFIG_CDCACM_TXBUFSIZE
+ Size of the serial receive/transmit buffers. Default 256.
+
+ USB Storage Device Configuration
+
+ CONFIG_USBMSC
+ Enable compilation of the USB storage driver
+ CONFIG_USBMSC_COMPOSITE
+ Configure the mass storage driver as part of a composite driver
+ (only if CONFIG_USBDEV_COMPOSITE is also defined)
+ CONFIG_USBMSC_IFNOBASE
+ If the CDC driver is part of a composite device, then this may need to
+ be defined to offset the mass storage interface number so that it is
+ unique and contiguous. When used with the CDC/ACM driver, the
+ correct value for this offset is two (because of the two CDC/ACM
+ interfaces that will precede it).
+ CONFIG_USBMSC_STRBASE
+ If the CDC driver is part of a composite device, then this may need to
+ be defined to offset the mass storage string numbers so that they are
+ unique and contiguous. When used with the CDC/ACM driver, the
+ correct value for this offset is four (or perhaps 5 or 6, depending
+ on if CONFIG_CDCACM_NOTIFSTR or CONFIG_CDCACM_DATAIFSTR are defined).
+ CONFIG_USBMSC_EP0MAXPACKET
+ Max packet size for endpoint 0
+ CONFIG_USBMSCEPBULKOUT and CONFIG_USBMSC_EPBULKIN
+ The logical 7-bit address of a hardware endpoints that support
+ bulk OUT and IN operations
+ CONFIG_USBMSC_NWRREQS and CONFIG_USBMSC_NRDREQS
+ The number of write/read requests that can be in flight
+ CONFIG_USBMSC_BULKINREQLEN and CONFIG_USBMSC_BULKOUTREQLEN
+ The size of the buffer in each write/read request. This
+ value needs to be at least as large as the endpoint
+ maxpacket and ideally as large as a block device sector.
+ CONFIG_USBMSC_VENDORID and CONFIG_USBMSC_VENDORSTR
+ The vendor ID code/string
+ CONFIG_USBMSC_PRODUCTID and CONFIG_USBMSC_PRODUCTSTR
+ The product ID code/string
+ CONFIG_USBMSC_REMOVABLE
+ Select if the media is removable
+
+ USB Composite Device Configuration
+
+ CONFIG_USBDEV_COMPOSITE
+ Enables USB composite device support
+ CONFIG_CDCACM_COMPOSITE
+ Configure the CDC serial driver as part of a composite driver
+ (only if CONFIG_USBDEV_COMPOSITE is also defined)
+ CONFIG_USBMSC_COMPOSITE
+ Configure the mass storage driver as part of a composite driver
+ (only if CONFIG_USBDEV_COMPOSITE is also defined)
+ CONFIG_COMPOSITE_IAD
+ If one of the members of the composite has multiple interfaces
+ (such as CDC/ACM), then an Interface Association Descriptor (IAD)
+ will be necessary. Default: IAD will be used automatically if
+ needed. It should not be necessary to set this.
+ CONFIG_COMPOSITE_EP0MAXPACKET
+ Max packet size for endpoint 0
+ CONFIG_COMPOSITE_VENDORID and CONFIG_COMPOSITE_VENDORSTR
+ The vendor ID code/string
+ CONFIG_COMPOSITE_PRODUCTID and CONFIG_COMPOSITE_PRODUCTSTR
+ The product ID code/string
+ CONFIG_COMPOSITE_SERIALSTR
+ Device serial number string
+ CONFIG_COMPOSITE_CONFIGSTR
+ Configuration string
+ CONFIG_COMPOSITE_VERSIONNO
+ Interface version number.
+
+ Graphics related configuration settings
+
+ CONFIG_NX
+ Enables overall support for graphics library and NX
+ CONFIG_NX_MULTIUSER
+ Configures NX in multi-user mode
+ CONFIG_NX_NPLANES
+ Some YUV color formats requires support for multiple planes,
+ one for each color component. Unless you have such special
+ hardware, this value should be undefined or set to 1.
+ CONFIG_NX_DISABLE_1BPP, CONFIG_NX_DISABLE_2BPP,
+ CONFIG_NX_DISABLE_4BPP, CONFIG_NX_DISABLE_8BPP,
+ CONFIG_NX_DISABLE_16BPP, CONFIG_NX_DISABLE_24BPP, and
+ CONFIG_NX_DISABLE_32BPP
+ NX supports a variety of pixel depths. You can save some
+ memory by disabling support for unused color depths.
+ CONFIG_NX_PACKEDMSFIRST
+ If a pixel depth of less than 8-bits is used, then NX needs
+ to know if the pixels pack from the MS to LS or from LS to MS
+ CONFIG_NX_LCDDRIVER
+ By default, NX builds to use a framebuffer driver (see
+ include/nuttx/fb.h). If this option is defined, NX will
+ build to use an LCD driver (see include/nuttx/lcd/lcd.h).
+ CONFIG_LCD_MAXPOWER - The full-on power setting for an LCD
+ device.
+ CONFIG_LCD_MAXCONTRAST - The maximum contrast value for an
+ LCD device.
+ CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE,
+ and CONFIG_LCD_RPORTRAIT - Some LCD drivers may support
+ these options to present the display in landscape, portrait,
+ reverse landscape, or reverse portrait orientations. Check
+ the README.txt file in each board configuration directory to
+ see if any of these are supported by the board LCD logic.
+ CONFIG_NX_MOUSE
+ Build in support for mouse input.
+ CONFIG_NX_KBD
+ Build in support of keypad/keyboard input.
+ CONFIG_NXTK_BORDERWIDTH
+ Specifies with with of the border (in pixels) used with
+ framed windows. The default is 4.
+ CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2
+ Specify the colors of the border used with framed windows.
+ CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so
+ is normally darker. The default is medium and dark grey,
+ respectively
+ CONFIG_NXTK_AUTORAISE
+ If set, a window will be raised to the top if the mouse position
+ is over a visible portion of the window. Default: A mouse
+ button must be clicked over a visible portion of the window.
+ CONFIG_NXFONTS_CHARBITS
+ The number of bits in the character set. Current options are
+ only 7 and 8. The default is 7.
+
+ CONFIG_NXFONT_SANS23X27
+ This option enables support for a tiny, 23x27 san serif font
+ (font ID FONTID_SANS23X27 == 1).
+ CONFIG_NXFONT_SANS22X29
+ This option enables support for a small, 22x29 san serif font
+ (font ID FONTID_SANS22X29 == 2).
+ CONFIG_NXFONT_SANS28X37
+ This option enables support for a medium, 28x37 san serif font
+ (font ID FONTID_SANS28X37 == 3).
+ CONFIG_NXFONT_SANS39X48
+ This option enables support for a large, 39x48 san serif font
+ (font ID FONTID_SANS39X48 == 4).
+ CONFIG_NXFONT_SANS22X29B
+ This option enables support for a small, 22x29 san serif bold font
+ (font ID FONTID_SANS22X29B == 5).
+ CONFIG_NXFONT_SANS28X37B
+ This option enables support for a medium, 28x37 san serif bold font
+ (font ID FONTID_SANS28X37B == 6).
+ CONFIG_NXFONT_SANS40X49B
+ This option enables support for a large, 40x49 san serif bold font
+ (font ID FONTID_SANS40X49B == 7).
+ CONFIG_NXFONT_SERIF22X29
+ This option enables support for a small, 22x29 font (with serifs)
+ (font ID FONTID_SERIF22X29 == 8).
+ CONFIG_NXFONT_SERIF29X37
+ This option enables support for a medium, 29x37 font (with serifs)
+ (font ID FONTID_SERIF29X37 == 9).
+ CONFIG_NXFONT_SERIF38X48
+ This option enables support for a large, 38x48 font (with serifs)
+ (font ID FONTID_SERIF38X48 == 10).
+ CONFIG_NXFONT_SERIF22X28B
+ This option enables support for a small, 27x38 bold font (with serifs)
+ (font ID FONTID_SERIF22X28B == 11).
+ CONFIG_NXFONT_SERIF27X38B
+ This option enables support for a medium, 27x38 bold font (with serifs)
+ (font ID FONTID_SERIF27X38B == 12).
+ CONFIG_NXFONT_SERIF38X49B
+ This option enables support for a large, 38x49 bold font (with serifs)
+ (font ID FONTID_SERIF38X49B == 13).
+
+ NX Multi-user only options:
+
+ CONFIG_NX_BLOCKING
+ Open the client message queues in blocking mode. In this case,
+ nx_eventhandler() will never return.
+ CONFIG_NX_MXSERVERMSGS and CONFIG_NX_MXCLIENTMSGS
+ Specifies the maximum number of messages that can fit in
+ the message queues. No additional resources are allocated, but
+ this can be set to prevent flooding of the client or server with
+ too many messages (CONFIG_PREALLOC_MQ_MSGS controls how many
+ messages are pre-allocated).
+
+ Stack and heap information
+
+ CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
+ operation from FLASH but must copy initialized .data sections to RAM.
+ CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
+ but copy themselves entirely into RAM for better performance.
+ CONFIG_BOOT_RAMFUNCS - Other configurations may copy just some functions
+ into RAM, either for better performance or for errata workarounds.
+ CONFIG_STACK_ALIGNMENT - Set if the your application has specific
+ stack alignment requirements (may not be supported
+ in all architectures).
+ CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+ This is the thread that (1) performs the inital boot of the system up
+ to the point where user_start() is spawned, and (2) there after is the
+ IDLE thread that executes only when there is no other thread ready to
+ run.
+ CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+ for the main user thread that begins at the user_start() entry point.
+ CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
+ CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
+ CONFIG_HEAP_BASE - The beginning of the heap
+ CONFIG_HEAP_SIZE - The size of the heap
+
+appconfig -- This is another configuration file that is specific to the
+ application. This file is copied into the application build directory
+ when NuttX is configured. See ../apps/README.txt for further details.
+
+setenv.sh -- This is a script that you can include that will be installed at
+ the toplevel of the directory structure and can be sourced to set any
+ necessary environment variables. You will most likely have to customize the
+ default setenv.sh script in order for it to work correctly in your
+ environment.
+
+Supported Boards
+^^^^^^^^^^^^^^^^
+
+configs/amber
+ This is placeholder for the SoC Robotics Amber Web Server that is based
+ on the Atmel AVR ATMega128 MCU. There is not much there yet and what is
+ there is untested due to tool-related issues.
+
+configs/avr32dev1
+ This is a port of NuttX to the Atmel AVR32DEV1 board. That board is
+ based on the Atmel AT32UC3B0256 MCU and uses a specially patched
+ version of the GNU toolchain: The patches provide support for the
+ AVR32 family. That patched GNU toolchain is available only from the
+ Atmel website. STATUS: This port is functional but very basic. There
+ are configurations for NSH and the OS test.
+
+configs/c5471evm
+ This is a port to the Spectrum Digital C5471 evaluation board. The
+ TMS320C5471 is a dual core processor from TI with an ARM7TDMI general
+ purpose processor and a c54 DSP. It is also known as TMS320DA180 or just DA180.
+ NuttX runs on the ARM core and is built with a GNU arm-elf toolchain*.
+ This port is complete and verified.
+
+configs/compal_e88 and compal_e99
+ These directories contain the board support for compal e88 and e99 phones.
+ These ports are based on patches contributed by Denis Carikli for both the
+ compal e99 and e88. The patches were made by Alan Carvalho de Assis and
+ Denis Carikli using the Stefan Richter's Osmocom-bb patches.
+
+configs/demo9s12ne64
+ Freescale DMO9S12NE64 board based on the MC9S12NE64 hcs12 cpu. This
+ port uses the m9s12x GCC toolchain. STATUS: (Still) under development; it
+ is code complete but has not yet been verified.
+
+configs/ea3131
+ Embedded Artists EA3131 Development board. This board is based on the
+ an NXP LPC3131 MCU. This OS is built with the arm-elf toolchain*.
+ STATUS: This port is complete and mature.
+
+configs/ea3152
+ Embedded Artists EA3152 Development board. This board is based on the
+ an NXP LPC3152 MCU. This OS is built with the arm-elf toolchain*.
+ STATUS: This port is has not be exercised well, but since it is
+ a simple derivative of the ea3131, it should be fully functional.
+
+configs/eagle100
+ Micromint Eagle-100 Development board. This board is based on the
+ an ARM Cortex-M3 MCU, the Luminary LM3S6918. This OS is built with the
+ arm-elf toolchain*. STATUS: This port is complete and mature.
+
+configs/ekk-lm3s9b96
+ TI/Stellaris EKK-LM3S9B96 board. This board is based on the
+ an EKK-LM3S9B96 which is a Cortex-M3.
+
+configs/ez80f0910200kitg
+ ez80Acclaim! Microcontroller. This port use the Zilog ez80f0910200kitg
+ development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+configs/ez80f0910200zco
+ ez80Acclaim! Microcontroller. This port use the Zilog ez80f0910200zco
+ development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+configs/fire-stm32v2
+ A configuration for the M3 Wildfire STM32 board. This board is based on the
+ STM32F103VET6 chip. See http://firestm32.taobao.com
+
+configs/hymini-stm32v
+ A configuration for the HY-Mini STM32v board. This board is based on the
+ STM32F103VCT chip.
+
+configs/kwikstik-k40.
+ Kinetis K40 Cortex-M4 MCU. This port uses the FreeScale KwikStik-K40
+ development board.
+
+configs/lincoln60
+ NuttX port to the Micromint Lincoln 60 board.
+
+configs/lm3s6432-s2e
+ Stellaris RDK-S2E Reference Design Kit and the MDL-S2E Ethernet to
+ Serial module.
+
+configs/lm3s6965-ek
+ Stellaris LM3S6965 Evaluation Kit. This board is based on the
+ an ARM Cortex-M3 MCU, the Luminary/TI LM3S6965. This OS is built with the
+ arm-elf toolchain*. STATUS: This port is complete and mature.
+
+configs/lm3s8962-ek
+ Stellaris LMS38962 Evaluation Kit.
+
+configs/lpcxpresso-lpc1768
+ Embedded Artists base board with NXP LPCExpresso LPC1768. This board
+ is based on the NXP LPC1768. The Code Red toolchain is used by default.
+ STATUS: Under development.
+
+configs/lpc4330-xplorer
+ NuttX port to the LPC4330-Xplorer board from NGX Technologies featuring
+ the NXP LPC4330FET100 MCU
+
+configs/m68322evb
+ This is a work in progress for the venerable m68322evb board from
+ Motorola. This OS is also built with the arm-elf toolchain*. STATUS:
+ This port was never completed.
+
+configs/mbed
+ The configurations in this directory support the mbed board (http://mbed.org)
+ that features the NXP LPC1768 microcontroller. This OS is also built
+ with the arm-elf toolchain*. STATUS: Contributed.
+
+configs/mcu123-lpc214x
+ This port is for the NXP LPC2148 as provided on the mcu123.com
+ lpc214x development board. This OS is also built with the arm-elf
+ toolchain*. The port supports serial, timer0, spi, and usb.
+
+configs/micropendous3
+ This is a port to the Opendous Micropendous 3 board. This board may
+ be populated with either an AVR AT90USB646, 647, 1286, or 1287 MCU.
+ Support is configured for the AT90USB647.
+
+configs/mirtoo
+ This is the port to the DTX1-4000L "Mirtoo" module. This module uses MicroChip
+ PIC32MX250F128D. See http://www.dimitech.com/ for further information.
+
+configs/mx1ads
+ This is a port to the Motorola MX1ADS development board. That board
+ is based on the Freescale i.MX1 processor. The i.MX1 is an ARM920T.
+ STATUS: This port is nearly code complete but was never fully
+ integrated due to tool-related issues.
+
+configs/ne64badge
+ Future Electronics Group NE64 /PoE Badge board based on the
+ MC9S12NE64 hcs12 cpu. This port uses the m9s12x GCC toolchain.
+ STATUS: Under development. The port is code-complete but has
+ not yet been fully tested.
+
+configs/ntosd-dm320
+ This port uses the Neuros OSD v1.0 Dev Board with a GNU arm-elf
+ toolchain*: see
+
+ http://wiki.neurostechnology.com/index.php/OSD_1.0_Developer_Home
+
+ There are some differences between the Dev Board and the currently
+ available commercial v1.0 Boards. See
+
+ http://wiki.neurostechnology.com/index.php/OSD_Developer_Board_v1
+
+ NuttX operates on the ARM9EJS of this dual core processor.
+ STATUS: This port is code complete, verified, and included in the
+ NuttX 0.2.1 release.
+
+configs/nucleus2g
+ This port uses the Nucleus 2G board (with Babel CAN board). This board
+ features an NXP LPC1768 processor. See the 2G website (http://www.2g-eng.com/)
+ for more information about the Nucleus 2G.
+
+configs/olimex-lpc1766stk
+ This port uses the Olimex LPC1766-STK board and a GNU GCC toolchain* under
+ Linux or Cygwin. STATUS: Complete and mature.
+
+configs/olimex-lpc2378
+ This port uses the Olimex-lpc2378 board and a GNU arm-elf toolchain* under
+ Linux or Cygwin. STATUS: ostest and NSH configurations available.
+ This port for the NXP LPC2378 was contributed by Rommel Marcelo.
+
+configs/olimex-stm32-p107
+ This port uses the Olimex STM32-P107 board (STM32F107VC) and a GNU arm-elf
+ toolchain* under Linux or Cygwin. See the https://www.olimex.com/dev/stm32-p107.html
+ for further information. Contributed by Max Holtzberg. STATUS: Configurations
+ for the basic OS test and NSH are available and verified.
+
+configs/olimex-strp711
+ This port uses the Olimex STR-P711 board and a GNU arm-elf toolchain* under
+ Linux or Cygwin. See the http://www.olimex.com/dev/str-p711.html" for
+ further information. STATUS: Configurations for the basic OS test and NSH
+ are complete and verified.
+
+configs/pcblogic-pic32mx
+ This is the port of NuttX to the PIC32MX board from PCB Logic Design Co.
+ This board features the MicroChip PIC32MX460F512L.
+ The board is a very simple -- little more than a carrier for the PIC32
+ MCU plus voltage regulation, debug interface, and an OTG connector.
+ STATUS: Code complete but testing has been stalled due to tool related problems
+ (PICkit 2 does not work with the PIC32).
+
+configs/pic32-starterkit
+
+ This directory contains the port of NuttX to the Microchip PIC32 Ethernet
+ Starter Kit (DM320004) with the Multimedia Expansion Board (MEB, DM320005).
+ See www.microchip.com for further information.
+
+configs/pic32mx7mmb
+
+ This directory will (eventually) contain the port of NuttX to the
+ Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
+ http://www.mikroe.com/ for further information.
+
+ STATUS: Basic OS test configuration is in place, but the board does not boot.
+ It looks like I will need an ICD3 in order to debug the code (PICkit3
+ doesn't work for debug with this board). This effort is temporarily stalled.
+
+configs/pjrc-8051
+ 8051 Microcontroller. This port uses the PJRC 87C52 development system
+ and the SDCC toolchain. This port is not quite ready for prime time.
+
+configs/qemu-i486
+
+ Port of NuttX to QEMU in i486 mode. This port will also run on real i486
+ hardwared (Google the Bifferboard).
+
+configs/rgmp
+ RGMP stands for RTOS and GPOS on Multi-Processor. RGMP is a project for
+ running GPOS and RTOS simultaneously on multi-processor platforms. You can
+ port your favorite RTOS to RGMP together with an unmodified Linux to form a
+ hybrid operating system. This makes your application able to use both RTOS
+ and GPOS features.
+
+ See http://rgmp.sourceforge.net/wiki/index.php/Main_Page for further information
+ about RGMP.
+
+configs/sam3u-ek
+ The port of NuttX to the Atmel SAM3U-EK development board.
+
+configs/sim
+ A user-mode port of NuttX to the x86 Linux platform is available.
+ The purpose of this port is primarily to support OS feature development.
+ This port does not support interrupts or a real timer (and hence no
+ round robin scheduler) Otherwise, it is complete.
+
+configs/shenzhou
+ This is the port of NuttX to the Shenzhou development board from
+ www.armjishu.com. This board features the STMicro STM32F107VCT MCU.
+
+configs/skp16c26
+ Renesas M16C processor on the Renesas SKP16C26 StarterKit. This port
+ uses the GNU m32c toolchain. STATUS: The port is complete but untested
+ due to issues with compiler internal errors.
+
+configs/stm3210e-eval
+ STMicro STM3210E-EVAL development board based on the STMicro STM32F103ZET6
+ microcontroller (ARM Cortex-M3). This port uses the GNU Cortex-M3
+ toolchain.
+
+configs/stm3220g-eval
+ STMicro STM3220G-EVAL development board based on the STMicro STM32F407IG
+ microcontroller (ARM Cortex-M3).
+
+configs/stm3240g-eval
+ STMicro STM3240G-EVAL development board based on the STMicro STM32F103ZET6
+ microcontroller (ARM Cortex-M4 with FPU). This port uses a GNU Cortex-M4
+ toolchain (such as CodeSourcery).
+
+configs/stm32f4discovery
+ STMicro STM32F4-Discovery board boased on the STMIcro STM32F407VGT6 MCU.
+
+configs/sure-pic32mx
+ The "Advanced USB Storage Demo Board," Model DB-DP11215, from Sure
+ Electronics (http://www.sureelectronics.net/). This board features
+ the MicroChip PIC32MX440F512H. See also
+ http://www.sureelectronics.net/goods.php?id=1168 for further
+ information about the Sure DB-DP11215 board.
+
+configs/teensy
+ This is the port of NuttX to the PJRC Teensy++ 2.0 board. This board is
+ developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
+ on an Atmel AT90USB1286 MCU.
+
+configs/twr-k60n512
+ Kinetis K60 Cortex-M4 MCU. This port uses the FreeScale TWR-K60N512
+ development board.
+
+configs/ubw32
+
+ This is the port to the Sparkfun UBW32 board. This port uses the original v2.4
+ board which is based on the MicroChip PIC32MX460F512L. See
+ http://www.sparkfun.com/products/8971. This older version has been replaced
+ with this board http://www.sparkfun.com/products/9713. See also
+ http://www.schmalzhaus.com/UBW32/.
+
+configs/us7032evb1
+ This is a port of the Hitachi SH-1 on the Hitachi SH-1/US7032EVB1 board.
+ STATUS: Work has just began on this port.
+
+configs/vsn
+ ISOTEL NetClamps VSN V1.2 ready2go sensor network platform based on the
+ STMicro STM32F103RET6. Contributed by Uros Platise. See
+ http://isotel.eu/NetClamps/
+
+configs/xtrs
+ TRS80 Model 3. This port uses a vintage computer based on the Z80.
+ An emulator for this computer is available to run TRS80 programs on a
+ linux platform (http://www.tim-mann.org/xtrs.html).
+
+configs/z16f2800100zcog
+ z16f Microcontroller. This port use the Zilog z16f2800100zcog
+ development kit and the Zilog ZDS-II Windows command line tools. The
+ development environment is Cygwin under WinXP.
+
+configs/z80sim
+ z80 Microcontroller. This port uses a Z80 instruction set simulator.
+ That simulator can be found in the NuttX SVN at
+ http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/misc/sims/z80sim.
+ This port also uses the SDCC toolchain (http://sdcc.sourceforge.net/")
+ (verified with version 2.6.0).
+
+configs/z8encore000zco
+ z8Encore! Microcontroller. This port use the Zilog z8encore000zco
+ development kit, Z8F6403 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+configs/z8f64200100kit
+ z8Encore! Microcontroller. This port use the Zilog z8f64200100kit
+ development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line
+ tools. The development environment is Cygwin under WinXP.
+
+Configuring NuttX
+^^^^^^^^^^^^^^^^^
+
+Configuring NuttX requires only copying
+
+ configs/<board-name>/<config-dir>/Make.def to ${TOPDIR}/Make.defs
+ configs/<board-name>/<config-dir>/setenv.sh to ${TOPDIR}/setenv.sh
+ configs/<board-name>/<config-dir>/defconfig to ${TOPDIR}/.config
+
+And if configs/<board-name>/<config-dir>/appconfig exists in the board
+configuration directory:
+
+ Copy configs/<board-name>/<config-dir>/appconfig to <app-dir>/.config
+ echo "APPS_LOC=\"<app-dir>\"" >> "${TOPDIR}/.config"
+
+tools/configure.sh
+ There is a script that automates these steps. The following steps will
+ accomplish the same configuration:
+
+ cd tools
+ ./configure.sh <board-name>/<config-dir>
+
+And if configs/<board-name>/<config-dir>/appconfig exists and your
+application directory is not in the standard loction (../apps), then
+you should also specify the location of the application directory on the
+command line like:
+
+ cd tools
+ ./configure.sh -a <app-dir> <board-name>/<config-dir>
+
+Building Symbol Tables
+^^^^^^^^^^^^^^^^^^^^^^
+
+Symbol tables are needed at several of the binfmt interfaces in order to bind
+a module to the base code. These symbol tables can be tricky to create and
+will probably have to be tailored for any specific application, balancing
+the number of symbols and the size of the symbol table against the symbols
+required by the applications.
+
+The top-level System.map file is one good source of symbol information
+(which, or course, was just generated from the top-level nuttx file
+using the GNU 'nm' tool).
+
+There are also common-separated value (CSV) values in the source try that
+provide information about symbols. In particular:
+
+ nuttx/syscall/syscall.csv - Describes the NuttX RTOS interface, and
+ nuttx/lib/lib.csv - Describes the NuttX C library interface.
+
+There is a tool at nuttx/tools/mksymtab that will use these CSV files as
+input to generate a generic symbol table. See nuttx/tools/README.txt for
+more information about using the mksymtab tool.
diff --git a/nuttx/configs/amber/Kconfig b/nuttx/configs/amber/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/amber/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/amber/README.txt b/nuttx/configs/amber/README.txt
new file mode 100644
index 000000000..9ef22917e
--- /dev/null
+++ b/nuttx/configs/amber/README.txt
@@ -0,0 +1,502 @@
+README
+^^^^^
+
+This is the README file for the port of NuttX to the Amber Web Server from
+SoC Robotics (http://www.soc-robotics.com/index.htm). The
+Amber Web Server is based on an Atmel ATMega128. As of this writing,
+documentation for the Amber Web Server board is available here:
+
+http://www.soc-robotics.com/product/Amber_Specs/Amber_Processor.html
+
+and
+
+http://www.soc-robotics.com/pdfs/Amber%201-5a%20Hardware%20Reference%20Guide.pdf
+
+Contents
+^^^^^^^^
+
+ o Amber Web Server Features
+ o Pin Connections
+ o Atmel AVRISP mkII Connection
+ o Toolchains
+ o Windows Native Toolchains
+ o NuttX buildroot Toolchain
+ o avr-libc
+ o Amber Web Server Configuration Options
+ o Configurations
+
+Amber Web Server Features
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ o 17.56MHz ATmega128 Atmel 8bit AVR RISC Processor
+ o 128Kbyte Flash
+ o 64Kbyte RAM
+ o 10BaseT Ethernet Port
+ o High Speed Serial Port
+ o 8Ch 10bit Analog Input port
+ o 16 Digital IO ports
+ o Expansion bus for daughter cards
+ o LED status indicators
+ o ISP Programming port
+ o 7-14VDC input
+ o Power via Ethernet port
+
+Pin Connections (PCB Rev 1.5a)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ -------------------- -----------------------------
+ ATMega128 Pinout Amber board connection
+ -------------------- -----------------------------
+ (left)
+ 1 PEN Pulled-up
+ 2 PE0 (RXD0/PDI) MAX202ECWED T1IN or J7-1, ISP-PDI (via 74HC5053), J5-26
+ 3 PE1 (TXD0/PDO) MAX202ECWED A1OUT or J7-9, ISP-PDO (via 74HC5053), J5-25
+ 4 PE2 (XCK0/AIN0) MAX202ECWED T2IN, J5-24
+ 5 PE3 (OC3A/AIN1) MAX202ECWED A2OUT, J5-23
+ 6 PE4 (OC3B/INT4) J5-22
+ 7 PE5 (OC3C/INT5) J5-21, RTL8019AS INT 0, TP5 PE5
+ 8 PE6 (T3/INT6) J5-20
+ 9 PE7 (ICP3/INT7) J5-19
+ 10 PB0 (SS) Pull up of SS SPI master
+ 11 PB1 (SCK) J7-7, ISP_SCK (via 74HC4053) and AT45D011 SCK, J5-17
+ 12 PB2 (MOSI) AT45D011 SI. J5-16
+ 13 PB3 (MISO) AT45D011 SO, J5-15
+ 14 PB4 (OC0) AT45D011 CS\, J5-14
+ 15 PB5 (OC1A) J5-13
+ 16 PB6 (OC1B) J5-12
+ (bottom)
+ 17 PB7 (OC2/OC1C) J5-11
+ 18 PG3/TOSC2 32.768KHz XTAL
+ 19 PG4/TOSC1 32.768KHz XTAL
+ 20 RESET RESET
+ 21 VCC
+ 22 GND GND
+ 23 XTAL2 14.7456MHz XTAL
+ 24 XTAL1 14.7456MHz XTAL
+ 25 PD0 (SCL/INT0) J5-10
+ 26 PD1 (SDA/INT1) J5-9
+ 27 PD2 (RXD1/INT2) J5-8, MAX488CSA RO (RS-485)
+ 28 PD3 (TXD1/INT3) J5-7, MAX488CSA DI (RS-485)
+ 29 PD4 (ICP1) J5-6
+ 30 PD5 (XCK1) J5-5
+ 31 PD6 (T1) J5-4
+ 32 PD7 (T2) J5-3
+ (left)
+ 48 PA3 (AD3) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 47 PA4 (AD4) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 46 PA5 (AD5) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 45 PA6 (AD6) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 44 PA7 (AD7) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 43 PG2 (ALE) J5-1, 74HC5730, 62246DLP-7, RTL8019AS
+ 42 PC7 (A15) TP4 A15, J5-27, 74HC5730
+ 41 PC6 (A14) J5-28, 74HC5730, 62246DLP-7, RTL8019AS
+ 40 PC5 (A13) J5-29, 74HC5730, 62246DLP-7, RTL8019AS
+ 39 PC4 (A12) J5-30, 74HC5730, 62246DLP-7, RTL8019AS
+ 38 PC3 (A11) J5-31, 74HC5730, 62246DLP-7, RTL8019AS
+ 37 PC2 (A10) J5-32, 74HC5730, 62246DLP-7, RTL8019AS
+ 36 PC1 (A9) J5-33, 74HC5730, 62246DLP-7, RTL8019AS
+ 35 PC0 (A8) J5-34, 74HC5730, 62246DLP-7, RTL8019AS
+ 34 PG1 (RD) TP2 RD\, J5-52, 62246DLP-7, RTL8019AS
+ 33 PG0 (WR) TP3 WR\, J5-51, 62246DLP-7, RTL8019AS
+ (top)
+ 64 AVCC
+ 63 GND GND
+ 62 AREF (analog supply)
+ 61 PF0 (ADC0) J6-5, PDV-P9 Light Sensor
+ 60 PF1 (ADC1) J6-7, Thermister
+ 59 PF2 (ADC2) J6-9, MXA2500GL Dual Axis Accesserometer, AOUTX
+ 58 PF3 (ADC3) J6-11, MXA2500GL Dual Axis Accesserometer, AOUTY
+ 57 PF4 (ADC4/TCK) J6-13, MXA2500GL Dual Axis Accesserometer, TOUT
+ 56 PF5 (ADC5/TMS) J6-15
+ 55 PF6 (ADC6/TDO) J6-17
+ 54 PF7 (ADC7/TDI) J6-19
+ 53 GND GND
+ 52 VCC
+ 51 PA0 (AD0) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 50 PA1 (AD1) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+ 49 PA2 (AD2) J5-?, 74HC5730, 62246DLP-7, RTL8019AS
+
+Switches and Jumpers
+^^^^^^^^^^^^^^^^^^^^
+ISP/UART0
+ JP1 - DTE/DCE selection
+ JP2 -
+ JP5 -
+ J11 - STK500 Enable
+
+ADC
+ JP8 -
+ JP9 -
+
+Networking
+ JP10 -
+
+RS-485
+ J8 -
+ J9 -
+ J10 -
+
+Atmel AVRISP mkII Connection
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ ISP6PIN Header
+ --------------
+
+ 1 2
+ MISO o o VCC
+ SCK o o MOSI
+ RESET\ o o GND
+
+ (ISP10PIN Connector)
+ ------------------- -------------------------
+
+ 1 2
+ MOSI o o Vcc - ISP-PDI: PE0/PDI/RX0 via 74HC5053
+ LED o o GND - ISP-PROG: J11/GND, to 74HC5053 and LED
+ RESET\ o o GND - to 74HC505
+ SCK o o GND - ISP_SCK: SCK, PB0/SS\
+ MISO o o GND - ISP-PDO: PE1/PD0/TX0 via 74HC5053
+
+ Board Orientation
+
+ |
+ | +-----+
+ | + O O |
+ | + O O |
+ | + O O
+ | + O O |
+ | + O x | PIN 1
+ | +-----+
+ |
+
+ AVRISP mkII Connection to 10-pin Header
+ -------------------------------------------
+ 10PIN Header 6PIN Header
+ --------------------- ---------------------
+ Pin 1 MOSI Pin 4 MOSI
+ Pin 2 Vcc Pin 2 Vcc
+ Pin 3 LED Controlled via J11
+ Pin 4 GND Pin 6 GND
+ Pin 5 RESET\ Pin 5 RESET\
+ Pin 6 GND N/C
+ Pin 7 SCK Pin 3 SCK
+ Pin 8 GND N/C
+ Pin 9 MISO Pin 1 MISO
+ Pin 10 GND N/C
+
+Toolchains
+^^^^^^^^^^
+
+Buildroot:
+
+ There is a DIY buildroot version for the AVR boards here:
+ http://sourceforge.net/projects/nuttx/files/buildroot/. See the
+ following section for details on building this toolchain.
+
+ It is assumed in some places that buildroot toolchain is available
+ at ../misc/buildroot/build_avr. Edit the setenv.sh file if
+ this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT=y is set in your
+ .config file.
+
+WinAVR:
+
+ For Cygwin development environment on Windows machines, you can use
+ WinAVR: http://sourceforge.net/projects/winavr/files/
+
+ It is assumed in some places that WinAVR is installed at C:/WinAVR. Edit the
+ setenv.sh file if this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_WINAVR=y is set in your
+ .config file.
+
+ WARNING: There is an incompatible version of cygwin.dll in the WinAVR/bin
+ directory! Make sure that the path to the correct cygwin.dll file precedes
+ the path to the WinAVR binaries!
+
+Linux:
+
+ For Linux, there are widely available avr-gcc packages. On Ubuntu, use:
+ sudo apt-get install gcc-avr gdb-avr avr-libc
+
+ After configuring NuttX, make sure that CONFIG_AVR_LINUXGCC=y is set in your
+ .config file.
+
+Windows Native Toolchains
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ The WinAVR toolchain is a Windows native toolchain. There are several
+ limitations to using a Windows native toolchain in a Cygwin environment.
+ The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath'
+ utility but you might easily find some new path problems. If so, check
+ out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic
+ links are used in Nuttx (e.g., include/arch). The make system works
+ around these problems for the Windows tools by copying directories
+ instead of linking them. But this can also cause some confusion for
+ you: For example, you may edit a file in a "linked" directory and find
+ that your changes had no effect. That is because you are building the
+ copy of the file in the "fake" symbolic directory. If you use a
+ Windows toolchain, you should get in the habit of making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This
+ is because the dependencies are generated using Windows pathes which do
+ not work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native
+ toolchains. That support can be enabled by modifying your Make.defs
+ file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are
+ not building on C:), then you may need to modify tools/mkdeps.sh
+
+ An additional issue with the WinAVR toolchain, in particular, is that it
+ contains an incompatible version of the Cygwin DLL in its bin/ directory.
+ You must take care that the correct Cygwin DLL is used.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ If NuttX buildroot toolchain source tarball cne can be downloaded from the
+ NuttX SourceForge download site (https://sourceforge.net/projects/nuttx/files/).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh amber/<sub-dir>
+
+ NOTE: you also must copy avr-libc header files into the NuttX include
+ directory with command perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/avr-defconfig-4.5.2 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a toolchain for Cygwin under Windows.
+
+avr-libc
+^^^^^^^^
+
+Header Files
+
+ In any case, header files from avr-libc are required: http://www.nongnu.org/avr-libc/.
+ A snapshot of avr-lib is included in the WinAVR installation. For Linux
+ development platforms, avr-libc package is readily available (and would
+ be installed in the apt-get command shown above). But if you are using
+ the NuttX buildroot configuration on Cygwin, then you will have to build
+ get avr-libc from binaries.
+
+Header File Installation
+
+ The NuttX build will required that the AVR header files be available via
+ the NuttX include directory. This can be accomplished by either copying
+ the avr-libc header files into the NuttX include directory:
+
+ cp -a <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+ Or simply using a symbolic link:
+
+ ln -s <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+Build Notes:
+
+ It may not necessary to have a built version of avr-lib; only header files
+ are required. Bu if you choose to use the optimized libraru functions of
+ the flowing point library, then you may have to build avr-lib from sources.
+ Below are instructions for building avr-lib from fresh sources:
+
+ 1. Download the avr-libc package from:
+
+ http://savannah.nongnu.org/projects/avr-libc/
+
+ I am using avr-lib-1.7.1.tar.bz2
+
+ 2. Upack the tarball and cd into the
+
+ tar jxf avr-lib-1.7.1.tar.bz2
+ cd avr-lib-1.7.1
+
+ 3. Configure avr-lib. Assuming that WinAVR is installed at the following
+ loction:
+
+ export PATH=/cygdrive/c/WinAVR/bin:$PATH
+ ./configure --build=`./config.guess` --host=avr
+
+ This takes a *long* time.
+
+ 4. Make avr-lib.
+
+ make
+
+ This also takes a long time because it generates variants for nearly
+ all AVR chips.
+
+ 5. Install avr-lib.
+
+ make install
+
+Amber Web Server Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=avr
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_AVR=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ATMEGA=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=atmega
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_ATMEGA128=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=amber
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_AMBER=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM. One of:
+
+ CONFIG_DRAM_SIZE=(8*1024) - (8Kb)
+
+ CONFIG_DRAM_START - The start address of installed SRAM
+
+ CONFIG_DRAM_START=0x800100
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_AVR_INT0=n
+ CONFIG_AVR_INT1=n
+ CONFIG_AVR_INT2=n
+ CONFIG_AVR_INT3=n
+ CONFIG_AVR_INT4=n
+ CONFIG_AVR_INT5=n
+ CONFIG_AVR_INT6=n
+ CONFIG_AVR_INT7=n
+ CONFIG_AVR_WDT=n
+ CONFIG_AVR_TIMER0=n
+ CONFIG_AVR_TIMER1=n
+ CONFIG_AVR_TIMER2=n
+ CONFIG_AVR_TIMER3=n
+ CONFIG_AVR_SPI=n
+ CONFIG_AVR_USART0=y
+ CONFIG_AVR_USART1=n
+ CONFIG_AVR_ADC=n
+ CONFIG_AVR_ANACOMP=n
+ CONFIG_AVR_TWI=n
+
+ If the watchdog is enabled, this specifies the initial timeout. Default
+ is maximum supported value.
+
+ CONFIG_WDTO_15MS
+ CONFIG_WDTO_30MS
+ CONFIG_WDTO_60MS
+ CONFIG_WDTO_120MS
+ CONFIG_WDTO_1250MS
+ CONFIG_WDTO_500MS
+ CONFIG_WDTO_1S
+ CONFIG_WDTO_2S
+ CONFIG_WDTO_4S
+ CONFIG_WDTO_8S
+
+ ATMEGA specific device driver settings
+
+ CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
+ console and ttys0 (default is the USART0).
+ CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
+ CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_USARTn_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Amber Web Server configuration is maintained in a sudirectory and can
+be selected as follow:
+
+ cd tools
+ ./configure.sh amber/<subdir>
+ cd -
+ . ./setenv.sh
+
+NOTE: You must also copy avr-libc header files, perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+Where <subdir> is one of the following:
+
+ hello:
+ The simple apps/examples/hello "Hello, World!" example.
diff --git a/nuttx/configs/amber/hello/Make.defs b/nuttx/configs/amber/hello/Make.defs
new file mode 100644
index 000000000..bcf895152
--- /dev/null
+++ b/nuttx/configs/amber/hello/Make.defs
@@ -0,0 +1,150 @@
+############################################################################
+# configs/amber/hello/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR_WINAVR),y)
+ # WinAVR toolchain under Windows/Cygwin
+ CROSSDEV = avr-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=atmega128
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_LINUXGCC),y)
+ # GCC toolchain under Linux
+ CROSSDEV = avr-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=atmega128
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_BUILDROOT),y)
+ # NuttX buildroot GCC toolchain under Linux or Cygwin
+ CROSSDEV = avr-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=atmega128
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/amber/hello/appconfig b/nuttx/configs/amber/hello/appconfig
new file mode 100644
index 000000000..35d94bcd7
--- /dev/null
+++ b/nuttx/configs/amber/hello/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/amber/hello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/hello
+
diff --git a/nuttx/configs/amber/hello/defconfig b/nuttx/configs/amber/hello/defconfig
new file mode 100644
index 000000000..b148b1e0d
--- /dev/null
+++ b/nuttx/configs/amber/hello/defconfig
@@ -0,0 +1,416 @@
+############################################################################
+# configs/amber/hello/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_ATMEGA=y
+CONFIG_ARCH_CHIP="atmega"
+CONFIG_ARCH_CHIP_ATMEGA128=y
+CONFIG_ARCH_BOARD="amber"
+CONFIG_ARCH_BOARD_AMBER=y
+CONFIG_BOARD_LOOPSPERMSEC=800
+CONFIG_DRAM_SIZE=4096
+CONFIG_DRAM_START=0x800100
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_AVR_WINAVR=n
+CONFIG_AVR_LINUXGCC=n
+CONFIG_AVR_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_AVR_INT0=n
+CONFIG_AVR_INT1=n
+CONFIG_AVR_INT2=n
+CONFIG_AVR_INT3=n
+CONFIG_AVR_INT4=n
+CONFIG_AVR_INT5=n
+CONFIG_AVR_INT6=n
+CONFIG_AVR_INT7=n
+CONFIG_AVR_TIMER0=n
+CONFIG_AVR_TIMER1=n
+CONFIG_AVR_TIMER2=n
+CONFIG_AVR_TIMER3=n
+CONFIG_AVR_SPI=n
+CONFIG_AVR_USART0=y
+CONFIG_AVR_USART1=n
+CONFIG_AVR_ADC=n
+CONFIG_AVR_ANACOMP=n
+CONFIG_AVR_TWI=n
+
+#
+# ATMega128 specific serial device driver settings
+#
+CONFIG_USART0_SERIAL_CONSOLE=y
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART0_BAUD=38400
+CONFIG_USART0_BITS=8
+CONFIG_USART0_PARITY=0
+CONFIG_USART0_2STOP=0
+
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART1_BAUD=38400
+CONFIG_USART1_BITS=8
+CONFIG_USART1_PARITY=0
+CONFIG_USART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="hello_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=16
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=4
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=4
+CONFIG_NFILE_STREAMS=4
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=1024
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/amber/hello/ld.script b/nuttx/configs/amber/hello/ld.script
new file mode 100644
index 000000000..af7eed6f3
--- /dev/null
+++ b/nuttx/configs/amber/hello/ld.script
@@ -0,0 +1,211 @@
+/**************************************************************************************
+ * configs/amber/hello/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/* Memory Regions *********************************************************************/
+/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * ATMEGA128* 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 4Kb | 0x0000 4Kb
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * *Memory configuration A
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 4K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/amber/hello/setenv.sh b/nuttx/configs/amber/hello/setenv.sh
new file mode 100755
index 000000000..094bad8b9
--- /dev/null
+++ b/nuttx/configs/amber/hello/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/amber/hello/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/amber/include/board.h b/nuttx/configs/amber/include/board.h
new file mode 100644
index 000000000..dba47cb95
--- /dev/null
+++ b/nuttx/configs/amber/include/board.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+ * configs/amber/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_AMBER_INCLUDE_BOARD_H
+#define __CONFIGS_AMBER_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */
+
+#define BOARD_XTAL_FREQ 14745600 /* 14.7456MHz crystal */
+#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 14.7456MHz */
+#define BOARD_TOSCK_CLOCK 32768 /* TOSC = 32.768KHz */
+
+/* LED definitions **********************************************************/
+/* The Amber Web Server has a reset switch and four LEDs. The LEDs indicate
+ * the status of power, programming state, Ethernet link status and reset
+ * status (Active). None are available for software use.
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_AMBER_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/amber/src/Makefile b/nuttx/configs/amber/src/Makefile
new file mode 100644
index 000000000..7b30e6ff6
--- /dev/null
+++ b/nuttx/configs/amber/src/Makefile
@@ -0,0 +1,97 @@
+############################################################################
+# configs/amber/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ASRCS =
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(CONFIG_ARCH_AVR32),y)
+ARCH_SUBDIR = avr32
+endif
+ifeq ($(CONFIG_ARCH_AVR),y)
+ARCH_SUBDIR = avr
+endif
+
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(TOPDIR)/sched}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
+else
+ CFLAGS += -I "$(TOPDIR)/sched"
+ CFLAGS += -I "$(ARCH_SRCDIR)/chip"
+ CFLAGS += -I "$(ARCH_SRCDIR)/common"
+ CFLAGS += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/amber/src/amber_internal.h b/nuttx/configs/amber/src/amber_internal.h
new file mode 100644
index 000000000..6e847bdec
--- /dev/null
+++ b/nuttx/configs/amber/src/amber_internal.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/amber/src/amber-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_AMBER_SRC_AMBER_INTERNAL_H
+#define __CONFIGS_AMBER_SRC_AMBER_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: atmega_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Amber Web Server.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
+EXTERN void weak_function atmega_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: atmega_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void atmega_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_AMBER_SRC_AMBER_INTERNAL_H */
diff --git a/nuttx/configs/amber/src/up_boot.c b/nuttx/configs/amber/src/up_boot.c
new file mode 100644
index 000000000..e21ab3b25
--- /dev/null
+++ b/nuttx/configs/amber/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/amber/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "atmega_internal.h"
+#include "amber_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All ATMega architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void up_boardinitialize(void)
+{
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function atmega_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
+ if (atmega_spiinitialize)
+ {
+ atmega_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ atmega_ledinit();
+#endif
+}
diff --git a/nuttx/configs/avr32dev1/Kconfig b/nuttx/configs/avr32dev1/Kconfig
new file mode 100644
index 000000000..3312fdfd4
--- /dev/null
+++ b/nuttx/configs/avr32dev1/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_AVR32DEV1
+endif
+
diff --git a/nuttx/configs/avr32dev1/README.txt b/nuttx/configs/avr32dev1/README.txt
new file mode 100644
index 000000000..68d019227
--- /dev/null
+++ b/nuttx/configs/avr32dev1/README.txt
@@ -0,0 +1,446 @@
+README
+^^^^^^
+
+This is the README file for the NuttX port to the Atmel AVR32DEV1 board.
+
+Contents
+^^^^^^^^
+
+ * GPIO Pin Configuration
+ * Serial Connection
+ * Toolchains
+ * Development Environment
+ * GNU Toolchains
+ * IDEs
+ - Makefile Build
+ - Native Build
+ * AVR32 Bootloader
+ - Boot Sequence
+ - Link Address
+ - Entering the ISP
+ - BatchISP
+ * Reset
+ * Make Tip
+ * AVR32DEV1 Configuration Options
+ * Configurations
+
+GPIO Pin Configuration
+^^^^^^^^^^^^^^^^^^^^^^
+
+The only GPIO pin usage is for LEDs (2) and Buttons (2):
+
+ PIN 13 PA7 LED1
+ PIN 14 PA8 LED2
+ PIN 24 PB2 KEY1
+ PIN 25 PB3 KEY2
+
+(See configs/avr32dev/src/avr32dev_internal.h). And also for
+crystals (4), JTAG (1), and USB (1):
+
+ PIN 30 PA11 XIN32
+ PIN 31 PA12 XOUT32
+ PIN 35 PA15 EVTO (JTAG)
+ PIN 39 PA18 X1IN
+ PIN 40 PA19 X1OUT
+ PIN 61 PA26 ID (USB)
+
+All GPIO pins are brought out through connectors J1 (PINS 33-64)
+and J2 (PINS 1-32).
+
+NOTE: There seems to be some difference in labeling for OSC0 and
+OSC1 between MCUZone.com and Atmel:
+
+ Oscillator pinout
+ -------------------------- --------------------
+ QFP48 QFP64 Pad Oscillator AVR32DEV1
+ PIN PIN PIN LABEL
+ ----- ----- ---- --------- --------------------
+ 30 39 PA18 XIN0 X1IN (12MHz)
+ 41 PA28 XIN1 PA28 (no crystal)
+ 22 30 PA11 XIN32 XIN32 (32KHz)
+ 31 40 PA19 XOUT0 X1OUT (12Mhz)
+ 42 PA29 XOUT1 PA29 (no crystal)
+ 23 31 PA12 XOUT32 XOUT32 (32 Khz)
+ ----- ----- ---- --------- --------------------
+
+NOTE 1: These crystal inputs/outputs are analog signals and my
+assumption is that they need no pin multiplexing setting to
+enable them for the external crystal function.
+
+NOTE 2: There is no support for OSC1.
+
+NOTE 3: There are solder pads for the 32KHz OSC32, but the
+crystal is not populated on my board. Therefore, the RTC will
+have to run from the (uncalibrated) RCOSC.
+
+Serial Connection
+^^^^^^^^^^^^^^^^^
+
+USART1 is the default USART1 used in the configuration files to
+provide a serial console (of course, that can be easily changed
+by editting the configuration file). The AVR32DEV1 board has no
+RS-232 drivers or connectors on board. I use an off-board MAX232
+module that I got on eBay (search for MAX232 if you want to find
+one). I connect the MAX232 board as follows:
+
+In configs/avr32dev/include/board.h:
+
+ #define PINMUX_USART1_RXD PINMUX_USART1_RXD_1
+ #define PINMUX_USART1_TXD PINMUX_USART1_TXD_1
+
+In arch/avr/src/at32uc3/at32uc3b_pinmux.h:
+
+ #define PINMUX_USART1_RXD_1 (GPIO_PERIPH | GPIO_FUNCD | GPIO_PORTA | 17)
+ #define PINMUX_USART1_TXD_1 (GPIO_PERIPH | GPIO_FUNCA | GPIO_PORTA | 23)
+
+PA17 and PA23 are avaiable from the AVR32DEV1:
+
+ FUNC GPIO PIN Header 16X2 (J1) MX232 Board
+ ---- ----- ----- ---------------- ------------
+ RXD PA17 PIN37 Pin 5 PIN4 RXD (5V TTL/CMOS)
+ TXD PA23 PIN47 Pin 15 PIN3 TXD (5V TTL/CMOS)
+ PIN2 GND
+ PIN1 VCC (5V)
+
+ Voltage on GPIO Pins with respect to Ground for TCK, RESET_N, PA03-PA08,
+ PA11-PA12, PA18-PA19, PA28-PA31............................-0.3 to 3.6V
+ Other Pins ............................................... -0.3 to 5.5V
+
+ I get the 5V from another USB port (using the 5V power cable that normally
+ provides the extra current needed by my USB IDE drive).
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchains
+^^^^^^^^^^^^^^
+
+Atmel Toolchain:
+
+ The build logic in these directories assume that you are using the GNU
+ toolchain with the Atmel patches. The patch file, pre-patched tool
+ sources,and pre-built binaries are available from the Atmel website.
+
+ CONFIG_AVR32_AVRTOOLSW=y # Use the windows version
+ CONFIG_AVR32_AVRTOOLSL=y # Ue the Linux version
+
+ NOTE: The NuttX builtroot cannot be used to build the AVR32 toolchain.
+ This is because the Atmel patches that add support for the AVR32 are not
+ included in the NuttX buildroot.
+
+WinAVR:
+
+ Another option for use under Windows is WinAVR:
+ http://sourceforge.net/projects/winavr/files/. WinAVR includes the
+ AVR32 toolchain as well as the AVR toolchain and various support
+ libraries and header files.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/avr/src/at32uc3,
+ arch/avr/src/common, arch/arm/src/avr, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/avr/src/avr3/up_nommuhead.S.
+
+AVR32 Bootloader
+^^^^^^^^^^^^^^^^
+
+ Boot Sequence
+ -------------
+
+ "An AVR UC3 part having the bootloader programmed resets as any other
+ part at 80000000h. Bootloader execution begins here. The bootloader
+ first performs the boot process to know whether it should start the
+ USB DFU ISP or the application. If the tested conditions indicate
+ that the USB DFU ISP should be started, then execution continues in
+ the bootloader area, i.e. between 80000000h and 80002000h, else
+ the bootloader launches the application at 80002000h."
+
+ Link Address
+ ------------
+
+ The linker scripts (ld.script) assume that you are using the DFU
+ bootloader. The bootloader resides at 0x8000:0000 and so the ld.script
+ files link the application to execute after the bootloader at
+ 0x8000:2000. To link so that NuttX boots directly without using the
+ bootloader, change the flash definition from:
+
+ flash (rxai!w) : ORIGIN = 0x80002000, LENGTH = 256K - 8K
+
+ to:
+ flash (rxai!w) : ORIGIN = 0x80000000, LENGTH = 256K
+
+ Or to use the MSC bootloader:
+
+ flash (rxai!w) : ORIGIN = 0x80008000, LENGTH = 256K - 32K
+
+ Entering the ISP
+ ----------------
+
+ In order to use the USB port to download the FLASH(ISP), you need to
+ use the S3(PA13) to make CPU return to boot status. In this mode, the
+ on chip bootloader will run, making the ISP possible.
+
+ BatchISP
+ --------
+
+ Unlike other Atmel parts, the AVR32 will not work with the FLIP GUI
+ program. Instead, you must use the command-line loader call BatchISP.
+ If need to download FLIP from the atmel.com website, install the USB
+ driver in the FLIP usb directory. Then in the bin directory where
+ you installed FLIP, you will also find batchisp.exe.
+
+ NOTE: The AVR32DEV1 setenv.sh files will add the path to the BatchISP
+ bin directory to the Cygwin PATH variable. If you use a different
+ version of FLIP or if you install FLIP in a different location, you
+ will need to modify the setenv.sh files.
+
+ Notes from "AVR32 UC3 USB DFU Bootloader" (doc7745.pdf)
+
+ "To launch BatchISP, open a command prompt. Windows or Cygwin command
+ prompt can be used provided that the bin folder of the FLIP installation
+ directory is in the PATH (Windows’ or Cygwin’s) environment variable.
+ When running BatchISP on AT32UC3xxxxx, the target part has to be specified
+ with -device at32uc3xxxxx and the communication port with -hardware usb.
+ Commands can then be placed after -operation. These commands are executed
+ in order. BatchISP options can be placed in a text file invoked using
+ -cmdfile rather than on the command line.
+
+ "BatchISP works with an internal ISP buffer per target memory. These ISP
+ buffers can be filled from several sources. All target operations (program,
+ verify, read) are performed using these buffers."
+
+ The following BatchISP command line will erase FLASH, write the nuttx binary
+ into FLASH, and reset the AVR32. This command line is available in the
+ script config/avr32dev1/tools/doisp.sh:
+
+ batchisp -device at32uc3b0256 -hardware usb -operation erase f memory flash \
+ blankcheck loadbuffer nuttx.elf program verify start reset 0
+
+ "BatchISP main commands available on AT32UC3xxxxx are:
+
+ - ASSERT { PASS | FAIL } changes the displayed results of the following
+ operations according to the expected behavior.
+ - ONFAIL { ASK | ABORT | RETRY | IGNORE } changes the interactive behavior
+ of BatchISP in case of failure.
+ - WAIT <Nsec> inserts a pause between two ISP operations.
+ - ECHO <comment> displays a message.
+ - ERASE F erases internal flash contents, except the bootloader.
+ - MEMORY { FLASH | SECURITY | CONFIGURATION | BOOTLOADER | SIGNATURE | USER }
+ selects a target memory on which to apply the following operations.
+ - ADDRANGE <addrMin> <addrMax> selects in the current target memory an
+ address range on which to apply the following operations.
+ - BLANKCHECK checks that the selected address range is erased.
+ - FILLBUFFER <data> fills the ISP buffer with a byte value.
+ - LOADBUFFER { <in_elffile> | <in_hexfile> } loads the ISP buffer from an
+ input file.
+ - PROGRAM programs the selected address range with the ISP buffer.
+ - VERIFY verifies that the selected address range has the same contents
+ as the ISP buffer.
+ - READ reads the selected address range to the ISP buffer.
+ - SAVEBUFFER <out_hexfile> { HEX386 | HEX86 } saves the ISP buffer to an
+ output file.
+ - START { RESET | NORESET } 0 starts the execution of the programmed
+ application with an optional hardware reset of the target.
+
+ "The AT32UC3xxxxx memories made available by BatchISP are:
+
+ - FLASH: This memory is the internal flash array of the target, including the
+ bootloader protected area. E.g. on AT32UC3A0512 (512-kB internal flash),
+ addresses from 0 to 0x7FFFF can be accessed in this memory.
+ - SECURITY: This memory contains only one byte. The least significant bit
+ of this byte reflects the value of the target Security bit which can only
+ be set to 1. Once set, the only accepted commands will be ERASE and START.
+ After an ERASE command, all commands are accepted until the end of the
+ non-volatile ISP session, even if the Security bit is set.
+ - CONFIGURATION: This memory contains one byte per target general-purpose
+ fuse bit. The least significant bit of each byte reflects the value of
+ the corresponding GP fuse bit.
+ - BOOTLOADER: This memory contains three bytes concerning the ISP: the ISP
+ version in BCD format without the major version number (always 1), the
+ ISP ID0 and the ISP ID1.
+ - SIGNATURE: This memory contains four bytes concerning the part: the product
+ manufacturer ID, the product family ID, the product ID and the product
+ revision.
+ - USER: This memory is the internal flash User page of the target, with
+ addresses from 0 to 0x1FF.
+
+ "For further details about BatchISP commands, launch batchisp -h or see the
+ help files installed with FLIP ..."
+
+Reset
+^^^^^
+
+ I don't trust the reset button -- if you reset and something weird happens,
+ try a full power cycle.
+
+Make Tip
+^^^^^^^^
+
+ Because this build uses a native Windows toolchain and the native Windows
+ tools do not understand Cygwin's symbolic links, the NuttX make system does
+ something weird: It copies the configuration directories instead of linking
+ to them (it could, perhaps, use the NTFS 'mklink' command, but it doesn't).
+
+ A consequence of this is that you can easily get confused when you edit
+ a file in one of the "linked" directories, re-build NuttX, and then not see your
+ changes when you run the program. That is because build is still using the
+ version of the file in the copied directory, not your modified file! To work
+ around this annoying behavior, do the following when you re-build:
+
+ make clean_context all <-- Remove and re-copy all of the directories, then make all
+ doisp.sh <-- Load the code onto the board.
+
+AVR32DEV1 Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=avr
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_AVR=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_AVR32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=at32uc3
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_AT32UC3B0256
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=avr32dev1 (for the AV32DEV1 board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_AVR32DEV1
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The AT32UC3B0256 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_AVR32_GPIOIRQ - GPIO interrupt support
+ CONFIG_AVR32_GPIOIRQSETA - Set of GPIOs on PORTA that support interrupts
+ CONFIG_AVR32_GPIOIRQSETB - Set of GPIOs on PORTB that support interrupts
+
+ CONFIG_AVR32_USARTn - Enable support for USARTn
+ CONFIG_AVR32_USARTn_RS232 - Configure USARTn as an RS232 interface.
+ CONFIG_AVR32_USARTn_SPI - Configure USARTn as an SPI interface.
+ CONFIG_AVR32_USARTn_RS485 - Configure USARTn as an RS485 interface.
+ CONFIG_AVR32_USARTn_MAN - Configure USARTn as an Manchester interface.
+ CONFIG_AVR32_USARTn_MODEM - Configure USARTn as an Modem interface.
+ CONFIG_AVR32_USARTn_IRDA - Configure USARTn as an IRDA interface.
+ CONFIG_AVR32_USARTn_ISO786 - Configure USARTn as an ISO786 interface.
+
+ AT32UC3B0256 specific device driver settings
+
+ CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
+ console and ttys0 (default is the USART0).
+ CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
+ CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_USARTn_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Stellaris LM3S6965 Evaluation Kit configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh avr32dev1/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interface.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+ NOTE: Round-robin scheduling is disabled in this test because
+ the RR test in examples/ostest declares data structures that
+ are too large for the poor little uc3 SRAM.
+
+
diff --git a/nuttx/configs/avr32dev1/include/board.h b/nuttx/configs/avr32dev1/include/board.h
new file mode 100644
index 000000000..008c5ffe3
--- /dev/null
+++ b/nuttx/configs/avr32dev1/include/board.h
@@ -0,0 +1,257 @@
+/************************************************************************************
+ * configs/avr32dev1/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <nuttx/irq.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Oscillator setup: RCOSC, OSC32, OSC0, OSC1. Only RCOSC, OSC0, or PLL0 can drive
+ * the main clock.
+ */
+
+/* The RCOSC frequency needs to be calibrated! */
+
+#define AVR32_FRCOSC 115000 /* RCOSC frequency in Hz. 115KHz nominal */
+
+#define AVR32_FOSC32 32768 /* OSC32 frequency in Hz */
+#define AVR32_OSC32STARTUP 3 /* OSC32 startup time in RCOSC periods */
+
+#define AVR32_FOSC0 12000000 /* OSC0 frequency in Hz */
+#define AVR32_OSC0STARTUP 3 /* OSC0 startup time in RCOSC periods.
+
+/* #define AVR32_FOSC1 12000000 OSC1 frequency: Hz.
+ * #define AVR32_OSC1STARTUP 3 OSC1 startup time in RCOSC periods.
+ */
+
+/* PLL setup
+ *
+ * FOSC0 MUL DIV PLL DIV2_EN CPU_CLOCK PBA_CLOCK COMMENT
+ * (MHz) (MHz) (MHz) (MHz)
+ * 12 15 1 192 1 12 12
+ * 12 9 3 40 1 20 20 PLL out of spec
+ * 12 15 1 192 1 24 12
+ * 12 9 1 120 1 30 15
+ * 12 9 3 40 0 40 20 PLL out of spec
+ * 12 15 1 192 1 48 12
+ * 12 15 1 192 1 48 24
+ * 12 8 1 108 1 54 27
+ * 12 9 1 120 1 60 15
+ * 12 9 1 120 1 60 30
+ * 12 10 1 132 1 66 16.5
+ */
+
+#define AVR32_CLOCK_PLL0_OSC0 1
+#undef AVR32_CLOCK_PLL0_OSC1
+#define AVR32_PLL0_MUL 15
+#define AVR32_PLL0_DIV 1
+#define AVR32_PLL0_DIV2 1
+#define AVR32_PLL0_WBWM 0
+#define AVR32_PLL0_FREQ 192000000
+
+/* Set PLL1 @ 96 MHz from OSC0: 12MHz*(7+1)/1 = 96MHz */
+
+#define AVR32_CLOCK_PLL1_OSC0 1
+#undef AVR32_CLOCK_PLL1_OSC1
+#define AVR32_PLL1_MUL 7
+#define AVR32_PLL1_DIV 1
+#define AVR32_PLL1_DIV2 1
+#define AVR32_PLL1_WBWM 0
+#define AVR32_PLL1_FREQ 96000000
+
+/* Clock divider setup */
+
+#define AVR32_CKSEL_CPUDIV 0
+#define AVR32_CKSEL_HSBDIV 0
+#define AVR32_CKSEL_PBADIV 0
+#define AVR32_CKSEL_PBBDIV 0
+
+/* GCLK_USBB */
+
+#undef AVR32_CLOCK_USB_PLL0
+#define AVR32_CLOCK_USB_PLL1 1
+#undef AVR32_CLOCK_USB_OSC0
+#undef AVR32_CLOCK_USB_OSC1
+#define AVR32_CLOCK_USB_DIV 0
+
+/* Main Clock settup: Select OSC0 as the main clock.
+ *
+ * - A 12Mhz crystal is provided on he board for OSC0.
+ * - The AVR32DEV1 board has no support for OSC1.
+ * - There are pads for he 32Khz OSC32, but it is not populated on the
+ * board.
+ */
+
+#define AVR32_CLOCK_OSC0 1
+#undef AVR32_CLOCK_OSC1 /* Not supported */
+#undef AVR32_CLOCK_OSC32 /* Not populated */
+#undef AVR32_CLOCK_PLL0
+#undef AVR32_CLOCK_PLL1
+
+#define AVR32_CPU_CLOCK AVR32_FOSC0
+#define AVR32_PBA_CLOCK AVR32_FOSC0
+
+/* Pin muliplexing selecion *********************************************************/
+
+#define PINMUX_USART1_RXD PINMUX_USART1_RXD_1
+#define PINMUX_USART1_TXD PINMUX_USART1_TXD_1
+
+/* LED definitions ******************************************************************/
+/* The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins */
+
+ /* ON OFF */
+ /* LED1 LED2 LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF OFF OFF */
+#define LED_HEAPALLOCATE 0 /* OFF OFF OFF OFF */
+#define LED_IRQSENABLED 0 /* OFF OFF OFF OFF */
+#define LED_STACKCREATED 1 /* ON OFF OFF OFF */
+#define LED_INIRQ 2 /* ON ON ON OFF */
+#define LED_SIGNAL 2 /* ON ON ON OFF */
+#define LED_ASSERTION 2 /* ON ON ON OFF */
+#define LED_PANIC 2 /* ON ON ON OFF */
+
+/* Button definitions ***************************************************************/
+/* The AVR32DEV1 board has 3 BUTTONs, two of which can be sensed through GPIO pins. */
+
+#define BUTTON1 1 /* Bit 0: Button 1 */
+#define BUTTON2 2 /* Bit 1: Button 2 */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: avr32_boardinitialize
+ *
+ * Description:
+ * All AVR32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void avr32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * NOTE: Nothing in the "base" NuttX code calls up_buttoninit(). If you want button
+ * support in an application, your application startup code must call up_buttoninit()
+ * prior to calling any of the other button interfaces.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+
+/************************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * After up_buttoninit() has been called, up_buttons() may be called to collect
+ * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit
+ * associated with a button. See the BUTTON* definitions above for the meaning of
+ * each bit in the returned value.
+ *
+ ************************************************************************************/
+
+EXTERN uint8_t up_buttons(void);
+
+/************************************************************************************
+ * Name: up_irqbutton
+ *
+ * Description:
+ * This function may be called to register an interrupt handler that will be
+ * called when a button is depressed or released. The ID value is one of the
+ * BUTTON* definitions provided above. The previous interrupt handler address is
+ * returned (so that it may restored, if so desired).
+ *
+ * Configuration Notes:
+ * Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the overall GPIO
+ * IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or CONFIG_AVR32_GPIOIRQSETB must
+ * be enabled to select GPIOs to support interrupts on. For button support, bits
+ * 2 and 3 must be set in CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_AVR32_GPIOIRQ
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
+
diff --git a/nuttx/configs/avr32dev1/nsh/Make.defs b/nuttx/configs/avr32dev1/nsh/Make.defs
new file mode 100644
index 000000000..e2880edca
--- /dev/null
+++ b/nuttx/configs/avr32dev1/nsh/Make.defs
@@ -0,0 +1,146 @@
+############################################################################
+# configs/avr32dev1/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR32_AVRTOOLSW),y)
+ # AVR Tools under Windows
+ CROSSDEV = avr32-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mpart=uc3b0256
+endif
+ifeq ($(CONFIG_AVR32_AVRTOOLSL),y)
+ # AVR Tools under Linux
+ CROSSDEV = avr32-
+ ARCHCPUFLAGS = -mpart=uc3b0256
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -ffunction-sections -fdata-sections -fno-strict-aliasing
+endif
+
+ARCHCFLAGS = -fno-builtin -muse-rodata-section
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHNOPICFLAGS = -fno-pic
+ARCHPICFLAGS = -fpic
+ARCHALLCFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+ARCHALLCXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+
+CFLAGS = $(ARCHNOPICFLAGS) $(ARCHALLCFLAGS)
+CPICFLAGS = $(ARCHPICFLAGS) $(ARCHALLCFLAGS)
+CXXFLAGS = $(ARCHNOPICFLAGS) $(ARCHALLCXXFLAGS)
+CXXPICFLAGS = $(ARCHPICFLAGS) $(ARCHALLCXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(ARCHALLCFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+LDFLAGS += -nostartfiles -nodefaultlibs
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/avr32dev1/nsh/appconfig b/nuttx/configs/avr32dev1/nsh/appconfig
new file mode 100644
index 000000000..5933740d4
--- /dev/null
+++ b/nuttx/configs/avr32dev1/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/avr32dev1/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/avr32dev1/nsh/defconfig b/nuttx/configs/avr32dev1/nsh/defconfig
new file mode 100755
index 000000000..730d84391
--- /dev/null
+++ b/nuttx/configs/avr32dev1/nsh/defconfig
@@ -0,0 +1,426 @@
+############################################################################
+# configs/avr32dev1/nsh/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_AVR32=y
+CONFIG_ARCH_CHIP="at32uc3"
+CONFIG_ARCH_CHIP_AT32UC3B0256=y
+CONFIG_ENDIAN_BIG=y
+CONFIG_ARCH_BOARD="avr32dev1"
+CONFIG_ARCH_BOARD_AVR32DEV1=y
+CONFIG_BOARD_LOOPSPERMSEC=1140
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x00000000
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+
+CONFIG_AVR32_AVRTOOLSW=y
+CONFIG_AVR32_AVRTOOLSL=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_AVR32_GPIOIRQ=y
+CONFIG_AVR32_GPIOIRQSETA=0
+CONFIG_AVR32_GPIOIRQSETB=0x0000000c
+
+CONFIG_AVR32_USART0=n
+CONFIG_AVR32_USART0_RS232=n
+CONFIG_AVR32_USART0_SPI=n
+CONFIG_AVR32_USART0_RS485=n
+CONFIG_AVR32_USART0_MAN=n
+CONFIG_AVR32_USART0_MODEM=n
+CONFIG_AVR32_USART0_IRDA=n
+CONFIG_AVR32_USART0_ISO786=n
+
+CONFIG_AVR32_USART1=y
+CONFIG_AVR32_USART1_RS232=y
+CONFIG_AVR32_USART1_SPI=n
+CONFIG_AVR32_USART1_RS485=n
+CONFIG_AVR32_USART1_MAN=n
+CONFIG_AVR32_USART1_MODEM=n
+CONFIG_AVR32_USART1_IRDA=n
+CONFIG_AVR32_USART1_ISO786=n
+
+CONFIG_AVR32_USART2=n
+CONFIG_AVR32_USART2_RS232=n
+CONFIG_AVR32_USART2_SPI=n
+CONFIG_AVR32_USART2_RS485=n
+CONFIG_AVR32_USART2_MAN=n
+CONFIG_AVR32_USART2_MODEM=n
+CONFIG_AVR32_USART2_IRDA=n
+CONFIG_AVR32_USART2_ISO786=n
+
+#
+# AVR32 specific serial device driver settings
+#
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+
+CONFIG_USART0_BAUD=57600
+CONFIG_USART1_BAUD=57600
+CONFIG_USART2_BAUD=57600
+
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=2
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# AVR32 USB Configuration
+#
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=1024
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=y
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/avr32dev1/nsh/ld.script b/nuttx/configs/avr32dev1/nsh/ld.script
new file mode 100755
index 000000000..1a7035a73
--- /dev/null
+++ b/nuttx/configs/avr32dev1/nsh/ld.script
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * configs/avr32dev1/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_FORMAT("elf32-avr32", "elf32-avr32", "elf32-avr32")
+OUTPUT_ARCH(avr32:uc)
+ENTRY(_stext)
+
+/* The following assumes that the bootloader resides at 0x8000:0000 and so
+ * links the application to execute after the bootloader at 0x8000:2000.
+ * To link so that NuttX boots directly without using the bootloader,
+ * change the flash definition to:
+ *
+ * flash (rxai!w) : ORIGIN = 0x80000000, LENGTH = 256K
+ */
+
+MEMORY
+{
+ flash (rxai!w) : ORIGIN = 0x80002000, LENGTH = 256K - 8K
+ intram (wxa!ri) : ORIGIN = 0x00000004, LENGTH = 32K
+ userpage : ORIGIN = 0x80800000, LENGTH = 512
+ factorypage : ORIGIN = 0x80800200, LENGTH = 512
+}
+
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > intram AT > flash
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > intram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
+
diff --git a/nuttx/configs/avr32dev1/nsh/setenv.sh b/nuttx/configs/avr32dev1/nsh/setenv.sh
new file mode 100755
index 000000000..b3ab164ad
--- /dev/null
+++ b/nuttx/configs/avr32dev1/nsh/setenv.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# configs/avr32dev1/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# This PATH setup assumes that you are using versin 2.1.4 of the Atmel
+# AVR GNU tools installed at the default location on Windows. NOTE
+# that the path is in appended to the end of the PATH variable; this is
+# because there are also many GNUWin32 binaries there that conflict with
+# Cygwin versions.
+#
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+export AVR32_BIN="/cygdrive/c/Program Files/Atmel/AVR Tools/AVR32 Toolchain/bin/"
+export FLIP_BIN="/cygdrive/c/Program Files/Atmel/Flip 3.4.2/bin"
+export AVR32DEV1_BIN="${WD}/configs/avr32dev1/tools"
+export PATH="${FLIP_BIN}:${AVR32DEV1_BIN}:/sbin:/usr/sbin:${PATH_ORIG}:${AVR32_BIN}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/avr32dev1/ostest/Make.defs b/nuttx/configs/avr32dev1/ostest/Make.defs
new file mode 100644
index 000000000..b02597fe0
--- /dev/null
+++ b/nuttx/configs/avr32dev1/ostest/Make.defs
@@ -0,0 +1,146 @@
+############################################################################
+# configs/avr32dev1/ostest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR32_AVRTOOLSW),y)
+ # AVR Tools under Windows
+ CROSSDEV = avr32-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mpart=uc3b0256
+endif
+ifeq ($(CONFIG_AVR32_AVRTOOLSL),y)
+ # AVR Tools under Linux
+ CROSSDEV = avr32-
+ ARCHCPUFLAGS = -mpart=uc3b0256
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -ffunction-sections -fdata-sections -fno-strict-aliasing
+endif
+
+ARCHCFLAGS = -fno-builtin -muse-rodata-section
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHNOPICFLAGS = -fno-pic
+ARCHPICFLAGS = -fpic
+ARCHALLCFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+ARCHALLCXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+
+CFLAGS = $(ARCHNOPICFLAGS) $(ARCHALLCFLAGS)
+CPICFLAGS = $(ARCHPICFLAGS) $(ARCHALLCFLAGS)
+CXXFLAGS = $(ARCHNOPICFLAGS) $(ARCHALLCXXFLAGS)
+CXXPICFLAGS = $(ARCHPICFLAGS) $(ARCHALLCXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(ARCHALLCFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+LDFLAGS += -nostartfiles -nodefaultlibs
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/avr32dev1/ostest/appconfig b/nuttx/configs/avr32dev1/ostest/appconfig
new file mode 100644
index 000000000..4e3f490dc
--- /dev/null
+++ b/nuttx/configs/avr32dev1/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/avr32dev1/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/avr32dev1/ostest/defconfig b/nuttx/configs/avr32dev1/ostest/defconfig
new file mode 100755
index 000000000..e8d8e378a
--- /dev/null
+++ b/nuttx/configs/avr32dev1/ostest/defconfig
@@ -0,0 +1,426 @@
+############################################################################
+# configs/avr32dev1/ostest/defconfig
+#
+# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_AVR32=y
+CONFIG_ARCH_CHIP="at32uc3"
+CONFIG_ARCH_CHIP_AT32UC3B0256=y
+CONFIG_ENDIAN_BIG=y
+CONFIG_ARCH_BOARD="avr32dev1"
+CONFIG_ARCH_BOARD_AVR32DEV1=y
+CONFIG_BOARD_LOOPSPERMSEC=1140
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x00000000
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+
+CONFIG_AVR32_AVRTOOLSW=y
+CONFIG_AVR32_AVRTOOLSL=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_AVR32_GPIOIRQ=y
+CONFIG_AVR32_GPIOIRQSETA=0
+CONFIG_AVR32_GPIOIRQSETB=0x0000000c
+
+CONFIG_AVR32_USART0=n
+CONFIG_AVR32_USART0_RS232=n
+CONFIG_AVR32_USART0_SPI=n
+CONFIG_AVR32_USART0_RS485=n
+CONFIG_AVR32_USART0_MAN=n
+CONFIG_AVR32_USART0_MODEM=n
+CONFIG_AVR32_USART0_IRDA=n
+CONFIG_AVR32_USART0_ISO786=n
+
+CONFIG_AVR32_USART1=y
+CONFIG_AVR32_USART1_RS232=y
+CONFIG_AVR32_USART1_SPI=n
+CONFIG_AVR32_USART1_RS485=n
+CONFIG_AVR32_USART1_MAN=n
+CONFIG_AVR32_USART1_MODEM=n
+CONFIG_AVR32_USART1_IRDA=n
+CONFIG_AVR32_USART1_ISO786=n
+
+CONFIG_AVR32_USART2=n
+CONFIG_AVR32_USART2_RS232=n
+CONFIG_AVR32_USART2_SPI=n
+CONFIG_AVR32_USART2_RS485=n
+CONFIG_AVR32_USART2_MAN=n
+CONFIG_AVR32_USART2_MODEM=n
+CONFIG_AVR32_USART2_IRDA=n
+CONFIG_AVR32_USART2_ISO786=n
+
+#
+# AVR32 specific serial device driver settings
+#
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+
+CONFIG_USART0_BAUD=57600
+CONFIG_USART1_BAUD=57600
+CONFIG_USART2_BAUD=57600
+
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=2
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# AVR32 USB Configuration
+#
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=1024
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=y
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/avr32dev1/ostest/ld.script b/nuttx/configs/avr32dev1/ostest/ld.script
new file mode 100755
index 000000000..189a9ebe3
--- /dev/null
+++ b/nuttx/configs/avr32dev1/ostest/ld.script
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * configs/avr32dev1/ostest/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_FORMAT("elf32-avr32", "elf32-avr32", "elf32-avr32")
+OUTPUT_ARCH(avr32:uc)
+ENTRY(_stext)
+
+/* The following assumes that the bootloader resides at 0x8000:0000 and so
+ * links the application to execute after the bootloader at 0x8000:2000.
+ * To link so that NuttX boots directly without using the bootloader,
+ * change the flash definition to:
+ *
+ * flash (rxai!w) : ORIGIN = 0x80000000, LENGTH = 256K
+ */
+
+MEMORY
+{
+ flash (rxai!w) : ORIGIN = 0x80002000, LENGTH = 256K - 8K
+ intram (wxa!ri) : ORIGIN = 0x00000004, LENGTH = 32K
+ userpage : ORIGIN = 0x80800000, LENGTH = 512
+ factorypage : ORIGIN = 0x80800200, LENGTH = 512
+}
+
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > intram AT > flash
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > intram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
+
diff --git a/nuttx/configs/avr32dev1/ostest/setenv.sh b/nuttx/configs/avr32dev1/ostest/setenv.sh
new file mode 100755
index 000000000..3c3bfcc40
--- /dev/null
+++ b/nuttx/configs/avr32dev1/ostest/setenv.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# configs/avr32dev1/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# This PATH setup assumes that you are using versin 2.1.4 of the Atmel
+# AVR GNU tools installed at the default location on Windows. NOTE
+# that the path is in appended to the end of the PATH variable; this is
+# because there are also many GNUWin32 binaries there that conflict with
+# Cygwin versions.
+#
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+export AVR32_BIN="/cygdrive/c/Program Files/Atmel/AVR Tools/AVR32 Toolchain/bin/"
+export FLIP_BIN="/cygdrive/c/Program Files/Atmel/Flip 3.4.2/bin"
+export AVR32DEV1_BIN="${WD}/configs/avr32dev1/tools"
+export PATH="${FLIP_BIN}:${AVR32DEV1_BIN}:/sbin:/usr/sbin:${PATH_ORIG}:${AVR32_BIN}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/avr32dev1/ostest/test-result.txt b/nuttx/configs/avr32dev1/ostest/test-result.txt
new file mode 100644
index 000000000..8fe09d12f
--- /dev/null
+++ b/nuttx/configs/avr32dev1/ostest/test-result.txt
@@ -0,0 +1,404 @@
+examples/ostest output as of November 4, 2010
+=============================================
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 2, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 71a0 71a0
+ordblks 2 2
+mxordblk 4a80 4a80
+uordblks 1900 1900
+fordblks 58a0 58a0
+user_main: Exitting
diff --git a/nuttx/configs/avr32dev1/src/Makefile b/nuttx/configs/avr32dev1/src/Makefile
new file mode 100644
index 000000000..e49d45792
--- /dev/null
+++ b/nuttx/configs/avr32dev1/src/Makefile
@@ -0,0 +1,91 @@
+############################################################################
+# configs/avr32dev1/src/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/avr32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/avr32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
+
diff --git a/nuttx/configs/avr32dev1/src/avr32dev1_internal.h b/nuttx/configs/avr32dev1/src/avr32dev1_internal.h
new file mode 100644
index 000000000..31561c881
--- /dev/null
+++ b/nuttx/configs/avr32dev1/src/avr32dev1_internal.h
@@ -0,0 +1,127 @@
+/************************************************************************************
+ * configs/avr32dev1/src/avr32dev1_internal.h
+ * arch/avr/src/board/avr32dev1_internal.n
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_AVR32DEV1_SRC_AVR32DEV1_INTERNAL_H
+#define _CONFIGS_AVR32DEV1_SRC_AVR32DEV1_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include "at32uc3_config.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Configuration ********************************************************************/
+
+#if (CONFIG_AVR32_GPIOIRQSETB & 4) == 1
+# define CONFIG_AVR32DEV_BUTTON1_IRQ 1
+#endif
+
+#if (CONFIG_AVR32_GPIOIRQSETB & 8) == 1
+# define CONFIG_AVR32DEV_BUTTON2_IRQ 1
+#endif
+
+/* AVRDEV1 GPIO Pin Definitions *****************************************************/
+/* LEDs
+ *
+ * The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins.
+ *
+ * PIN 13 PA7 LED1
+ * PIN 14 PA8 LED2
+ */
+
+#define PINMUX_GPIO_LED1 (GPIO_ENABLE | GPIO_OUTPUT | GPIO_LOW | GPIO_PORTA | 7)
+#define PINMUX_GPIO_LED2 (GPIO_ENABLE | GPIO_OUTPUT | GPIO_LOW | GPIO_PORTA | 8)
+
+/* BUTTONs
+ *
+ * The AVR32DEV1 board has 3 BUTTONs, two of which can be sensed through GPIO pins.
+ *
+ * PIN 24 PB2 KEY1
+ * PIN 25 PB3 KEY2
+ */
+
+#if CONFIG_AVR32DEV_BUTTON1_IRQ
+# define PINMUX_GPIO_BUTTON1 (GPIO_ENABLE | GPIO_INPUT | GPIO_INTR | \
+ GPIO_INTMODE_BOTH | GPIO_GLITCH | GPIO_PORTB | 2)
+# define GPIO_BUTTON1_IRQ AVR32_IRQ_GPIO_PB2
+#else
+# define PINMUX_GPIO_BUTTON1 (GPIO_ENABLE | GPIO_INPUT | GPIO_GLITCH | \
+ GPIO_PORTB | 2)
+#endif
+
+#if CONFIG_AVR32DEV_BUTTON2_IRQ
+# define PINMUX_GPIO_BUTTON2 (GPIO_ENABLE | GPIO_INPUT | GPIO_INTR | \
+ GPIO_INTMODE_BOTH | GPIO_GLITCH | GPIO_PORTB | 3)
+# define GPIO_BUTTON2_IRQ AVR32_IRQ_GPIO_PB3
+#else
+# define PINMUX_GPIO_BUTTON2 (GPIO_ENABLE | GPIO_INPUT | GPIO_GLITCH | \
+ GPIO_PORTB | 3)
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_ledinitialize
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void up_ledinitialize(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_AVR32DEV1_SRC_AVR32DEV1_INTERNAL_H */
+
diff --git a/nuttx/configs/avr32dev1/src/up_boot.c b/nuttx/configs/avr32dev1/src/up_boot.c
new file mode 100644
index 000000000..587168853
--- /dev/null
+++ b/nuttx/configs/avr32dev1/src/up_boot.c
@@ -0,0 +1,84 @@
+/************************************************************************************
+ * configs/avr32dev1/src/up_boot.c
+ * arch/avr/src/board/up_boot.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "at32uc3_internal.h"
+#include "avr32dev1_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All AVR32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void up_boardinitialize(void)
+{
+ /* Configure SPI chip selects */
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinitialize();
+#endif
+}
diff --git a/nuttx/configs/avr32dev1/src/up_buttons.c b/nuttx/configs/avr32dev1/src/up_buttons.c
new file mode 100644
index 000000000..5b488d72e
--- /dev/null
+++ b/nuttx/configs/avr32dev1/src/up_buttons.c
@@ -0,0 +1,185 @@
+/****************************************************************************
+ * configs/sam3u-ek/src/up_leds.c
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "at32uc3_config.h"
+
+#include <sys/types.h>
+#include <stdint.h>
+
+#include <nuttx/irq.h>
+
+#include <arch/irq.h>
+#include <arch/board/board.h>
+
+#include "at32uc3_internal.h"
+#include "avr32dev1_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_irqbuttonx
+ *
+ * Description:
+ * This function implements the core of the up_irqbutton() logic.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_AVR32_GPIOIRQ) && defined(CONFIG_ARCH_IRQBUTTONS) && \
+ (defined(CONFIG_AVR32DEV_BUTTON1_IRQ) || defined(CONFIG_AVR32DEV_BUTTON2_IRQ))
+static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler;
+
+ /* Attach the handler */
+
+ gpio_irqattach(irq, irqhandler, &oldhandler);
+
+ /* Enable/disable the interrupt */
+
+ if (irqhandler)
+ {
+ gpio_irqenable(irq);
+ }
+ else
+ {
+ gpio_irqdisable(irq);
+ }
+
+ /* Return the old button handler (so that it can be restored) */
+
+ return oldhandler;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ (void)at32uc3_configgpio(PINMUX_GPIO_BUTTON1);
+ (void)at32uc3_configgpio(PINMUX_GPIO_BUTTON2);
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON* definitions
+ * above for the meaning of each bit in the returned value.
+ *
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t retval;
+
+ retval = at32uc3_gpioread(PINMUX_GPIO_BUTTON1) ? 0 : BUTTON1;
+ retval |= at32uc3_gpioread(PINMUX_GPIO_BUTTON2) ? 0 : BUTTON2;
+
+ return retval;
+}
+
+/****************************************************************************
+ * Name: up_irqbutton
+ *
+ * Description:
+ * This function may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is one
+ * of the BUTTON* definitions provided above. The previous interrupt
+ * handler address isreturned (so that it may restored, if so desired).
+ *
+ * Configuration Notes:
+ * Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
+ * overall GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
+ * CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
+ * interrupts on. For button support, bits 2 and 3 must be set in
+ * CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3).
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_AVR32_GPIOIRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+#ifdef CONFIG_AVR32DEV_BUTTON1_IRQ
+ if (id == BUTTON1)
+ {
+ return up_irqbuttonx(GPIO_BUTTON1_IRQ, irqhandler);
+ }
+ else
+#endif
+#ifdef CONFIG_AVR32DEV_BUTTON2_IRQ
+ if (id == BUTTON2)
+ {
+ return up_irqbuttonx(GPIO_BUTTON2_IRQ, irqhandler);
+ }
+ else
+#endif
+ {
+ return NULL;
+ }
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/avr32dev1/src/up_leds.c b/nuttx/configs/avr32dev1/src/up_leds.c
new file mode 100644
index 000000000..62cde6b21
--- /dev/null
+++ b/nuttx/configs/avr32dev1/src/up_leds.c
@@ -0,0 +1,93 @@
+/****************************************************************************
+ * configs/avr32dev1/src/up_leds.c
+ * arch/avr/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "at32uc3_internal.h"
+#include "avr32dev1_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinitialize
+ ****************************************************************************/
+
+void up_ledinitialize(void)
+{
+ at32uc3_configgpio(PINMUX_GPIO_LED1);
+ at32uc3_configgpio(PINMUX_GPIO_LED2);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ at32uc3_gpiowrite(PINMUX_GPIO_LED1, (led != 0));
+ at32uc3_gpiowrite(PINMUX_GPIO_LED2, (led == 2));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ at32uc3_gpiowrite(PINMUX_GPIO_LED1, (led == 2));
+ at32uc3_gpiowrite(PINMUX_GPIO_LED2, false);
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/avr32dev1/tools/doisp.sh b/nuttx/configs/avr32dev1/tools/doisp.sh
new file mode 100755
index 000000000..cb1b5ee4a
--- /dev/null
+++ b/nuttx/configs/avr32dev1/tools/doisp.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+#set -x
+
+# This script must be executed in the NuttX top-level directory. We'll check..
+# the .config file should be located there.
+
+TOPDIR=`pwd`
+if [ ! -f .config ]; then
+ echo "There is no configured version of NuttX in this directory."
+ echo " Is '$TOPDIR' the NuttX top level directory?"
+ echo " Has NuttX been configured?"
+ exit 1
+fi
+
+# The NuttX build system creates a nuttx ELF file, but the batchisp tools
+# expects the file to have a .elf extension
+
+if [ ! -f nuttx.elf ]; then
+ if [ ! -f nuttx ]; then
+ echo "The NuttX ELF file (nuttx or nuttx.elf) does not exist in this directory."
+ echo " Has the NuttX binary been built?"
+ exit 1
+ fi
+ echo "Re-naming nuttx to nuttx.elf"
+ mv nuttx nuttx.elf || { echo "mv failed"; exit 1; }
+else
+ if [ -f nuttx ]; then
+ echo "Replacing the old nuttx.elf with the new nuttx file."
+ mv nuttx nuttx.elf || { echo "mv failed"; exit 1; }
+ fi
+fi
+
+DEVICE=at32uc3b0256
+HARDWARE=usb
+OPERATION="erase f memory flash blankcheck loadbuffer nuttx.elf program verify start reset 0"
+
+batchisp -device $DEVICE -hardware $HARDWARE -operation $OPERATION
diff --git a/nuttx/configs/c5471evm/Kconfig b/nuttx/configs/c5471evm/Kconfig
new file mode 100644
index 000000000..025ba5e0e
--- /dev/null
+++ b/nuttx/configs/c5471evm/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_C5471EVM
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/c5471evm/README.txt b/nuttx/configs/c5471evm/README.txt
new file mode 100644
index 000000000..1329ee6d8
--- /dev/null
+++ b/nuttx/configs/c5471evm/README.txt
@@ -0,0 +1,149 @@
+README
+^^^^^^
+
+Toolchain
+^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the SH toolchain (if
+ different from the default).
+
+ If you have no SH toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+
+ 1. You must have already configured Nuttx in <some-dir>nuttx.
+
+ cd tools
+ ./configure.sh c5471evm/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/arm-defconfig .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h so that the PATH variable includes the path to the
+ newly built binaries.
+
+ARM/C5471-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ARM7TDMI=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=c5471
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_C5471
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=c5471evm (for the Spectrum Digital C5471 EVM)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_C5471EVM (for the Spectrum Digital C5471 EVM)
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_ROM_VECTORS - should be defined for the C5471 because the
+ interrupt vectors are in ROM
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ C5471 specific device driver settings
+
+ CONFIG_SERIAL_IRDA_CONSOLE - selects the IRDA UART for the
+ console ant ttys0 (default is the modem UART).
+ CONFIG_UART_*_HWFLOWCONTROL - enables hardware flow control
+ CONFIG_UART_*_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UART_*_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UART_*_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UART_*_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UART_*_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UART_*_2STOP - Two stop bits
+
+ C5471 Ethernet Driver settings
+
+ CONFIG_C5471_NET_STATS
+ CONFIG_C5471_ETHERNET_PHY={ETHERNET_PHY_LU3X31T_T64,ETHERNET_PHY_AC101L}
+ CONFIG_NET_C5471_AUTONEGOTIATION
+ CONFIG_NET_C5471_BASET100
+ CONFIG_NET_C5471_BASET10
+
+defconfig
+^^^^^^^^^
+The default configuration file, defconfig, performs a
+simple OS test using examples/ostest. This can be
+configuration as follows:
+
+ cd tools
+ ./configure.sh c5471evm
+ cd -
+ . ./setenv.sh
+
+netconfig
+^^^^^^^^^
+This alternative configuration file, netconfig, may be used
+instead of the default configuration (defconfig). This
+configuration enables networking using the c5471's built-in
+Ethernet interface. It uses examples/nettest to excercise
+the TCP/IP network.
+
+nshconfig
+^^^^^^^^^
+This configuration file builds NSH (examples/nsh) using the
+TELNET server front end
+
+dhcpconfig
+^^^^^^^^^^
+This configuration exercises the DHCP client of netutils/dhcpc
+using examples/uip.
+
+These alternative configurations can be selected by (using
+uipconfig as example):
+
+ (Seleted the default configuration as show above)
+ cp config/c5471evm/uiponfig .config
+
diff --git a/nuttx/configs/c5471evm/doc/test-result.txt b/nuttx/configs/c5471evm/doc/test-result.txt
new file mode 100644
index 000000000..9b7925912
--- /dev/null
+++ b/nuttx/configs/c5471evm/doc/test-result.txt
@@ -0,0 +1,164 @@
+This is the output from examples/ostest executed on this
+platform on March 9, 2007
+
+========================================================
+
+Standard I/O Check: write fd=1
+Standard I/O Check: write fd=2
+user_start: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+user_start: Standard I/O Check: fprintf to stderr
+user_main: Started with argc=5
+user_main: argv[0]="no name"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 aiting on semaphore
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = 4294967295
+waiter_func: Thread 2 aiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = 4294967294
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = 4294967295
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = 4294967295
+poster_func: Thread 3 semaphore value = 4294967295
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive suscceeded on msg 7
+ender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+waiter_main: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=16
+wakeup_action: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+sighand_test: Signaling pid=16 with signo=17 sigvalue=42
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=0
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+user_main: Exitting
diff --git a/nuttx/configs/c5471evm/httpd/Make.defs b/nuttx/configs/c5471evm/httpd/Make.defs
new file mode 100644
index 000000000..59a3bad44
--- /dev/null
+++ b/nuttx/configs/c5471evm/httpd/Make.defs
@@ -0,0 +1,120 @@
+############################################################################
+# configs/c5471evm/httpd/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/httpd/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/c5471evm/httpd/appconfig b/nuttx/configs/c5471evm/httpd/appconfig
new file mode 100644
index 000000000..1d9def12d
--- /dev/null
+++ b/nuttx/configs/c5471evm/httpd/appconfig
@@ -0,0 +1,46 @@
+############################################################################
+# configs/c5471evm/httpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/uip
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webserver
diff --git a/nuttx/configs/c5471evm/httpd/defconfig b/nuttx/configs/c5471evm/httpd/defconfig
new file mode 100644
index 000000000..1e599d9a1
--- /dev/null
+++ b/nuttx/configs/c5471evm/httpd/defconfig
@@ -0,0 +1,261 @@
+############################################################################
+# configs/c5471evm/httpd/defconfig
+#
+# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="c5471"
+CONFIG_ARCH_CHIP_C5471=y
+CONFIG_ARCH_BOARD="c5471evm"
+CONFIG_ARCH_BOARD_C5471EVM=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=285212672
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=y
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="uip_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=0
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=0
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=0
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=y
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=y
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/c5471evm/httpd/ld.script b/nuttx/configs/c5471evm/httpd/ld.script
new file mode 100644
index 000000000..89397f3ad
--- /dev/null
+++ b/nuttx/configs/c5471evm/httpd/ld.script
@@ -0,0 +1,107 @@
+/************************************************************
+ * ld.script
+ *
+ * Copyright (C) 2007, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* Interrupt vector trampoline and command line parameters
+ * are provided in IRAM by the rrload bootloader. Vectors will be
+ * copied into _svectors.
+ */
+
+ . = 0xffc00000;
+ _svectors = ABSOLUTE(.);
+
+ /* These are locations in IRAM where the rrload bootloader passes
+ * information to the running program
+ */
+
+ . = 0xffc00020;
+ __KernCommandLineMagicStr = .; /* magic pattern string == "kcmdline-->" */
+ . = 0xffc0002C; /* advance to .+strlen("kcmdline-->")+1 */
+ __KernCommandLineOverride = .; /* location of kernel command line string */
+
+ . = 0xffc00100;
+ __EtherMACMagicStr = .; /* magic pattern string == "etherMAC-->" */
+ . = 0xffc0010C; /* advance to .+strlen("etherMAC-->")+1 */
+ __EtherMAC = .;
+
+
+ /* The OS entry point is here */
+
+ . = 0x10300000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.); /* See below */
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/c5471evm/httpd/setenv.sh b/nuttx/configs/c5471evm/httpd/setenv.sh
new file mode 100755
index 000000000..e9ab8023a
--- /dev/null
+++ b/nuttx/configs/c5471evm/httpd/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/httpd/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/c5471evm/include/README.txt b/nuttx/configs/c5471evm/include/README.txt
new file mode 100644
index 000000000..dabdd42a4
--- /dev/null
+++ b/nuttx/configs/c5471evm/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Spectrum Digital C5471 EVM. \ No newline at end of file
diff --git a/nuttx/configs/c5471evm/include/board.h b/nuttx/configs/c5471evm/include/board.h
new file mode 100644
index 000000000..8ee4df9cc
--- /dev/null
+++ b/nuttx/configs/c5471evm/include/board.h
@@ -0,0 +1,66 @@
+/************************************************************************
+ * arch/board.h
+ *
+ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+#ifndef __ARCH_BOARD_H
+#define __ARCH_BOARD_H
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/* Clocking *************************************************************/
+
+#define C5471_CLOCK 47500000 /* 47.5 MHz */
+
+/* LED definitions ******************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/************************************************************************
+ * Inline Functions
+ ************************************************************************/
+
+#endif /* __ARCH_BOARD_H */
diff --git a/nuttx/configs/c5471evm/nettest/Make.defs b/nuttx/configs/c5471evm/nettest/Make.defs
new file mode 100644
index 000000000..584a2e7fd
--- /dev/null
+++ b/nuttx/configs/c5471evm/nettest/Make.defs
@@ -0,0 +1,120 @@
+############################################################################
+# configs/c5471evm/nettest/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/c5471evm/nettest/appconfig b/nuttx/configs/c5471evm/nettest/appconfig
new file mode 100644
index 000000000..971aca007
--- /dev/null
+++ b/nuttx/configs/c5471evm/nettest/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/c5471evm/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/c5471evm/nettest/defconfig b/nuttx/configs/c5471evm/nettest/defconfig
new file mode 100644
index 000000000..807a23f15
--- /dev/null
+++ b/nuttx/configs/c5471evm/nettest/defconfig
@@ -0,0 +1,261 @@
+############################################################################
+# configs/c5471evm/nettest/defconfig
+#
+# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="c5471"
+CONFIG_ARCH_CHIP_C5471=y
+CONFIG_ARCH_BOARD="c5471evm"
+CONFIG_ARCH_BOARD_C5471EVM=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=285212672
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=y
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/c5471evm/nettest/ld.script b/nuttx/configs/c5471evm/nettest/ld.script
new file mode 100644
index 000000000..89397f3ad
--- /dev/null
+++ b/nuttx/configs/c5471evm/nettest/ld.script
@@ -0,0 +1,107 @@
+/************************************************************
+ * ld.script
+ *
+ * Copyright (C) 2007, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* Interrupt vector trampoline and command line parameters
+ * are provided in IRAM by the rrload bootloader. Vectors will be
+ * copied into _svectors.
+ */
+
+ . = 0xffc00000;
+ _svectors = ABSOLUTE(.);
+
+ /* These are locations in IRAM where the rrload bootloader passes
+ * information to the running program
+ */
+
+ . = 0xffc00020;
+ __KernCommandLineMagicStr = .; /* magic pattern string == "kcmdline-->" */
+ . = 0xffc0002C; /* advance to .+strlen("kcmdline-->")+1 */
+ __KernCommandLineOverride = .; /* location of kernel command line string */
+
+ . = 0xffc00100;
+ __EtherMACMagicStr = .; /* magic pattern string == "etherMAC-->" */
+ . = 0xffc0010C; /* advance to .+strlen("etherMAC-->")+1 */
+ __EtherMAC = .;
+
+
+ /* The OS entry point is here */
+
+ . = 0x10300000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.); /* See below */
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/c5471evm/nettest/setenv.sh b/nuttx/configs/c5471evm/nettest/setenv.sh
new file mode 100755
index 000000000..67bcbc1f6
--- /dev/null
+++ b/nuttx/configs/c5471evm/nettest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/nettest/setenv.sh
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/c5471evm/nsh/Make.defs b/nuttx/configs/c5471evm/nsh/Make.defs
new file mode 100644
index 000000000..1977cc233
--- /dev/null
+++ b/nuttx/configs/c5471evm/nsh/Make.defs
@@ -0,0 +1,120 @@
+############################################################################
+# configs/c5471evm/nsh/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/c5471evm/nsh/appconfig b/nuttx/configs/c5471evm/nsh/appconfig
new file mode 100644
index 000000000..a2ec0db66
--- /dev/null
+++ b/nuttx/configs/c5471evm/nsh/appconfig
@@ -0,0 +1,58 @@
+############################################################################
+# configs/c5471evm/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/c5471evm/nsh/defconfig b/nuttx/configs/c5471evm/nsh/defconfig
new file mode 100644
index 000000000..9f5bc6373
--- /dev/null
+++ b/nuttx/configs/c5471evm/nsh/defconfig
@@ -0,0 +1,261 @@
+############################################################################
+# configs/c5471evm/nsh/defconfig
+#
+# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="c5471"
+CONFIG_ARCH_CHIP_C5471=y
+CONFIG_ARCH_BOARD="c5471evm"
+CONFIG_ARCH_BOARD_C5471EVM=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=285212672
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=y
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=4
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=n
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/c5471evm/nsh/ld.script b/nuttx/configs/c5471evm/nsh/ld.script
new file mode 100644
index 000000000..89397f3ad
--- /dev/null
+++ b/nuttx/configs/c5471evm/nsh/ld.script
@@ -0,0 +1,107 @@
+/************************************************************
+ * ld.script
+ *
+ * Copyright (C) 2007, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* Interrupt vector trampoline and command line parameters
+ * are provided in IRAM by the rrload bootloader. Vectors will be
+ * copied into _svectors.
+ */
+
+ . = 0xffc00000;
+ _svectors = ABSOLUTE(.);
+
+ /* These are locations in IRAM where the rrload bootloader passes
+ * information to the running program
+ */
+
+ . = 0xffc00020;
+ __KernCommandLineMagicStr = .; /* magic pattern string == "kcmdline-->" */
+ . = 0xffc0002C; /* advance to .+strlen("kcmdline-->")+1 */
+ __KernCommandLineOverride = .; /* location of kernel command line string */
+
+ . = 0xffc00100;
+ __EtherMACMagicStr = .; /* magic pattern string == "etherMAC-->" */
+ . = 0xffc0010C; /* advance to .+strlen("etherMAC-->")+1 */
+ __EtherMAC = .;
+
+
+ /* The OS entry point is here */
+
+ . = 0x10300000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.); /* See below */
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/c5471evm/nsh/setenv.sh b/nuttx/configs/c5471evm/nsh/setenv.sh
new file mode 100755
index 000000000..0693ede0a
--- /dev/null
+++ b/nuttx/configs/c5471evm/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/c5471evm/ostest/Make.defs b/nuttx/configs/c5471evm/ostest/Make.defs
new file mode 100644
index 000000000..8773c7c68
--- /dev/null
+++ b/nuttx/configs/c5471evm/ostest/Make.defs
@@ -0,0 +1,120 @@
+############################################################################
+# configs/c5471evm/ostest/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/c5471evm/ostest/appconfig b/nuttx/configs/c5471evm/ostest/appconfig
new file mode 100644
index 000000000..759015c6a
--- /dev/null
+++ b/nuttx/configs/c5471evm/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/c5471evm/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/c5471evm/ostest/defconfig b/nuttx/configs/c5471evm/ostest/defconfig
new file mode 100644
index 000000000..4921b59e6
--- /dev/null
+++ b/nuttx/configs/c5471evm/ostest/defconfig
@@ -0,0 +1,261 @@
+############################################################################
+# configs/c5471evm/ostest/defconfig
+#
+# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="c5471"
+CONFIG_ARCH_CHIP_C5471=y
+CONFIG_ARCH_BOARD="c5471evm"
+CONFIG_ARCH_BOARD_C5471EVM=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=285212672
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=y
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/c5471evm/ostest/ld.script b/nuttx/configs/c5471evm/ostest/ld.script
new file mode 100644
index 000000000..89397f3ad
--- /dev/null
+++ b/nuttx/configs/c5471evm/ostest/ld.script
@@ -0,0 +1,107 @@
+/************************************************************
+ * ld.script
+ *
+ * Copyright (C) 2007, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* Interrupt vector trampoline and command line parameters
+ * are provided in IRAM by the rrload bootloader. Vectors will be
+ * copied into _svectors.
+ */
+
+ . = 0xffc00000;
+ _svectors = ABSOLUTE(.);
+
+ /* These are locations in IRAM where the rrload bootloader passes
+ * information to the running program
+ */
+
+ . = 0xffc00020;
+ __KernCommandLineMagicStr = .; /* magic pattern string == "kcmdline-->" */
+ . = 0xffc0002C; /* advance to .+strlen("kcmdline-->")+1 */
+ __KernCommandLineOverride = .; /* location of kernel command line string */
+
+ . = 0xffc00100;
+ __EtherMACMagicStr = .; /* magic pattern string == "etherMAC-->" */
+ . = 0xffc0010C; /* advance to .+strlen("etherMAC-->")+1 */
+ __EtherMAC = .;
+
+
+ /* The OS entry point is here */
+
+ . = 0x10300000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.); /* See below */
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/c5471evm/ostest/setenv.sh b/nuttx/configs/c5471evm/ostest/setenv.sh
new file mode 100755
index 000000000..e48437a41
--- /dev/null
+++ b/nuttx/configs/c5471evm/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/ostest/setenv.sh
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/c5471evm/src/Makefile b/nuttx/configs/c5471evm/src/Makefile
new file mode 100644
index 000000000..57f52b4fe
--- /dev/null
+++ b/nuttx/configs/c5471evm/src/Makefile
@@ -0,0 +1,77 @@
+############################################################################
+# configs/c5471evm/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/c5471evm/src/README.txt b/nuttx/configs/c5471evm/src/README.txt
new file mode 100644
index 000000000..40a798d35
--- /dev/null
+++ b/nuttx/configs/c5471evm/src/README.txt
@@ -0,0 +1,2 @@
+This directory contains drivers unique to the Spectrum Digital C5471 EVM.
+
diff --git a/nuttx/configs/c5471evm/src/up_leds.c b/nuttx/configs/c5471evm/src/up_leds.c
new file mode 100644
index 000000000..72811a871
--- /dev/null
+++ b/nuttx/configs/c5471evm/src/up_leds.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * up_leds.c
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+#define CS2 *(volatile uint32_t*)0xffff2e08
+#define LEDS *(volatile uint32_t*)0x01000000
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static uint32_t g_ledstate;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Funtions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Enable access to LEDs */
+
+ CS2 = 0x000013db;
+
+ /* Turn LED 1-7 off; turn LED 0 on */
+
+ g_ledstate = 0x000000fe;
+ LEDS = g_ledstate;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ if (led < 8)
+ {
+ g_ledstate &= ~(1 << led);
+ LEDS = g_ledstate;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ if (led < 8)
+ {
+ g_ledstate |= (1 << led);
+ LEDS = g_ledstate;
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/compal_e88/Kconfig b/nuttx/configs/compal_e88/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/compal_e88/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/compal_e88/README.txt b/nuttx/configs/compal_e88/README.txt
new file mode 100644
index 000000000..05f943100
--- /dev/null
+++ b/nuttx/configs/compal_e88/README.txt
@@ -0,0 +1,52 @@
+compal_e88
+==========
+
+This directory contains the board support for compal e88 phones.
+
+This port is based on patches contributed by Denis Carikli for both the
+compal e99 and e88. At the time of initial check-in, the following phones
+were tested:
+
+* motorolla c155 (compal e99) with the compalram and highram configuration
+* motorolla W220 (compal e88)
+* The openmoko freerunner baseband(compal e88)
+
+The patches were made by Alan Carvalho de Assis and Denis Carikli using
+the Stefan Richter's patches that can be found here:
+
+http://cgit.osmocom.org/cgit/nuttx-bb/log/?h=lputt%2Ftesting
+
+Osmocom-BB Dependencies and Sercomm
+===================================
+
+The build environment assumes that you have the osmocom-bb project
+directory at same level as the nuttx project:
+
+ |- nuttx
+ |- apps
+ `- osmocom-bb
+
+If you attempt to build this configuration without osmocom-bb, and that
+you added support for sercomm in your configuration(CONFIG_SERCOMM_CONSOLE=y)
+you will get compilation errors in drivers/sercomm due to header files that
+are needed from the osmocom-bb directory.
+
+By default, NuttX will not use sercomm (HDLC protocol) to communicate with
+the host system. Sercomm is the transport used by osmocom-bb that runs on top
+of serial. See http://bb.osmocom.org/trac/wiki/nuttx-bb/run for detailed
+the usage of nuttx with sercomm.
+
+Loading NuttX
+=============
+
+The osmocom-bb wiki describes how to load NuttX. See
+http://bb.osmocom.org/trac/wiki/nuttx-bb for detailed information.
+The way that nuttx is loaded depends on the configuration (highram/compalram)
+and phone:
+
+o compalram is for the ramloader(for phone having a bootloader on flash)
+o highram is for phones having the romloader(if the phone has a bootrom)
+ or for loading in the ram trough a special loader(loaded first on ram
+ by talking to the ramloader) when having a ramloader(which can only
+ load 64k).
+
diff --git a/nuttx/configs/compal_e88/include/board.h b/nuttx/configs/compal_e88/include/board.h
new file mode 100644
index 000000000..1a1a7435d
--- /dev/null
+++ b/nuttx/configs/compal_e88/include/board.h
@@ -0,0 +1,6 @@
+/************************************************************************
+ * arch/board.h
+ *
+ * Supposed to be empty
+ *
+ ************************************************************************/
diff --git a/nuttx/configs/compal_e88/include/power.h b/nuttx/configs/compal_e88/include/power.h
new file mode 100644
index 000000000..9645fefd1
--- /dev/null
+++ b/nuttx/configs/compal_e88/include/power.h
@@ -0,0 +1,6 @@
+/************************************************************************
+ * arch/power.h
+ *
+ * Supposed to be empty
+ *
+ ************************************************************************/
diff --git a/nuttx/configs/compal_e88/nsh_highram/Make.defs b/nuttx/configs/compal_e88/nsh_highram/Make.defs
new file mode 100644
index 000000000..d22675f17
--- /dev/null
+++ b/nuttx/configs/compal_e88/nsh_highram/Make.defs
@@ -0,0 +1,129 @@
+############################################################################
+# configs/c5471evm/nsh/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_SERCOMM_CONSOLE}","y")
+OSMODIR = $(TOPDIR)/../../osmocom-bb
+EXTRA_LIBS = $(OSMODIR)/src/target/firmware/comm/libcomm.a \
+ $(OSMODIR)/src/shared/libosmocore/build-target/src/.libs/libosmocore.a \
+ $(OSMODIR)/src/target/firmware/calypso/libcalypso.a \
+ $(OSMODIR)/src/target/firmware/comm/libcomm.a
+ # ^^^ Stupid hack! Why do I have to put it twice???
+endif
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(OSMODIR)/src/shared/libosmocore/include -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh_highram/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/compal_e88/nsh_highram/appconfig b/nuttx/configs/compal_e88/nsh_highram/appconfig
new file mode 100644
index 000000000..00921c361
--- /dev/null
+++ b/nuttx/configs/compal_e88/nsh_highram/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/compal_e88/nsh_highram/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# NSH shell
+CONFIGURED_APPS += examples/nsh
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Path to example in apps/examples
+CONFIGURED_APPS += examples/hello
+CONFIGURED_APPS += vsn/poweroff
diff --git a/nuttx/configs/compal_e88/nsh_highram/defconfig b/nuttx/configs/compal_e88/nsh_highram/defconfig
new file mode 100644
index 000000000..bfb3017d2
--- /dev/null
+++ b/nuttx/configs/compal_e88/nsh_highram/defconfig
@@ -0,0 +1,280 @@
+############################################################################
+# configs/c5471evm/nsh/defconfig
+#
+# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="calypso"
+CONFIG_ARCH_CHIP_CALYPSO=y
+CONFIG_ARCH_BOARD="compal_e88"
+CONFIG_ARCH_BOARD_COMPALE88=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_INTERRUPTSTACK=1024
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=8650752
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERCOMM_CONSOLE=n
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+CONFIG_STDIO_LINE_BUFFER=y
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+# SPI driver
+#
+CONFIG_SPI_OWNBUS=y
+CONFIG_SPI_EXCHANGE=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=4
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_STACKSIZE=4096
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_BUILTIN_APPS=y
+
+#
+# Settings for examples/hello
+CONFIG_EXAMPLES_HELLO_BUILTIN=y
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/compal_e88/nsh_highram/ld.script b/nuttx/configs/compal_e88/nsh_highram/ld.script
new file mode 100644
index 000000000..35fa84728
--- /dev/null
+++ b/nuttx/configs/compal_e88/nsh_highram/ld.script
@@ -0,0 +1,128 @@
+/*
+ * Linker script for running from internal SRAM on Compal phones
+ *
+ * This script is tailored specifically to the requirements imposed
+ * on us by the Compal bootloader.
+ *
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(__start)
+MEMORY
+{
+ /* 0x800000-0x83ffff */
+ /* compal-loaded binary: our text, initialized data */
+ LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00020000
+ TRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x00010000
+ /* compal-loaded binary: our unitialized data, stacks, heap */
+ IRAM (rw) : ORIGIN = 0x00830000, LENGTH = 0x00010000
+}
+SECTIONS
+{
+ . = 0x800000;
+
+ /* romloader data section, contains passthru interrupt vectors */
+ .compal.loader (NOLOAD) : { . = 0x100; } > LRAM
+
+ /* image signature (prepended by osmocon according to phone type) */
+ .compal.header (NOLOAD) : { . = 4; } > LRAM
+
+ /* initialization code */
+ . = ALIGN(4);
+ .text.start : {
+ PROVIDE(__start = .);
+ KEEP(*(.text.start))
+ *(.text.start)
+ } > TRAM
+
+ /* exception vectors from 0x80001c to 0x800034 */
+ .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) {
+ KEEP(*(.text.exceptions))
+ * (.text.exceptions)
+ . = ALIGN(4);
+ } > LRAM
+ PROVIDE(_exceptions = LOADADDR(.text.exceptions));
+
+ /* code */
+ . = ALIGN(4);
+ .text (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) :
+ AT (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) {
+ /* regular code */
+ *(.text*)
+ /* always-in-ram code */
+ *(.ramtext*)
+ /* gcc voodoo */
+ *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
+ . = ALIGN(4);
+ } > TRAM
+ PROVIDE(_text_start = LOADADDR(.text));
+ PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text));
+
+ /* constructor pointers */
+ .ctors : {
+ /* ctor count */
+ LONG(SIZEOF(.ctors) / 4 - 2)
+ /* ctor pointers */
+ KEEP(*(SORT(.ctors)))
+ /* end of list */
+ LONG(0)
+ } > TRAM
+ PROVIDE(_ctor_start = LOADADDR(.ctors));
+ PROVIDE(_ctor_end = LOADADDR(.ctors) + SIZEOF(.ctors));
+
+ /* destructor pointers */
+ .dtors : {
+ /* dtor count */
+ LONG(SIZEOF(.dtors) / 4 - 2)
+ /* dtor pointers */
+ KEEP(*(SORT(.dtors)))
+ /* end of list */
+ LONG(0)
+ } > TRAM
+ PROVIDE(_dtor_start = LOADADDR(.dtors));
+ PROVIDE(_dtor_end = LOADADDR(.dtors) + SIZEOF(.dtors));
+
+ /* read-only data */
+ . = ALIGN(4);
+ .rodata : {
+ *(.rodata*)
+ } > TRAM
+ PROVIDE(_rodata_start = LOADADDR(.rodata));
+ PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata));
+
+ /* initialized data */
+ . = ALIGN(4);
+ .data : {
+ *(.data)
+ } > TRAM
+ PROVIDE(_data_start = LOADADDR(.data));
+ PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data));
+
+ /* pic offset tables */
+ . = ALIGN(4);
+ .got : {
+ *(.got)
+ *(.got.plt) *(.igot.plt) *(.got) *(.igot)
+ } > TRAM
+ PROVIDE(_got_start = LOADADDR(.got));
+ PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got));
+
+ /* uninitialized data */
+ .bss (NOLOAD) : {
+ . = ALIGN(4);
+ __bss_start = .;
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ _ebss = ABSOLUTE(.);
+ } > IRAM
+ . = ALIGN(4);
+ __bss_end = .;
+ PROVIDE(_bss_start = __bss_start);
+ PROVIDE(_bss_end = __bss_end);
+
+ /* end of image */
+ . = ALIGN(4);
+ _end = .;
+ PROVIDE(end = .);
+}
diff --git a/nuttx/configs/compal_e88/nsh_highram/setenv.sh b/nuttx/configs/compal_e88/nsh_highram/setenv.sh
new file mode 100644
index 000000000..0693ede0a
--- /dev/null
+++ b/nuttx/configs/compal_e88/nsh_highram/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/compal_e88/src/Makefile b/nuttx/configs/compal_e88/src/Makefile
new file mode 100644
index 000000000..13e1ae09f
--- /dev/null
+++ b/nuttx/configs/compal_e88/src/Makefile
@@ -0,0 +1,80 @@
+############################################################################
+# configs/compal_e88/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Copyright (C) 2011 Stefan Richter. All rights reserved.
+# Author: Stefan Richter <ichgeh@l--putt.de>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = dummy.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/compal_e88/src/dummy.c b/nuttx/configs/compal_e88/src/dummy.c
new file mode 100644
index 000000000..69853a130
--- /dev/null
+++ b/nuttx/configs/compal_e88/src/dummy.c
@@ -0,0 +1 @@
+/* no libboard.a otherwise */
diff --git a/nuttx/configs/compal_e99/Kconfig b/nuttx/configs/compal_e99/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/compal_e99/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/compal_e99/README.txt b/nuttx/configs/compal_e99/README.txt
new file mode 100644
index 000000000..e35e1234a
--- /dev/null
+++ b/nuttx/configs/compal_e99/README.txt
@@ -0,0 +1,52 @@
+compal_e99
+==========
+
+This directory contains the board support for compal e99 phones.
+
+This port is based on patches contributed by Denis Carikli for both the
+compal e99 and e88. At the time of initial check-in, the following phones
+were tested:
+
+* motorolla c155 (compal e99) with the compalram and highram configuration
+* motorolla W220 (compal e88)
+* The openmoko freerunner baseband(compal e88)
+
+The patches were made by Alan Carvalho de Assis and Denis Carikli using
+the Stefan Richter's patches that can be found here:
+
+http://cgit.osmocom.org/cgit/nuttx-bb/log/?h=lputt%2Ftesting
+
+Osmocom-BB Dependencies and Sercomm
+===================================
+
+The build environment assumes that you have the osmocom-bb project
+directory at same level as the nuttx project:
+
+ |- nuttx
+ |- apps
+ `- osmocom-bb
+
+If you attempt to build this configuration without osmocom-bb, and that
+you added support for sercomm in your configuration(CONFIG_SERCOMM_CONSOLE=y)
+you will get compilation errors in drivers/sercomm due to header files that
+are needed from the osmocom-bb directory.
+
+By default, NuttX will not use sercomm (HDLC protocol) to communicate with
+the host system. Sercomm is the transport used by osmocom-bb that runs on top
+of serial. See http://bb.osmocom.org/trac/wiki/nuttx-bb/run for detailed
+the usage of nuttx with sercomm.
+
+Loading NuttX
+=============
+
+The osmocom-bb wiki describes how to load NuttX. See
+http://bb.osmocom.org/trac/wiki/nuttx-bb for detailed information.
+The way that nuttx is loaded depends on the configuration (highram/compalram)
+and phone:
+
+o compalram is for the ramloader(for phone having a bootloader on flash)
+o highram is for phones having the romloader(if the phone has a bootrom)
+ or for loading in the ram trough a special loader(loaded first on ram
+ by talking to the ramloader) when having a ramloader(which can only
+ load 64k).
+
diff --git a/nuttx/configs/compal_e99/include/board.h b/nuttx/configs/compal_e99/include/board.h
new file mode 100644
index 000000000..1a1a7435d
--- /dev/null
+++ b/nuttx/configs/compal_e99/include/board.h
@@ -0,0 +1,6 @@
+/************************************************************************
+ * arch/board.h
+ *
+ * Supposed to be empty
+ *
+ ************************************************************************/
diff --git a/nuttx/configs/compal_e99/include/power.h b/nuttx/configs/compal_e99/include/power.h
new file mode 100644
index 000000000..9645fefd1
--- /dev/null
+++ b/nuttx/configs/compal_e99/include/power.h
@@ -0,0 +1,6 @@
+/************************************************************************
+ * arch/power.h
+ *
+ * Supposed to be empty
+ *
+ ************************************************************************/
diff --git a/nuttx/configs/compal_e99/nsh_compalram/Make.defs b/nuttx/configs/compal_e99/nsh_compalram/Make.defs
new file mode 100644
index 000000000..0a93ce752
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_compalram/Make.defs
@@ -0,0 +1,129 @@
+############################################################################
+# configs/c5471evm/nsh/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_SERCOMM_CONSOLE}","y")
+OSMODIR = $(TOPDIR)/../../osmocom-bb
+EXTRA_LIBS = $(OSMODIR)/src/target/firmware/comm/libcomm.a \
+ $(OSMODIR)/src/shared/libosmocore/build-target/src/.libs/libosmocore.a \
+ $(OSMODIR)/src/target/firmware/calypso/libcalypso.a \
+ $(OSMODIR)/src/target/firmware/comm/libcomm.a
+ # ^^^ Stupid hack! Why do I have to put it twice???
+endif
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(OSMODIR)/src/shared/libosmocore/include -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh_compalram/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/compal_e99/nsh_compalram/appconfig b/nuttx/configs/compal_e99/nsh_compalram/appconfig
new file mode 100644
index 000000000..8df90adb0
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_compalram/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/compal_e99/nsh_compalram/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# NSH shell
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+CONFIGURED_APPS += examples/nsh
+
+# Path to example in apps/examples
+CONFIGURED_APPS += examples/hello
+CONFIGURED_APPS += vsn/poweroff
diff --git a/nuttx/configs/compal_e99/nsh_compalram/defconfig b/nuttx/configs/compal_e99/nsh_compalram/defconfig
new file mode 100644
index 000000000..5bd924d7d
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_compalram/defconfig
@@ -0,0 +1,282 @@
+############################################################################
+# configs/compal_e99/nsh_compalram/defconfig
+#
+# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="calypso"
+CONFIG_ARCH_CHIP_CALYPSO=y
+CONFIG_ARCH_BOARD="compal_e99"
+CONFIG_ARCH_BOARD_COMPALE99=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_MM_REGIONS=2
+CONFIG_HEAP2_BASE=0x01000000
+CONFIG_HEAP2_SIZE=2097152
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_INTERRUPTSTACK=1024
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=8650752
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERCOMM_CONSOLE=n
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+CONFIG_STDIO_LINE_BUFFER=y
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+# SPI driver
+#
+CONFIG_SPI_OWNBUS=y
+CONFIG_SPI_EXCHANGE=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=4
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/hello
+CONFIG_EXAMPLES_HELLO_BUILTIN=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_STACKSIZE=4096
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_BUILTIN_APPS=y
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/compal_e99/nsh_compalram/ld.script b/nuttx/configs/compal_e99/nsh_compalram/ld.script
new file mode 100644
index 000000000..52554ddac
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_compalram/ld.script
@@ -0,0 +1,126 @@
+/*
+ * Linker script for running from internal SRAM on Compal phones
+ *
+ * This script is tailored specifically to the requirements imposed
+ * on us by the Compal bootloader.
+ *
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(__start)
+MEMORY
+{
+ /* compal-loaded binary: our text, initialized data */
+ LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00020000
+ /* compal-loaded binary: our unitialized data, stacks, heap */
+ IRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x00020000
+}
+SECTIONS
+{
+ . = 0x800000;
+
+ /* romloader data section, contains passthru interrupt vectors */
+ .compal.loader (NOLOAD) : { . = 0x100; } > LRAM
+
+ /* image signature (prepended by osmocon according to phone type) */
+ .compal.header (NOLOAD) : { . = 4; } > LRAM
+
+ /* initialization code */
+ . = ALIGN(4);
+ .text.start : {
+ PROVIDE(__start = .);
+ KEEP(*(.text.start))
+ *(.text.start)
+ } > LRAM
+
+ /* exception vectors from 0x80001c to 0x800034 */
+ .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) {
+ KEEP(*(.text.exceptions))
+ * (.text.exceptions)
+ . = ALIGN(4);
+ } > LRAM
+ PROVIDE(_exceptions = LOADADDR(.text.exceptions));
+
+ /* code */
+ . = ALIGN(4);
+ .text (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) :
+ AT (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) {
+ /* regular code */
+ *(.text*)
+ /* always-in-ram code */
+ *(.ramtext*)
+ /* gcc voodoo */
+ *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
+ . = ALIGN(4);
+ } > LRAM
+ PROVIDE(_text_start = LOADADDR(.text));
+ PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text));
+
+ /* constructor pointers */
+ .ctors : {
+ /* ctor count */
+ LONG(SIZEOF(.ctors) / 4 - 2)
+ /* ctor pointers */
+ KEEP(*(SORT(.ctors)))
+ /* end of list */
+ LONG(0)
+ } > LRAM
+ PROVIDE(_ctor_start = LOADADDR(.ctors));
+ PROVIDE(_ctor_end = LOADADDR(.ctors) + SIZEOF(.ctors));
+
+ /* destructor pointers */
+ .dtors : {
+ /* dtor count */
+ LONG(SIZEOF(.dtors) / 4 - 2)
+ /* dtor pointers */
+ KEEP(*(SORT(.dtors)))
+ /* end of list */
+ LONG(0)
+ } > LRAM
+ PROVIDE(_dtor_start = LOADADDR(.dtors));
+ PROVIDE(_dtor_end = LOADADDR(.dtors) + SIZEOF(.dtors));
+
+ /* read-only data */
+ . = ALIGN(4);
+ .rodata : {
+ *(.rodata*)
+ } > LRAM
+ PROVIDE(_rodata_start = LOADADDR(.rodata));
+ PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata));
+
+ /* initialized data */
+ . = ALIGN(4);
+ .data : {
+ *(.data)
+ } > LRAM
+ PROVIDE(_data_start = LOADADDR(.data));
+ PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data));
+
+ /* pic offset tables */
+ . = ALIGN(4);
+ .got : {
+ *(.got)
+ *(.got.plt) *(.igot.plt) *(.got) *(.igot)
+ } > LRAM
+ PROVIDE(_got_start = LOADADDR(.got));
+ PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got));
+
+ /* uninitialized data */
+ .bss (NOLOAD) : {
+ . = ALIGN(4);
+ __bss_start = .;
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ _ebss = ABSOLUTE(.);
+ } > IRAM
+ . = ALIGN(4);
+ __bss_end = .;
+ PROVIDE(_bss_start = __bss_start);
+ PROVIDE(_bss_end = __bss_end);
+
+ /* end of image */
+ . = ALIGN(4);
+ _end = .;
+ PROVIDE(end = .);
+}
diff --git a/nuttx/configs/compal_e99/nsh_compalram/setenv.sh b/nuttx/configs/compal_e99/nsh_compalram/setenv.sh
new file mode 100644
index 000000000..0693ede0a
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_compalram/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/compal_e99/nsh_highram/Make.defs b/nuttx/configs/compal_e99/nsh_highram/Make.defs
new file mode 100644
index 000000000..d22675f17
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_highram/Make.defs
@@ -0,0 +1,129 @@
+############################################################################
+# configs/c5471evm/nsh/Make.defs
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_SERCOMM_CONSOLE}","y")
+OSMODIR = $(TOPDIR)/../../osmocom-bb
+EXTRA_LIBS = $(OSMODIR)/src/target/firmware/comm/libcomm.a \
+ $(OSMODIR)/src/shared/libosmocore/build-target/src/.libs/libosmocore.a \
+ $(OSMODIR)/src/target/firmware/calypso/libcalypso.a \
+ $(OSMODIR)/src/target/firmware/comm/libcomm.a
+ # ^^^ Stupid hack! Why do I have to put it twice???
+endif
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
+endif
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(OSMODIR)/src/shared/libosmocore/include -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh_highram/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/compal_e99/nsh_highram/appconfig b/nuttx/configs/compal_e99/nsh_highram/appconfig
new file mode 100644
index 000000000..241253f8c
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_highram/appconfig
@@ -0,0 +1,49 @@
+############################################################################
+# configs/compal_e99/nsh_highram/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# NSH shell
+CONFIGURED_APPS += examples/nsh
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+
+# Path to example in apps/examples
+#CONFIGURED_APPS += examples/hello #fails not finding hello_main despite of good config
+CONFIGURED_APPS += vsn/poweroff
+CONFIGURED_APPS += examples/ostest
+CONFIGURED_APPS += examples/nxtext
+CONFIGURED_APPS += examples/nxhello
+CONFIGURED_APPS += examples/nxlines
+CONFIGURED_APPS += examples/nximage
diff --git a/nuttx/configs/compal_e99/nsh_highram/defconfig b/nuttx/configs/compal_e99/nsh_highram/defconfig
new file mode 100644
index 000000000..e3f3dd816
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_highram/defconfig
@@ -0,0 +1,326 @@
+############################################################################
+# configs/compal_e99/nsh_highram/defconfig
+#
+# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="calypso"
+CONFIG_ARCH_CHIP_CALYPSO=y
+CONFIG_ARCH_BOARD="compal_e99"
+CONFIG_ARCH_BOARD_COMPALE99=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ROM_VECTORS=n
+CONFIG_MM_REGIONS=2
+CONFIG_HEAP2_BASE=0x01000000
+CONFIG_HEAP2_SIZE=2097152
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_INTERRUPTSTACK=1024
+CONFIG_ARCH_STACKDUMP=y
+
+CONFIG_DRAM_START=0
+CONFIG_DRAM_SIZE=8650752
+
+#
+# C5471 specific device driver settings
+#
+CONFIG_SERCOMM_CONSOLE=n
+CONFIG_SERIAL_IRDA_CONSOLE=n
+CONFIG_UART_IRDA_HWFLOWCONTROL=n
+CONFIG_UART_MODEM_HWFLOWCONTROL=n
+CONFIG_UART_IRDA_RXBUFSIZE=256
+CONFIG_UART_MODEM_RXBUFSIZE=256
+CONFIG_UART_IRDA_TXBUFSIZE=256
+CONFIG_UART_MODEM_TXBUFSIZE=256
+CONFIG_UART_IRDA_BAUD=115200
+CONFIG_UART_MODEM_BAUD=115200
+CONFIG_UART_IRDA_BITS=8
+CONFIG_UART_MODEM_BITS=8
+CONFIG_UART_IRDA_PARITY=0
+CONFIG_UART_MODEM_PARITY=0
+CONFIG_UART_IRDA_2STOP=0
+CONFIG_UART_MODEM_2STOP=0
+CONFIG_STDIO_LINE_BUFFER=y
+
+#
+# C5471 Ethernet Driver settings
+CONFIG_C5471_NET_STATS=n
+ETHERNET_PHY_LU3X31T_T64=1
+ETHERNET_PHY_AC101L=2
+CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64
+CONFIG_NET_C5471_AUTONEGOTIATION=y
+CONFIG_NET_C5471_BASET100=n
+CONFIG_NET_C5471_BASET10=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+# SPI driver
+#
+CONFIG_SPI_OWNBUS=y
+CONFIG_SPI_EXCHANGE=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=4
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_STACKSIZE=4096
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_BUILTIN_APPS=y
+
+#
+# Settings for examples/hello
+CONFIG_EXAMPLES_HELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXTEXT_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXLINES_BUILTIN=y
+
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=2
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4
+
+CONFIG_EXAMPLES_NXTEXT_NOGETRUN=y
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_BGFONTID=14
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=y
+#CONFIG_EXAMPLES_NXLINES_EXTERNINIT=y
+#CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=y
+#CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=y
+#CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=y
+
+# LCD Drivers settings
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_SSD1783=y
+
+#
+# Graphics
+CONFIG_NX=y
+CONFIG_NXCONSOLE=n
+CONFIG_NX_KBD=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_NOGETRUN=y
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_DEVNO=0
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/compal_e99/nsh_highram/ld.script b/nuttx/configs/compal_e99/nsh_highram/ld.script
new file mode 100644
index 000000000..db72f251a
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_highram/ld.script
@@ -0,0 +1,128 @@
+/*
+ * Linker script for running from internal SRAM on Compal phones
+ *
+ * This script is tailored specifically to the requirements imposed
+ * on us by the Compal bootloader.
+ *
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(__start)
+MEMORY
+{
+ /* 0x800000-0xa00000 */
+ /* compal-loaded binary: our text, initialized data */
+ LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00020000
+ TRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x0001d000
+ /* compal-loaded binary: our unitialized data, stacks, heap */
+ IRAM (rw) : ORIGIN = 0x0083d000, LENGTH = 0x00002000
+}
+SECTIONS
+{
+ . = 0x800000;
+
+ /* romloader data section, contains passthru interrupt vectors */
+ .compal.loader (NOLOAD) : { . = 0x100; } > LRAM
+
+ /* image signature (prepended by osmocon according to phone type) */
+ .compal.header (NOLOAD) : { . = 4; } > LRAM
+
+ /* initialization code */
+ . = ALIGN(4);
+ .text.start : {
+ PROVIDE(__start = .);
+ KEEP(*(.text.start))
+ *(.text.start)
+ } > TRAM
+
+ /* exception vectors from 0x80001c to 0x800034 */
+ .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) {
+ KEEP(*(.text.exceptions))
+ * (.text.exceptions)
+ . = ALIGN(4);
+ } > LRAM
+ PROVIDE(_exceptions = LOADADDR(.text.exceptions));
+
+ /* code */
+ . = ALIGN(4);
+ .text (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) :
+ AT (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) {
+ /* regular code */
+ *(.text*)
+ /* always-in-ram code */
+ *(.ramtext*)
+ /* gcc voodoo */
+ *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
+ . = ALIGN(4);
+ } > TRAM
+ PROVIDE(_text_start = LOADADDR(.text));
+ PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text));
+
+ /* constructor pointers */
+ .ctors : {
+ /* ctor count */
+ LONG(SIZEOF(.ctors) / 4 - 2)
+ /* ctor pointers */
+ KEEP(*(SORT(.ctors)))
+ /* end of list */
+ LONG(0)
+ } > TRAM
+ PROVIDE(_ctor_start = LOADADDR(.ctors));
+ PROVIDE(_ctor_end = LOADADDR(.ctors) + SIZEOF(.ctors));
+
+ /* destructor pointers */
+ .dtors : {
+ /* dtor count */
+ LONG(SIZEOF(.dtors) / 4 - 2)
+ /* dtor pointers */
+ KEEP(*(SORT(.dtors)))
+ /* end of list */
+ LONG(0)
+ } > TRAM
+ PROVIDE(_dtor_start = LOADADDR(.dtors));
+ PROVIDE(_dtor_end = LOADADDR(.dtors) + SIZEOF(.dtors));
+
+ /* read-only data */
+ . = ALIGN(4);
+ .rodata : {
+ *(.rodata*)
+ } > TRAM
+ PROVIDE(_rodata_start = LOADADDR(.rodata));
+ PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata));
+
+ /* initialized data */
+ . = ALIGN(4);
+ .data : {
+ *(.data)
+ } > TRAM
+ PROVIDE(_data_start = LOADADDR(.data));
+ PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data));
+
+ /* pic offset tables */
+ . = ALIGN(4);
+ .got : {
+ *(.got)
+ *(.got.plt) *(.igot.plt) *(.got) *(.igot)
+ } > TRAM
+ PROVIDE(_got_start = LOADADDR(.got));
+ PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got));
+
+ /* uninitialized data */
+ .bss (NOLOAD) : {
+ . = ALIGN(4);
+ __bss_start = .;
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ _ebss = ABSOLUTE(.);
+ } > IRAM
+ . = ALIGN(4);
+ __bss_end = .;
+ PROVIDE(_bss_start = __bss_start);
+ PROVIDE(_bss_end = __bss_end);
+
+ /* end of image */
+ . = ALIGN(4);
+ _end = .;
+ PROVIDE(end = .);
+}
diff --git a/nuttx/configs/compal_e99/nsh_highram/setenv.sh b/nuttx/configs/compal_e99/nsh_highram/setenv.sh
new file mode 100644
index 000000000..0693ede0a
--- /dev/null
+++ b/nuttx/configs/compal_e99/nsh_highram/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# c5471evm/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/compal_e99/src/Makefile b/nuttx/configs/compal_e99/src/Makefile
new file mode 100644
index 000000000..2a5ad6783
--- /dev/null
+++ b/nuttx/configs/compal_e99/src/Makefile
@@ -0,0 +1,80 @@
+############################################################################
+# configs/compal_e99/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Copyright (C) 2011 Stefan Richter. All rights reserved.
+# Author: Stefan Richter <ichgeh@l--putt.de>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = dummy.c ssd1783.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/compal_e99/src/dummy.c b/nuttx/configs/compal_e99/src/dummy.c
new file mode 100644
index 000000000..69853a130
--- /dev/null
+++ b/nuttx/configs/compal_e99/src/dummy.c
@@ -0,0 +1 @@
+/* no libboard.a otherwise */
diff --git a/nuttx/configs/compal_e99/src/ssd1783.c b/nuttx/configs/compal_e99/src/ssd1783.c
new file mode 100644
index 000000000..41bbe11f5
--- /dev/null
+++ b/nuttx/configs/compal_e99/src/ssd1783.c
@@ -0,0 +1,523 @@
+/************************************************************************************
+ * nuttx/configs/compal_e99/src/ssd1783.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ * Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+ * Alan Carvalho de Assis <acassis@gmail.com>
+ *
+ * This driver for SSD1783 used part of SSD1783 driver developed by
+ * Christian Vogel <vogelchr@vogel.cx> for Osmocom-BB and relicensed
+ * to BSD with permission from author.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/fb.h>
+
+#include <sys/types.h>
+#include <assert.h>
+#include <debug.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <arch/calypso/uwire.h>
+#include <arch/calypso/clock.h>
+
+#include "up_arch.h"
+#include "ssd1783.h"
+
+/* Color depth and format */
+#define LCD_BPP 16
+#define LCD_COLORFMT FB_FMT_RGB16_555
+
+/* Display Resolution */
+# define LCD_XRES 98
+# define LCD_YRES 67
+
+/* Debug ******************************************************************************/
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg(format, arg...) vdbg(format, ##arg)
+#else
+# define lcddbg(x...)
+#endif
+
+/** This should be put elsewhere */
+#ifdef __CC_ARM /* ARM Compiler */
+#define lcd_inline static __inline
+#elif defined (__ICCARM__) /* for IAR Compiler */
+#define lcd_inline inline
+#elif defined (__GNUC__) /* GNU GCC Compiler */
+#define lcd_inline static __inline
+#else
+#define lcd_inline static
+#endif
+
+static void lcd_clear(void);
+static void fb_ssd1783_send_cmdlist(const struct ssd1783_cmdlist *p);
+
+/* LCD Data Transfer Methods */
+int lcd_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels);
+int lcd_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels);
+
+/* LCD Configuration */
+static int lcd_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo);
+static int lcd_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo);
+
+/* LCD RGB Mapping */
+#ifdef CONFIG_FB_CMAP
+# error "RGB color mapping not supported by this driver"
+#endif
+
+/* Cursor Controls */
+#ifdef CONFIG_FB_HWCURSOR
+# error "Cursor control not supported by this driver"
+#endif
+
+/* LCD Specific Controls */
+static int lcd_getpower(struct lcd_dev_s *dev);
+static int lcd_setpower(struct lcd_dev_s *dev, int power);
+static int lcd_getcontrast(struct lcd_dev_s *dev);
+static int lcd_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
+
+/* Initialization (LCD ctrl / backlight) */
+static inline void lcd_initialize(void);
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is working memory allocated by the LCD driver for each LCD device
+ * and for each color plane. This memory will hold one raster line of data.
+ * The size of the allocated run buffer must therefore be at least
+ * (bpp * xres / 8). Actual alignment of the buffer must conform to the
+ * bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
+ */
+
+static uint16_t g_runbuffer[LCD_XRES];
+
+/* This structure describes the overall LCD video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{ .fmt = LCD_COLORFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */
+ .xres = LCD_XRES, /* Horizontal resolution in pixel columns */
+ .yres = LCD_YRES, /* Vertical resolutiSend a command list to the LCD panelon in pixel rows */
+ .nplanes = 1, /* Number of color planes supported */
+};
+
+/* This is the standard, NuttX Plane information object */
+
+static const struct lcd_planeinfo_s g_planeinfo =
+{ .putrun = lcd_putrun, /* Put a run into LCD memory */
+// .getrun = lcd_getrun, /* Get a run from LCD memory */
+ .buffer = (uint8_t*) g_runbuffer, /* Run scratch buffer */
+ .bpp = LCD_BPP, /* Bits-per-pixel */
+};
+
+/* This is the standard, NuttX LCD driver object */
+
+static struct ssd1783_dev_s g_lcddev =
+{ .dev =
+ {
+ /* LCD Configuration */
+
+ .getvideoinfo = lcd_getvideoinfo,
+ .getplaneinfo = lcd_getplaneinfo,
+
+/* LCD RGB Mapping -- Not supported */
+/* Cursor Controls -- Not supported */
+
+/* LCD Specific Controls */
+ .getpower = lcd_getpower,
+ .setpower = lcd_setpower,
+// .getcontrast = lcd_getcontrast,
+// .setcontrast = lcd_setcontrast,
+ },
+ .power=0
+};
+
+/* we trust gcc to move this expensive bitshifting out of
+ the loops in the drawing funtcions */
+static uint8_t rgb_to_pixel(uint16_t color)
+{
+ uint8_t ret;
+
+ ret = (FB_COLOR_TO_R(color) & 0xe0); /* 765 = RRR */
+ ret |= (FB_COLOR_TO_G(color) & 0xe0) >> 3; /* 432 = GGG */
+ ret |= (FB_COLOR_TO_B(color) & 0xc0) >> 6; /* 10 = BB */
+
+ return ret;
+}
+
+/* somehow the palette is messed up, RRR seems to have the
+ bits reversed! R0 R1 R2 G G G B B ---> R2 R1 R0 G G G B B */
+uint8_t fix_rrr(uint8_t v){
+ return (v & 0x5f) | (v & 0x80) >> 2 | (v & 0x20) << 2;
+}
+
+
+lcd_inline void write_data(uint16_t datain)
+{
+ uint16_t dataout = 0x0100 | fix_rrr(rgb_to_pixel(datain));
+ uwire_xfer(SSD1783_DEV_ID,SSD1783_UWIRE_BITLEN,&dataout, NULL);
+}
+
+static void fb_ssd1783_send_cmdlist(const struct ssd1783_cmdlist *p)
+{
+ int i=0;
+
+ while(p->is_cmd != END)
+ {
+ uint16_t sendcmd = p->data;
+ if(p->is_cmd == DATA)
+ sendcmd |= 0x0100; /* 9th bit is cmd/data flag */
+ uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &sendcmd, NULL);
+ p++;
+ i++;
+ }
+}
+
+static void lcd_write_prepare(unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2)
+{;
+ DEBUGASSERT( (x1 < x2 )&& (y1 < y2));
+ struct ssd1783_cmdlist prepare_disp_write_cmds[] = {
+ { CMD, 0x15 }, /* set column address */
+ { DATA, x1 },
+ { DATA, x2 },
+ { CMD, 0x75 }, /* set page address (Y) */
+ { DATA, y1 },
+ { DATA, y2 },
+ { CMD, 0x5c }, /* enter write display ram mode */
+ { END, 0x00 }
+ };
+ dbg("x1:%d, x2:%d, y1:%d, y2:%d\n",x1, x2,y1, y2);
+ fb_ssd1783_send_cmdlist(prepare_disp_write_cmds);
+}
+
+/**************************************************************************************
+ * Name: lcd_putrun
+ *
+ * Description:
+ * This method can be used to write a partial raster line to the LCD:
+ *
+ * row - Starting row to write to (range: 0 <= row < yres)
+ * col - Starting column to write to (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer containing the run to be written to the LCD
+ * npixels - The number of pixels to write to the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+int lcd_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels)
+{
+ int i;
+ FAR const uint16_t *src = (FAR const uint16_t*) buffer;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+
+ /* Write the run to GRAM. */
+ lcd_write_prepare(col,col+npixels, row,row+1);
+
+ for (i = 0; i < npixels; i++)
+ {
+ write_data(*src++);
+ }
+ fb_ssd1783_send_cmdlist(nop);
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getrun
+ *
+ * Description:
+ * This method can be used to read a partial raster line from the LCD:
+ *
+ * row - Starting row to read from (range: 0 <= row < yres)
+ * col - Starting column to read read (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer in which to return the run read from the LCD
+ * npixels - The number of pixels to read from the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+int lcd_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: lcd_getvideoinfo
+ *
+ * Description:
+ * Get information about the LCD video controller configuration.
+ *
+ **************************************************************************************/
+
+static int lcd_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ DEBUGASSERT(dev && vinfo);gvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
+ g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getplaneinfo
+ *
+ * Description:
+ * Get information about the configuration of each LCD color plane.
+ *
+ **************************************************************************************/
+
+static int lcd_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo)
+{
+ DEBUGASSERT(dev && pinfo && planeno == 0);gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
+ memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getpower
+ *
+ * Description:
+ * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int lcd_getpower(struct lcd_dev_s *dev)
+{
+ gvdbg("power: %d\n", 0);
+ return g_lcddev.power;
+}
+
+/**************************************************************************************
+ * Name: lcd_setpower
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on).
+ * Used here to set pwm duty on timer used for backlight.
+ *
+ **************************************************************************************/
+
+static int lcd_setpower(struct lcd_dev_s *dev, int power)
+{
+ uint16_t reg;
+
+ if (g_lcddev.power == power) {
+ return OK;
+ }
+
+ gvdbg("power: %d\n", power);
+ DEBUGASSERT(power <= CONFIG_LCD_MAXPOWER);
+
+ /* Set new power level */
+ reg = getreg16(ASIC_CONF_REG);
+ if (power)
+ {
+ reg = getreg16(ASIC_CONF_REG);
+ /* LCD Set I/O(3) / SA0 to I/O(3) mode */
+ reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ;
+ /* don't set function pins to I2C Mode, C155 uses UWire */
+ /* TWL3025: Set SPI+RIF RX clock to rising edge */
+ reg |= (1 << 13) | (1 << 14);
+ putreg16(reg, ASIC_CONF_REG);
+
+ /* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */
+ /* FIXME: Put the display backlight control to backlight.c */
+ reg = getreg16(IO_CNTL_REG);
+ reg &= ~( (1 << 3) | (1 << 1));
+ putreg16(reg, IO_CNTL_REG);
+
+ /* LCD Set I/O(3) output low */
+ reg = getreg16(ARMIO_LATCH_OUT);
+ reg &= ~(1 << 3);
+ reg |= (1 << 1);
+ putreg16(reg, ARMIO_LATCH_OUT);
+ }
+ else
+ {
+ gvdbg("powering LCD off...\n");
+ /* Switch pin from PWL to LT */
+ reg &= ~ASCONF_PWL_ENA;
+ putreg8(reg, ASIC_CONF_REG);
+ /* Disable pwl */
+ putreg8(0x00, PWL_REG(PWL_CTRL));
+ }
+ return OK;
+}
+
+
+/**************************************************************************************
+ * Name: lcd_getcontrast
+ *
+ * Description:
+ * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int lcd_getcontrast(struct lcd_dev_s *dev)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: lcd_setcontrast
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int lcd_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: lcd_lcdinitialize
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+static inline void lcd_initialize(void)
+{
+ gvdbg("%s: initializing LCD.\n",__FUNCTION__);
+ calypso_reset_set(RESET_EXT, 0);
+ usleep(5000);
+ uwire_init();
+ usleep(5000);
+ fb_ssd1783_send_cmdlist(ssd1783_initdata);
+}
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ gvdbg("Initializing\n");
+
+ lcd_initialize();
+
+ /* Clear the display */
+ lcd_clear();
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return &g_lcddev.dev;
+}
+
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Un-initialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ lcd_setpower(&g_lcddev.dev, 0);
+}
+
+/**************************************************************************************
+ * Name: lcd_clear
+ *
+ * Description:
+ * Fill the LCD ctrl memory with given color
+ *
+ **************************************************************************************/
+
+void lcd_clear()
+{
+ struct ssd1783_cmdlist prepare_disp_write_cmds[] = {
+ { CMD, 0x8E },
+ { DATA, 0x00 },
+ { DATA, 0x00 },
+ { DATA, LCD_XRES },
+ { DATA, LCD_YRES },
+ { END, 0x00 }
+ };
+
+ struct ssd1783_cmdlist nop[] = {
+ { CMD, 0x25 }, // NOP command
+ { END, 0x00 }
+ };
+
+ fb_ssd1783_send_cmdlist(prepare_disp_write_cmds);
+ fb_ssd1783_send_cmdlist(nop);
+}
diff --git a/nuttx/configs/compal_e99/src/ssd1783.h b/nuttx/configs/compal_e99/src/ssd1783.h
new file mode 100644
index 000000000..50ec44925
--- /dev/null
+++ b/nuttx/configs/compal_e99/src/ssd1783.h
@@ -0,0 +1,110 @@
+#ifndef SSD1783_H_
+#define SSD1783_H_
+
+#include <nuttx/lcd/lcd.h>
+
+#define FB_COLOR_TO_R(v) (((v)>>16) & 0xff)
+#define FB_COLOR_TO_G(v) (((v)>> 8) & 0xff)
+#define FB_COLOR_TO_B(v) ( (v) & 0xff)
+
+#define SSD1783_UWIRE_BITLEN 9
+#define SSD1783_DEV_ID 0
+
+#define ARMIO_LATCH_OUT 0xfffe4802
+#define IO_CNTL_REG 0xfffe4804
+#define ASIC_CONF_REG 0xfffef008
+
+#define ASCONF_PWL_ENA (1 << 4)
+
+/* begin backlight.c */
+#define BASE_ADDR_PWL 0xfffe8000
+#define PWL_REG(m) (BASE_ADDR_PWL + (m))
+
+enum pwl_reg {
+ PWL_LEVEL = 0,
+ PWL_CTRL = 1,
+};
+
+enum ssd1783_cmdflag { CMD, DATA, END };
+
+struct ssd1783_cmdlist {
+ enum ssd1783_cmdflag is_cmd:8; /* 1: is a command, 0: is data, 2: end marker! */
+ uint8_t data; /* 8 bit to send to LC display */
+} __attribute__((packed));
+
+static const struct ssd1783_cmdlist nop[] = {
+ { CMD, 0x25 }, // NOP command
+ { END, 0x00 }
+};
+
+static const struct ssd1783_cmdlist
+ssd1783_initdata[] = {
+ { CMD, 0xD1 }, /* CMD set internal oscillator on */
+ { CMD, 0x94 }, /* CMD leave sleep mode */
+ { CMD, 0xbb }, /* CMD Set COM Output Scan Direction: */
+ { DATA, 0x01 }, /* DATA: 01: COM0-79, then COM159-80 */
+/* -------- DIFFERENT FROM ORIGINAL CODE: -------------- */
+/* we use 8bit per pixel packed RGB 332 */
+ { CMD, 0xbc }, /* CMD Set Data Output Scan Direction */
+ { DATA, 0x00 }, /* DATA: column scan, normal rotation, normal display */
+ { DATA, 0x00 }, /* DATA: RGB color arrangement R G B R G B ... */
+/*-->*/ { DATA, 0x01 }, /* DATA: 8 bit per pixel mode MSB <RRRGGGBB> LSB */
+/* --------- /DIFFERENT ---------- */
+ { CMD, 0xce }, /* CMD Set 256 Color Look Up Table LUT */
+ { DATA, 0x00 }, /* DATA red 000 */
+ { DATA, 0x03 }, /* DATA red 001 */
+ { DATA, 0x05 }, /* DATA red 010 */
+ { DATA, 0x07 }, /* DATA red 011 */
+ { DATA, 0x09 }, /* DATA red 100 */
+ { DATA, 0x0b }, /* DATA red 101 */
+ { DATA, 0x0d }, /* DATA red 110 */
+ { DATA, 0x0f }, /* DATA red 111 */
+ { DATA, 0x00 }, /* DATA green 000 */
+ { DATA, 0x03 }, /* DATA green 001 */
+ { DATA, 0x05 }, /* DATA green 010 */
+ { DATA, 0x07 }, /* DATA green 011 */
+ { DATA, 0x09 }, /* DATA green 100 */
+ { DATA, 0x0b }, /* DATA green 101 */
+ { DATA, 0x0d }, /* DATA green 110 */
+ { DATA, 0x0f }, /* DATA green 111 */
+ { DATA, 0x00 }, /* DATA blue 00 */
+ { DATA, 0x05 }, /* DATA blue 01 */
+ { DATA, 0x0a }, /* DATA blue 10 */
+ { DATA, 0x0f }, /* DATA blue 11 */
+ { CMD, 0xca }, /* CMD Set Display Control - Driver Duty Selection */
+ { DATA, 0xff }, // can't find description of the values in the original
+ { DATA, 0x10 }, // display/ssd1783.c in my datasheet :-(
+ { DATA, 0x01 }, //
+ { CMD, 0xab }, /* CMD Set Scroll Start */
+ { DATA, 0x00 }, /* DATA: Starting address at block 0 */
+ { CMD, 0x20 }, /* CMD Set power control register */
+ { DATA, 0x0b }, /* DATA: booster 6x, reference gen. & int regulator */
+ { CMD, 0x81 }, /* CMD Contrast Lvl & Int. Regul. Resistor Ratio */
+ { DATA, 0x29 }, /* DATA: contrast = 0x29 */
+ { DATA, 0x05 }, /* DATA: 0x05 = 0b101 -> 1+R2/R1 = 11.37 */
+ { CMD, 0xa7 }, /* CMD Invert Display */
+ { CMD, 0x82 }, /* CMD Set Temperature Compensation Coefficient */
+ { DATA, 0x00 }, /* DATA: Gradient is -0.10 % / degC */
+ { CMD, 0xfb }, /* CMD Set Biasing Ratio */
+ { DATA, 0x03 }, /* DATA: 1/10 bias */
+ { CMD, 0xf2 }, /* CMD Set Frame Frequency and N-line inversion */
+ { DATA, 0x08 }, /* DATA: 75 Hz (POR) */
+ { DATA, 0x06 }, /* DATA: n-line inversion: 6 lines */
+ { CMD, 0xf7 }, /* CMD Select PWM/FRC Select Full Col./8col mode */
+ { DATA, 0x28 }, /* DATA: always 0x28 */
+ { DATA, 0x8c }, /* DATA: 4bit PWM + 2 bit FRC */
+ { DATA, 0x05 }, /* DATA: full color mode */
+ { CMD, 0xaf }, /* CMD Display On */
+ { END, 0x00 }, /* MARKER: end of list */
+};
+
+struct ssd1783_dev_s
+{
+ /* Publicly visible device structure */
+ struct lcd_dev_s dev;
+
+ /* Private LCD-specific information follows */
+ uint8_t power; /* Current power setting */
+};
+
+#endif /* SSD1783_H_ */
diff --git a/nuttx/configs/demo9s12ne64/Kconfig b/nuttx/configs/demo9s12ne64/Kconfig
new file mode 100644
index 000000000..3f685365b
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_DEMOS92S12NEC64
+endif
+
diff --git a/nuttx/configs/demo9s12ne64/README.txt b/nuttx/configs/demo9s12ne64/README.txt
new file mode 100644
index 000000000..0b8f77690
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/README.txt
@@ -0,0 +1,374 @@
+README
+^^^^^^
+
+ This README discusses issues unique to NuttX configurations for the
+ Freescale DEMO9S12NE64 development board.
+
+CONTENTS
+^^^^^^^^
+ • MC9S12NE64 Features
+ • Development Environment
+ • NuttX Buildroot Toolchain
+ • FreeScale HCS12 Serial Monitor
+ • Soft Registers
+ • HCS12/DEMO9S12NEC64-specific Configuration Options
+ • Configurations
+
+MC9S12NE64 Features
+^^^^^^^^^^^^^^^^^^^
+
+ • 16-bit HCS12 core
+ - HCS12 CPU
+ - Upward compatible with M68HC11 instruction set
+ - Interrupt stacking and programmer’s model identical to M68HC11
+ - Instruction queue
+ - Enhanced indexed addressing
+ - Memory map and interface (MMC)
+ - Interrupt control (INT)
+ - Background debug mode (BDM)
+ - Enhanced debug12 module, including breakpoints and change-of-flow
+ trace buffer (DBG)
+ - Multiplexed expansion bus interface (MEBI) - available only in
+ 112-pin package version
+ • Wakeup interrupt inputs
+ - Up to 21 port bits available for wakeup interrupt function with
+ digital filtering
+ • Memory
+ - 64K bytes of FLASH EEPROM
+ - 8K bytes of RAM
+ • Analog-to-digital converter (ATD)
+ - One 8-channel module with 10-bit resolution
+ - External conversion trigger capability
+ • Timer module (TIM)
+ - 4-channel timer
+ - Each channel configurable as either input capture or output
+ compare
+ - Simple PWM mode
+ - Modulo reset of timer counter
+ - 16-bit pulse accumulator
+ - External event counting
+ - Gated time accumulation
+ • Serial interfaces
+ - Two asynchronous serial communications interface (SCI)
+ - One synchronous serial peripheral interface (SPI)
+ - One inter-IC bus (IIC)
+ • Ethernet Media access controller (EMAC)
+ - IEEE 802.3 compliant
+ - Medium-independent interface (MII)
+ - Full-duplex and half-duplex modes
+ - Flow control using pause frames
+ - MII management function
+ - Address recognition
+ - Frames with broadcast address are always accepted or always
+ rejected
+ - Exact match for single 48-bit individual (unicast) address
+ - Hash (64-bit hash) check of group (multicast) addresses
+ - Promiscuous mode
+ • Ethertype filter
+ • Loopback mode
+ • Two receive and one transmit Ethernet buffer interfaces
+ • Ethernet 10/100 Mbps transceiver (EPHY)
+ - IEEE 802.3 compliant
+ - Digital adaptive equalization
+ - Half-duplex and full-duplex
+ - Auto-negotiation next page ability
+ - Baseline wander (BLW) correction
+ - 125-MHz clock generator and timing recovery
+ - Integrated wave-shaping circuitry
+ - Loopback modes
+ • CRG (clock and reset generator module)
+ - Windowed COP watchdog
+ - Real-time interrupt
+ - Clock monitor
+ - Pierce oscillator
+ - Phase-locked loop clock frequency multiplier
+ - Limp home mode in absence of external clock
+ - 25-MHz crystal oscillator reference clock
+ • Operating frequency
+ - 50 MHz equivalent to 25 MHz bus speed for single chip
+ - 32 MHz equivalent to 16 MHz bus speed in expanded bus modes
+ • Internal 2.5-V regulator
+ - Supports an input voltage range from 3.3 V ± 5%
+ - Low-power mode capability
+ - Includes low-voltage reset (LVR) circuitry
+ • 80-pin TQFP-EP or 112-pin LQFP package
+ - Up to 70 I/O pins with 3.3 V input and drive capability (112-pin
+ package)
+ - Up to two dedicated 3.3 V input only lines (IRQ, XIRQ)
+ • Development support
+ - Single-wire background debug™ mode (BDM)
+ - On-chip hardware breakpoints
+ - Enhanced DBG debug features
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development
+ environment. The source has been built only using the GNU toolchain
+ (see below). Other toolchains will likely cause problems.
+
+NuttX Buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the HC12 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no HC12 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin
+ environments.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh demo9s12nec64/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/m9s12x-defconfig-3.3.6 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ If the make fails because it can't find the file to download, you may
+ have to locate the file on the internet and download it into the archives/
+ directory manually. For example, binutils-2.18 can be found here:
+ http://ftp.gnu.org/gnu/binutils/
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+FreeScale HCS12 Serial Monitor
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ General:
+ The NuttX HCS12 port is configured to use the Freescale HCS serial
+ monitor. This monitor supports primitive debug commands that allow
+ FLASH/EEPROM programming and debugging through an RS-232 serial
+ interface. The serial monior is 2Kb in size and resides in FLASH at
+ addresses 0xf800-0xffff. The monitor does not use any RAM other than
+ the stack itself.
+
+ AN2458
+ The serial monitor is described in detail in Freescale Application
+ Note AN2458.pdf.
+
+ COP:
+ The serial monitor uses the COP for the cold reset function and should
+ not be used by the application without some precautions (see AN2458).
+
+ Clocking:
+ The serial monitor sets the operating frequency to 24 MHz. This is
+ not altered by the NuttX start-up; doing so would interfere with the
+ operation of the serial monitor.
+
+ Memory Configuration:
+ Registers:
+ • Register space is located at 0x0000–0x03ff.
+ FLASH:
+ • FLASH memory is any address greater than 0x4000. All paged
+ addresses are assumed to be FLASH memory.
+ • Application code should exclude the 0xf780–0xff7f memory.
+ SRAM:
+ • RAM ends at 0x3FFF and builds down to the limit of the device’s
+ available RAM.
+ • The serial monitor's stack pointer is set to the end of RAM+1
+ (0x4000).
+ EEPROM:
+ • EEPROM (if the target device has any) is limited to the available
+ space between the registers and the RAM (0x0400–to start of RAM).
+ External Devices:
+ • External devices attached to the multiplexed external bus
+ interface are not supported
+
+ Serial Communications:
+ The serial monitor uses RS-232 serial communications through SCI0 at
+ 115,200 baud. The monitor must have exclusive use of this interface.
+ Access to the serial port is available through a monitor jump table.
+
+ Interrrupts:
+ The serial monitor redirects interrupt vectors to an unprotected
+ portion of FLASH just before the protected monitor program
+ (0xf780–0xf7fe). The monitor will automatically redirect vector
+ programming operations to these user vectors. The user code should
+ therefore keep the normal (non-monitor) vector locations
+ (0xff80–0xfffe).
+
+Soft Registers
+^^^^^^^^^^^^^^
+
+ The mc68hcs12 compilation is prone to errors like the following:
+
+ CC: lib_b16sin.c
+ lib_b16sin.c: In function `b16sin':
+ lib_b16sin.c:110: error: unable to find a register to spill in class `S_REGS'
+ lib_b16sin.c:110: error: this is the insn:
+ (insn:HI 41 46 44 8 (parallel [
+ (set (subreg:SI (reg:DI 58 [ rad ]) 4)
+ (reg/v:SI 54 [ rad ]))
+ (clobber (scratch:HI))
+ ]) 20 {movsi_internal} (insn_list 46 (nil))
+ (expr_list:REG_UNUSED (scratch:HI)
+ (expr_list:REG_NO_CONFLICT (reg/v:SI 54 [ rad ])
+ (nil))))
+ lib_b16sin.c:110: confused by earlier errors, bailing out
+
+ There are several ways that this error could be fixed:
+
+ 1. Increase the number of soft registers (i.e., "fake" registers defined
+ at fixed memory locations). This can be done by adding something like
+ -msoft-reg-count=4 to the CFLAGS. This approach was not taken
+ because:
+
+ - This slows hcs12 performance
+ - All of these soft registers wouil have to be saved and restored
+ on every interrupt and context switch.
+
+ 2. Lowering the optimization level by dropping -Os to -O2 or, more likely,
+ by removing -fomit-frame-pointer. Also not desireable becauase 99% of the
+ files that do not have this problem also increase in size. Special case
+ compilation with reduced optimization levels just for the files that need
+ it could be done, but this would complicate the make system.
+
+ 3. Restructuring files to reduce the complexity. If you add local variables
+ to hold intermediate computational results, this error can be eliminated.
+ This is the approach taken in NuttX. It has disadvantages only in that
+ (1) it takes some effort and good guessing to eliminate the problem, and (2)
+ the problem is not really eliminated -- it can and will re-occur when files
+ are changed or new files are added.
+
+ 4. Many files are built that are needed by DEM09S12NE64. Another very simple
+ option if those problem files are needed is to just remove the offending
+ files from the Make.defs file so that they no longer cause a problem.
+
+HCS12/DEMO9S12NEC64-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=hc
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_HC=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_HCS12=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=mc92s12nec64
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_MCS92S12NEC64
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=demo9s12nec64
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_DEMOS92S12NEC64 (for the Freescale DEMO9S12NE64 development board)
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed RAM.
+
+ CONFIG_DRAM_START - The start address of installed RAM
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ GPIO Interrupts
+
+ CONFIG_GPIO_IRQ - Enable general support for GPIO IRQs
+ CONFIG_HCS12_PORTG_INTS - Enable PortG IRQs
+ CONFIG_HCS12_PORTH_INTS - Enable PortH IRQs
+ CONFIG_HCS12_PORTJ_INTS - Enable PortJ IRQs
+
+ HCS12 build options:
+
+ CONFIG_HCS12_SERIALMON - Indicates that the target systems uses
+ the Freescale serial bootloader.
+
+ CONFIG_HCS12_NONBANKED - Indicates that the target systems does not
+ support banking. Only short calls are made; one fixed page is
+ presented the the paging window. Only 48Kb of FLASH is usable
+ in this configuration: pages 3e, 3d, then 3f will appear as a
+ contiguous address space in memory.
+
+ HCS12 Sub-system support
+
+ CONFIG_HCS12_SCI0
+ CONFIG_HCS12_SCI1
+
+ HCS12 specific device driver settings:
+
+ CONFIG_SCIn_SERIAL_CONSOLE - selects SCIn for the console and ttys0
+ (default is the SCI0).
+
+ CONFIG_SCIn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+
+ CONFIG_SCIn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+
+ CONFIG_SCIn_BAUD - The configure BAUD of the UART.
+
+ CONFIG_SCIn_BITS - The number of bits. Must be either 7 or 8.
+
+ CONFIG_SCIn_PARTIY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0
+
+ CONFIG_SCIn_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Freescale HCS12 configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh demo9s12nec64/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
diff --git a/nuttx/configs/demo9s12ne64/include/board.h b/nuttx/configs/demo9s12ne64/include/board.h
new file mode 100644
index 000000000..501b2f8e0
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/include/board.h
@@ -0,0 +1,143 @@
+/************************************************************************************
+ * configs/demo9s12ne64/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Frequency of the crystal oscillator */
+
+#define HCS12_OSCCLK 16000000 /* 16MHz */
+
+/* PLL Settings
+ *
+ * SYNR register controls the multiplication factor of the PLL. If the PLL is on, the
+ * count in the loop divider (SYNR) register effectively multiplies up the PLL clock
+ * (PLLCLK) from the reference frequency by 2 x (SYNR+1). PLLCLK will not be below
+ * the minimum VCO frequency (fSCM).
+ *
+ * The REFDV register provides a finer granularity for the PLL multiplier steps. The
+ * count in the reference divider divides OSCCLK frequency by REFDV + 1.
+ *
+ * PLLCLK = 2 * OSCCLK * (SYNR + 1) / (REFDV + 1)
+ *
+ * If (PLLSEL = 1), Bus Clock = PLLCLK / 2
+ */
+
+#define HCS12_SYNR_VALUE 0x15
+#define HCS12_REFDV_VALUE 0x15
+#define HCS12_PLLCLK (2*HCS12_OSCCLK*(HCS12_SYNR+1)/(HCS12_REFDV+1))
+#define HCS12_BUSCLK (HSC12_PLLCLK/2)
+
+/* LED definitions ******************************************************************/
+
+/* The DEMO9S12NE64 board has 2 LEDs that we will encode as: */
+
+#define LED_STARTED 1 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED1 */
+#define LED_IRQSENABLED 1 /* LED1 */
+#define LED_STACKCREATED 1 /* LED1 */
+#define LED_INIRQ 2 /* LED1 + LED2 */
+#define LED_SIGNAL 2 /* LED1 + LED2 */
+#define LED_ASSERTION 2 /* LED1 + LED2 */
+#define LED_PANIC 7 /* LED2 + N/C */
+
+/* Button definitions ***************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: hcs12_boardinitialize
+ *
+ * Description:
+ * All HCS12 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void hcs12_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the state of all buttons. up_buttons()
+ * returns an bit set with bits corresponding to the state of each button.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/demo9s12ne64/ostest/Make.defs b/nuttx/configs/demo9s12ne64/ostest/Make.defs
new file mode 100644
index 000000000..58d502e96
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/ostest/Make.defs
@@ -0,0 +1,153 @@
+############################################################################
+# configs/demo9s12ne64/ostest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+# NuttX buildroot under Linux or Cygwin
+
+CROSSDEV = m9s12x-elf-
+MAXOPTIMIZATION = -Os
+WINTOOL = n
+
+ifeq ($(CONFIG_HCS12_NONBANKED),y)
+ ARCHCPUFLAGS = -m9s12x -mshort -mnolong-calls
+ LDSCRIPT = ld.script.nonbanked
+else
+ ARCHCPUFLAGS = -m9s12x -mshort -mlong-calls
+ LDSCRIPT = ld.script.banked
+endif
+
+ifneq ($(CONFIG_HCS12_MSOFTREGS),0)
+ ARCHCPUFLAGS += -msoft-reg-count=$(CONFIG_HCS12_MSOFTREGS)
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/demo9s12ne64/ostest/appconfig b/nuttx/configs/demo9s12ne64/ostest/appconfig
new file mode 100644
index 000000000..f101d01ec
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/demo9s12ne64/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/demo9s12ne64/ostest/defconfig b/nuttx/configs/demo9s12ne64/ostest/defconfig
new file mode 100755
index 000000000..e3b6cac17
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/ostest/defconfig
@@ -0,0 +1,396 @@
+############################################################################
+# configs/demo9s12ne64/ostest/defconfig
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="hc"
+CONFIG_ARCH_HC=y
+CONFIG_ARCH_HCS12=y
+CONFIG_ARCH_CHIP="m9s12"
+CONFIG_ARCH_CHIP_MCS92S12NEC64=y
+CONFIG_ARCH_BOARD="demo9s12ne64"
+CONFIG_ARCH_BOARD_DEMOS92S12NEC64=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# HCS12 build options:
+#
+
+CONFIG_HCS12_SERIALMON=y
+CONFIG_HCS12_NONBANKED=y
+
+#
+# CS12 Sub-system support
+#
+CONFIG_HCS12_SCI0=n
+CONFIG_HCS12_SCI1=n
+
+#
+# MC9S12NEC64 specific serial device driver settings
+#
+CONFIG_SCI0_SERIAL_CONSOLE=n
+CONFIG_SCI0_TXBUFSIZE=32
+CONFIG_SCI0_RXBUFSIZE=32
+CONFIG_SCI0_BAUD=115200
+CONFIG_SCI0_BITS=8
+CONFIG_SCI0_PARITY=0
+CONFIG_SCI0_2STOP=0
+
+CONFIG_SCI1_SERIAL_CONSOLE=n
+CONFIG_SCI1_TXBUFSIZE=32
+CONFIG_SCI1_RXBUFSIZE=32
+CONFIG_SCI1_BAUD=115200
+CONFIG_SCI1_BITS=8
+CONFIG_SCI1_PARITY=0
+CONFIG_SCI1_2STOP=0
+
+#
+# MC9S12NEC64 specific SSI device driver settings
+#
+CONFIG_SPI0_DISABLE=n
+CONFIG_SPI1_DISABLE=y
+CONFIG_SPI_POLLWAIT=y
+#CONFIG_SPI_TXLIMIT=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=y
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Setup for a two-pass build
+#
+CONFIG_BUILD_2PASS=n
+CONFIG_PASS1_BUILDIR=configs/demo9s12ne64/initrel
+CONFIG_PASS1_TARGET=init.r
+CONFIG_PASS1_OBJECT=
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=11
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=256
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=512
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=256
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/demo9s12ne64/ostest/ld.script.banked b/nuttx/configs/demo9s12ne64/ostest/ld.script.banked
new file mode 100755
index 000000000..798658f39
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/ostest/ld.script.banked
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * configs/demo9s12ne64/ostest/ld.script
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The DEMO9S12NE64 has 64Kb of FLASH and 8Kb of SRAM that are assumed to be
+ * paged and positioned as below:
+ */
+
+MEMORY
+{
+ /* The 8Kb SRAM is mapped to 0x2000-0x2fff. The top 256 bytes are reserved
+ * for the serial monitor stack space.
+ */
+
+ sram (rwx) : ORIGIN = 0x2000, LENGTH = 8K-256
+
+ /* Two fixed text flash pages (corresponding to page 3e and 3f) */
+
+ lowtext(rx) : ORIGIN = 0x4000, LENGTH = 16K /* Page 3e */
+ hitext (rx) : ORIGIN = 0xc000, LENGTH = 16K-2k /* Page 3f */
+
+ /* Flash memory pages:
+ *
+ * The MC9S12NE64 implements 6 bits of the PPAGE register which gives it a
+ * 1 Mbyte program memory address space that is accessed through the PPAGE
+ * window. The lower 768K portion (0x000000-0x0bffff) of the address space
+ * is accessed with PPAGE values 0x00 through 0x2f. This address range
+ * is reserved for external memory when the part is operated in expanded
+ * mode. The upper 256K of the address space (0x0c0000-0x100000), accessed
+ * with PPAGE values 0x30 through 0x3f, is occupied by on chip flash.
+ */
+
+ page30 (rx) : ORIGIN = 0x0c0000, LENGTH = 16K /* Page 30 */
+ page31 (rx) : ORIGIN = 0x0c4000, LENGTH = 16K /* Page 31 */
+ page32 (rx) : ORIGIN = 0x0c8000, LENGTH = 16K /* Page 32 */
+ page33 (rx) : ORIGIN = 0x0cc000, LENGTH = 16K /* Page 33 */
+ page34 (rx) : ORIGIN = 0x0d0000, LENGTH = 16K /* Page 34 */
+ page35 (rx) : ORIGIN = 0x0d4000, LENGTH = 16K /* Page 35 */
+ page36 (rx) : ORIGIN = 0x0d8000, LENGTH = 16K /* Page 36 */
+ page37 (rx) : ORIGIN = 0x0dc000, LENGTH = 16K /* Page 37 */
+ page38 (rx) : ORIGIN = 0x0e0000, LENGTH = 16K /* Page 38 */
+ page39 (rx) : ORIGIN = 0x0e4000, LENGTH = 16K /* Page 39 */
+ page3a (rx) : ORIGIN = 0x0e8000, LENGTH = 16K /* Page 3a */
+ page3b (rx) : ORIGIN = 0x0ec000, LENGTH = 16K /* Page 3b */
+ page3c (rx) : ORIGIN = 0x0f0000, LENGTH = 16K /* Page 3c */
+ page3d (rx) : ORIGIN = 0x0f4000, LENGTH = 16K /* Page 3d */
+
+ page3e (rx) : ORIGIN = 0x0f8000, LENGTH = 16K /* Page 3e */
+ page3f (rx) : ORIGIN = 0x0fc000, LENGTH = 16K-2K /* Page 3f */
+
+ /* Vectors. These get relocated to 0xf780-f7ff by the serial loader */
+
+ vectors (rx) : ORIGIN = 0xff80, LENGTH = 256
+}
+
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > hitext
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > lowtext
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectors
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/demo9s12ne64/ostest/ld.script.nonbanked b/nuttx/configs/demo9s12ne64/ostest/ld.script.nonbanked
new file mode 100755
index 000000000..ab36d1c4e
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/ostest/ld.script.nonbanked
@@ -0,0 +1,116 @@
+/****************************************************************************
+ * configs/demo9s12ne64/ostest/ld.script
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The DEMO9S12NE64 has 64Kb of FLASH and 8Kb of SRAM that are assumed to be
+ * paged and positioned as below:
+ */
+
+MEMORY
+{
+ /* The 8Kb SRAM is mapped to 0x2000-0x2fff. The top 256 bytes are reserved
+ * for the serial monitor stack space.
+ */
+
+ sram (rwx) : ORIGIN = 0x2000, LENGTH = 8K-256
+
+ /* Three fixed text flash pages (corresponding to page 3e, 3d, and 3f) at
+ * 16Kb each (minus 2Kb at the end of page 3f that is reserved at the top for
+ * the serial boot loader
+ */
+
+ text (rx) : ORIGIN = 0x4000, LENGTH = 48K-2k /* Page 3e, 3d, and 3f */
+
+ /* Vectors. These get relocated to 0xf780-f7ff by the serial loader */
+
+ vectors (rx) : ORIGIN = 0xff80, LENGTH = 256
+}
+
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > text
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > text
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectors
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/demo9s12ne64/ostest/setenv.sh b/nuttx/configs/demo9s12ne64/ostest/setenv.sh
new file mode 100755
index 000000000..8f47650ca
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/demo9s12ne64/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_m9s12x/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/demo9s12ne64/src/Makefile b/nuttx/configs/demo9s12ne64/src/Makefile
new file mode 100644
index 000000000..7ab12080c
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/Makefile
@@ -0,0 +1,86 @@
+############################################################################
+# configs/demo9s12ne64/src/Makefile
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_leds.c up_buttons.c up_spi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/demo9s12ne64/src/demo9s12ne64.h b/nuttx/configs/demo9s12ne64/src/demo9s12ne64.h
new file mode 100644
index 000000000..0a6c8e2c9
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/demo9s12ne64.h
@@ -0,0 +1,91 @@
+/************************************************************************************
+ * configs/demo9s12ne64/src/demo9s12ne64.h
+ * arch/arm/src/board/demo9s12ne64.n
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_DEMO9S12NE64_SRC_DEMO9S12NE64_H
+#define __CONFIGS_DEMO9S12NE64_SRC_DEMO9S12NE64_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* DEMO9S12NE64 GPIOs ***************************************************************/
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+/************************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Configure and initialize on-board LEDs
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void up_ledinit(void);
+#endif
+
+/************************************************************************************
+ * Name: hcs12_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board.
+ *
+ ************************************************************************************/
+
+extern void weak_function hcs12_spiinitialize(void);
+
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_DEMO9S12NE64_SRC_DEMO9S12NE64_H */
+
diff --git a/nuttx/configs/demo9s12ne64/src/up_boot.c b/nuttx/configs/demo9s12ne64/src/up_boot.c
new file mode 100644
index 000000000..a98bb0d90
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/up_boot.c
@@ -0,0 +1,89 @@
+/************************************************************************************
+ * configs/demo9s12ne64/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "demo9s12ne64.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: hcs12_boardinitialize
+ *
+ * Description:
+ * All HCS12 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void hcs12_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * hcs12_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_INCLUDE_HCS12_ARCH_SPI)
+ if (hcs12_spiinitialize)
+ {
+ hcs12_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/demo9s12ne64/src/up_buttons.c b/nuttx/configs/demo9s12ne64/src/up_buttons.c
new file mode 100644
index 000000000..b895f45a3
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/up_buttons.c
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * configs/demo9s12ne64/src/up_leds.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "demo9s12ne64.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ return 0;
+}
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/demo9s12ne64/src/up_leds.c b/nuttx/configs/demo9s12ne64/src/up_leds.c
new file mode 100644
index 000000000..1984d8165
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/up_leds.c
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/demo9s12ne64/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "demo9s12ne64.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Configure and initialize on-board LEDs
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/demo9s12ne64/src/up_nsh.c b/nuttx/configs/demo9s12ne64/src/up_nsh.c
new file mode 100644
index 000000000..7e53f7f07
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/up_nsh.c
@@ -0,0 +1,86 @@
+/****************************************************************************
+ * config/demo9s12ne64/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "demo9s12ne64.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ /* Configure SPI-based devices */
+
+ return OK;
+}
diff --git a/nuttx/configs/demo9s12ne64/src/up_spi.c b/nuttx/configs/demo9s12ne64/src/up_spi.c
new file mode 100644
index 000000000..8514b48ed
--- /dev/null
+++ b/nuttx/configs/demo9s12ne64/src/up_spi.c
@@ -0,0 +1,130 @@
+/************************************************************************************
+ * configs/demo9s12ne64/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "demo9s12ne64.h"
+
+#if defined(CONFIG_HCS12_SPI)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: hcs12_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the DEMO9S12NE64 board.
+ *
+ ************************************************************************************/
+
+void weak_function hcs12_spiinitialize(void)
+{
+}
+
+/****************************************************************************
+ * Name: hcs12_spiselect and hcs12_spistatus
+ *
+ * Description:
+ * The external functions, hcs12_spiselect and hcs12_spistatus must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common HCS12 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in hcs12_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide hcs12_spiselect() and hcs12_spistatus() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void hcs12_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+}
+
+uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* CONFIG_HCS12_SPI */
diff --git a/nuttx/configs/ea3131/Kconfig b/nuttx/configs/ea3131/Kconfig
new file mode 100644
index 000000000..ee64802dd
--- /dev/null
+++ b/nuttx/configs/ea3131/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_EA3131
+endif
diff --git a/nuttx/configs/ea3131/README.txt b/nuttx/configs/ea3131/README.txt
new file mode 100644
index 000000000..f3239e476
--- /dev/null
+++ b/nuttx/configs/ea3131/README.txt
@@ -0,0 +1,636 @@
+README
+^^^^^^
+
+ This README file discusses the port of NuttX to the Embedded Artists
+ EA3131 board.
+
+Contents
+^^^^^^^^
+
+ o Development Environment
+ o GNU Toolchain Options
+ o IDEs
+ o NuttX buildroot Toolchain
+ o Boot Sequence
+ o Image Format
+ o Image Download to ISRAM
+ o Using OpenOCD and GDB
+ o On-Demand Paging
+ o ARM/EA3131-specific Configuration Options
+ o Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. Raisonance GNU toolchain, or
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_LPC31_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC31_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC31_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC31_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC31_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc31xx,
+ arch/arm/src/common, arch/arm/src/arm, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc31xx/lpc31_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh ea3131/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/arm926t-defconfig-4.2.4 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+Boot Sequence
+^^^^^^^^^^^^^
+ LPC313x has on chip bootrom which loads properly formatted images from multiple
+ sources into SRAM. These sources include including SPI Flash, NOR Flash, UART,
+ USB, SD Card, and NAND Flash.
+
+ In all configurations, NuttX is loaded directly into ISRAM. NuttX is linked
+ to execute from ISRAM, regardless of the boot source.
+
+Image Format
+^^^^^^^^^^^^
+
+ In order to use the bootrom bootloader, a special header must be added to the
+ beginning of the binary image that includes information about the binary (things
+ like the entry point, the size, and CRC's to verify the image.
+
+ NXP provides a Windows program to append such a header to the binary image.
+ However, (1) that program won't run under Linux, and (2) when I try it under
+ WinXP, Symantec immediately claims that the program is misbehaving and deletes
+ it!
+
+ To work around both of these issues, I have created a small program under
+ configs/ea3131/tools to add the header. This program can be built under
+ either Linux or Cygwin (and probably other tool environments as well). That
+ tool can be built as follows:
+
+ - cd configs/ea3131/tools
+ - make
+
+ Then, to build the NuttX binary ready to load with the bootloader, just
+ following these steps:
+
+ - cd tools/ # Configure Nuttx
+ - ./configure.sh ea3131/ostest # (using the ostest configuration for this example)
+ - cd .. # Set up environment
+ - . ./setenv.sh # (see notes below)
+ - make # Make NuttX. This will produce nuttx.bin
+ - mklpc.sh # Make the bootloader binary (nuttx.lpc)
+
+ NOTES:
+
+ 1. setenv.sh just sets up pathes to the toolchain and also to
+ configs/ea3131/tools where mklpc.sh resides. Use of setenv.sh is optional.
+ If you don't use setenv.sh, then just set your PATH variable appropriately or
+ use the full path to mklpc.sh in the final step.
+ 2. You can instruct Symantec to ignore the errors and it will stop quarantining
+ the NXP program.
+ 3. The CRC32 logic in configs/ea3131/tools doesn't seem to work. As a result,
+ the CRC is currently disabled in the header:
+
+ RCS file: /cvsroot/nuttx/nuttx/configs/ea3131/tools/lpchdr.c,v
+ retrieving revision 1.2
+ diff -r1.2 lpchdr.c
+ 264c264
+ < g_hdr.imageType = 0x0000000b;
+ ---
+ > g_hdr.imageType = 0x0000000a;
+
+Image Download to ISRAM
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Assuming that you already have the FTDI driver installed*, then here is the
+are the steps that I use for loading new code into the EA3131:
+
+- Create the bootloader binary, nuttx.lpc, as described above.
+- Connected the EA3131 using the FTDI USB port (not the lpc3131 USB port)
+ This will power up the EA3131 and start the bootloader.
+- Start a terminal emulator (such as TeraTerm) at 115200 8NI.
+- Reset the EA3131 and you should see:
+ LPC31xx READY FOR PLAIN IMAGE>
+- Send the nuttx.lpc file and you should see:
+ Download finished
+
+That will load the NuttX binary into ISRAM and attempt to execute it.
+
+*See the LPC313x documentation if you do not have the FTDI driver installed.
+
+Using OpenOCD and GDB
+^^^^^^^^^^^^^^^^^^^^^
+
+ I have been using the Olimex ARM-USB-OCD JTAG debugger with the EA3131
+ (http://www.olimex.com). The OpenOCD configuration file is here:
+ tools/armusbocb.cfg. There is also a script on the tools directory that
+ I used to start the OpenOCD daemon on my system called oocd.sh. That
+ script would probably require some modifications to work in another
+ environment:
+
+ - possibly the value of OPENOCD_PATH
+ - If you are working under Linux you will need to change any
+ occurances of `cygpath -w blablabla` to just blablabla
+
+ Then you should be able to start the OpenOCD daemon like:
+
+ configs/ea3131/tools/oocd.sh $PWD
+
+ Where it is assumed that you are executing oocd.sh from the top level
+ directory where NuttX is installed.
+
+ Once the OpenOCD daemon has been started, you can connect to it via
+ GDB using the following GDB command:
+
+ arm-elf-gdb
+ (gdb) target remote localhost:3333
+
+ And you can load the NuttX ELF file:
+
+ (gdb) symbol-file nuttx
+ (gdb) load nuttx
+
+On-Demand Paging
+^^^^^^^^^^^^^^^^
+
+ There is a configuration that was used to verify the On-Demand Paging
+ feature for the ARM926 (see http://nuttx.sourceforge.net/NuttXDemandPaging.html).
+ That configuration is contained in the pgnsh sub-directory. The pgnsh configuration
+ is only a test configuration, and lacks some logic to provide the full On-Demand
+ Paging solution (see below).
+
+ Page Table Layout:
+ ------------------
+
+ The ARM926 MMU uses a page table in memory. The page table is divided
+ into (1) a level 1 (L1) page table that maps 1Mb memory regions to level 2
+ page tables (except in the case of 1Mb sections, of course), and (2) a level
+ 2 (L2) page table that maps the 1Mb memory regions into individual 64Kb, 4kb,
+ or 1kb pages. The pgnsh configuration uses 1Kb pages: it positions 48x1Kb
+ pages at beginning of SRAM (the "locked" memory region), 16x1Kb pages at
+ the end of SRAM for the L1 page table, and 44x1Kb pages just before the
+ L1 page table. That leaves 96x1Kb virtual pages in the middle of SRAM for
+ the paged memory region; up to 384x1kb of physical pages may be paged into
+ this region. Physical memory map:
+
+ 11028000 "locked" text region 48x1Kb
+ 11034000 "paged" text region 96x1Kb
+ 1104c000 "data" region 32x1Kb
+ 11054000 L1 page table 16x1Kb
+ -------- --------------------- ------
+ 11058000 192x1Kb
+
+ The virtual memory map allows more space for the paged region:
+
+ 11028000 "locked" text region 48x1Kb
+ 11034000 "paged" text region 384x1Kb
+ 11094000 "data" region 32x1Kb
+ 1109c000 L1 page table 16x1Kb
+ -------- --------------------- ------
+ 110a0000 480x1Kb
+
+ The L1 contains a single 1Mb entry to span the entire LPC3131 SRAM memory
+ region. The virtual address for this region is 0x11028000. The offset into
+ the L1 page table is given by:
+
+ offset = ((0x11028000 >> 20) << 2) = 0x00000440
+
+ The value at that offset into the L1 page table contains the address of the
+ L2 page table (0x11056000) plus some extra bits to specify that that entry
+ is valid and and points to a 1Kb L1 page table:
+
+ 11054440 11056013
+
+ Why is the address 11056000 used for the address of the L2 page table? Isn't
+ that inside of the L1 page table? Yes, this was done to use the preceious
+ SRAM memory more conservatively. If you look at the LPC313x virtual memory
+ map, you can see that no virtual addresses above 0x60100000 are used. That
+ corresponds to L1 page table offset 0x0001800 (physical address 0x11055800).
+ The rest of the L1 page table is unused and so we reuse it to hold the L2 page
+ table (or course, this could cause some really weird addressing L1 mapping
+ issues if bad virtual addresses were used in that region -- oh well). The
+ address 0x11056000 is then the first properly aligned memory that can be used
+ in that L2 page table area.
+
+ Only only L2 page table will be used to span the LPC3131 SRAM virtual text
+ address region (480x1Kb). That one entry maps the virtual address range of
+ 0x11000000 through 0x110ffc00. Each entry maps a 1Kb page of physical memory:
+
+ PAGE VIRTUAL ADDR L2 OFFSET
+ --------- ------------ ---------
+ Page 0 0x11000000 0x00000000
+ Page 1 0x11000400 0x00000004
+ Page 2 0x11000800 0x00000008
+ ...
+ Page 1023 0x110ffc00 0x00000ffc
+
+ The "locked" text region begins at an offset of 0x00028000 into that region.
+ The 48 page table entries needed to make this region begin at:
+
+ offset = ((0x00028000 >> 10) << 2) = 0x00000280
+
+ Each entry contains the address of a physical page in the "locked" text region
+ (plus some extra bits to identify domains, page sizes, access privileges, etc.):
+
+ 0x11000280 0x1102800b
+ 0x11000284 0x1102840b
+ 0x11000288 0x1102880b
+ ...
+
+ The locked region is initially unmapped. But the data region and page table
+ regions must be mapped in a similar manner. Those
+
+ Data:
+ Virtual address = 0x11094000 Offset = 0x00064000
+ Physical address = 0x1104c000
+ L2 offset = ((0x00094000 >> 10) << 2) = 0x00000940
+
+ Page table:
+ Virtual address = 0x1109c000 Offset = 0x0009c000
+ Physical address = 0x11054000
+ L2 offset = ((0x0009c000 >> 10) << 2) = 0x000009c0
+
+ Build Sequence:
+ ---------------
+
+ This example uses a two-pass build. The top-level Makefile recognizes the
+ configuration option CONFIG_BUILD_2PASS and will execute the Makefile in
+ configs/ea3131/locked/Makefile to build the first pass object, locked.r.
+ This first pass object contains all of the code that must be in the locked
+ text region. The Makefile in arch/arm/src/Makefile then includes this 1st
+ pass in build, positioning it as controlled by configs/ea3131/scripts/pg-ld.script.
+
+ Finishing the Example:
+ ----------------------
+
+ This example is incomplete in that it does not have any media to reload the
+ page text region from: The file configs/ea3131/src/up_fillpage.c is only
+ a stub. That logic to actually reload the page from some storage medium
+ (among other things) would have to be implemented in order to complete this
+ example. At present, the example works correctly up to the point where
+ up_fillpage() is first called and then fails in the expected way.
+
+ Here are the detailed list of things that would need to be done in addition
+ to finishing th up_fillpage() logic (this assumes that SPI NOR FLASH is the
+ media on which the NuttX image is stored):
+
+ 1. Develop a NOR FLASH layout can can be used to (1) boot the locked text
+ section into memory on a reset, and (2) map a virtual fault address
+ to an offset into paged text section in NOR FLASH.
+ 2. Develop/modify the build logic to build the binaries for this NOR
+ flash layout: Can the NuttX image be formed as a single image that
+ is larger than the IRAM? Can we boot from such a large image? If
+ so, then no special build modifications are required. Or, does the
+ locked section have to be smaller with a separate paged text section
+ image in FLASH? In this case, some tool will be needed to break
+ the nuttx.bin file into the two pieces.
+ 3. Develop a mechanism to load the NuttX image into SPI NOR FLASH. A
+ basic procedure is already documented in NXP publications: "LPC313x
+ Linux Quick Start Guide, Version 2.0" and "AN10811 Programming SPI
+ flash on EA3131 boards, V1 (May 1, 2009)." That procedure may be
+ sufficient, depending on the decisions made in (1) and (2):
+ 4. Develop a procedure to boot the locked text image from SPI NOR.
+ The references and issues related to this are discussed in (2)
+ and (3) above.
+
+ Basic support for paging from SPI NOR FLASH can be enabled by adding:
+
+ CONFIG_PAGING_AT45DB=y
+
+ Or:
+
+ CONFIG_PAGING_M25PX=y
+
+ NOTE: See the TODO list in the top-level directory:
+
+ "arch/arm/src/lpc31xx/lpc31_spi.c may or may not be functional. It was
+ reported to be working, but I was unable to get it working with the
+ Atmel at45dbxx serial FLASH driver."
+
+ Alternative:
+ ------------
+
+ I have implemented an alternative within configs/ea3131/src/up_fillpage.c
+ which is probably only useful for testing. Here is the usage module
+ for this alternative
+
+ 1. Place the nuttx.bin file on an SD card.
+ 2. Insert the SD card prior to booting
+ 3. In up_fillpage(), use the virtual miss address (minus the virtual
+ base address) as an offset into the nuttx.bin file, and read the
+ required page from that offset in the nuttx.bin file:
+
+ off_t offset = (off_t)vpage - PG_LOCKED_VBASE;
+ off_t pos = lseek(fd, offset, SEEK_SET);
+ if (pos != (off_t)-1)
+ {
+ int ret = read(fd, vpage, PAGESIZE);
+ }
+
+ In this way, the paging implementation can do on-demand paging
+ from an image file on the SD card. Problems/issues with this
+ approach probably make it only useful for testing:
+
+ 1. You would still have to boot the locked section over serial or
+ using a bootloader -- it is not clear how the power up boot
+ would occur. For testing, the nuttx.bin file could be both
+ provided on the SD card and loaded over serial.
+ 2. If the SD card is not in place, the system will crash.
+ 3. This means that all of the file system logic and FAT file
+ system would have to reside in the locked text region.
+
+ And the show-stopper:
+
+ 4. There is no MCI driver for the ea3131, yet!
+
+ARM/EA3131-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ARM926EJS=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc313x
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_LPC3131
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=ea3131
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_EA3131
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - For most ARM9 architectures, this describes the
+ size of installed DRAM. For the LPC313X, it is used only to
+ deterimine how to map the executable regions. It is SDRAM size
+ only if you are executing out of the external SDRAM; or it could
+ be NOR FLASH size, external SRAM size, or internal SRAM size.
+
+ CONFIG_DRAM_START - The start address of installed DRAM (physical)
+
+ CONFIG_DRAM_VSTART - The startaddress of DRAM (virtual)
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_IRQPRIO - The LPC313x supports interrupt prioritization
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader.
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+ CONFIG_ARCH_DMA - Support DMA initialization
+ CONFIG_ARCH_LOWVECTORS - define if vectors reside at address 0x0000:00000
+ Undefine if vectors reside at address 0xffff:0000
+ CONFIG_ARCH_ROMPGTABLE - A pre-initialized, read-only page table is available.
+ If defined, then board-specific logic must also define PGTABLE_BASE_PADDR,
+ PGTABLE_BASE_VADDR, and all memory section mapping in a file named
+ board_memorymap.h.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_LPC31_MCI, CONFIG_LPC31_SPI, CONFIG_LPC31_UART
+
+ External memory available on the board (see also CONFIG_MM_REGIONS)
+
+ CONFIG_LPC31_EXTSRAM0 - Select if external SRAM0 is present
+ CONFIG_LPC31_EXTSRAM0HEAP - Select if external SRAM0 should be
+ configured as part of the NuttX heap.
+ CONFIG_LPC31_EXTSRAM0SIZE - Size (in bytes) of the installed
+ external SRAM0 memory
+ CONFIG_LPC31_EXTSRAM1 - Select if external SRAM1 is present
+ CONFIG_LPC31_EXTSRAM1HEAP - Select if external SRAM1 should be
+ configured as part of the NuttX heap.
+ CONFIG_LPC31_EXTSRAM1SIZE - Size (in bytes) of the installed
+ external SRAM1 memory
+ CONFIG_LPC31_EXTSDRAM - Select if external SDRAM is present
+ CONFIG_LPC31_EXTSDRAMHEAP - Select if external SDRAM should be
+ configured as part of the NuttX heap.
+ CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed
+ external SDRAM memory
+ CONFIG_LPC31_EXTNAND - Select if external NAND is present
+ CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed
+ external NAND memory
+
+ LPC313X specific device driver settings
+
+ CONFIG_UART_SERIAL_CONSOLE - selects the UART for the
+ console and ttys0
+ CONFIG_UART_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UART_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UART_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UART_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UART_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UART_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each EA3131 configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh ea3131/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ locked
+ This is not a configuration. When on-demand page is enabled
+ then we must do a two pass link: The first pass creates an
+ intermediate object that has all of the code that must be
+ placed in the locked memory partition. This is logic that
+ must be locked in memory at all times.
+
+ The directory contains the logic necessary to do the platform
+ specific first pass link for the EA313x.
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interface.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ pgnsh:
+ This is the same configuration as nsh, but with On-Demand
+ paging enabled. See http://www.nuttx.org/NuttXDemandPaging.html.
+ This configuration is an experiment for the purposes of test
+ and debug. At present, this does not produce functioning,
+ usable system
+
+ usbserial:
+ This configuration directory exercises the USB serial class
+ driver at examples/usbserial. See examples/README.txt for
+ more information.
+
+ usbstorage:
+ This configuration directory exercises the USB mass storage
+ class driver at examples/usbstorage. See examples/README.txt for
+ more information.
+
diff --git a/nuttx/configs/ea3131/include/board.h b/nuttx/configs/ea3131/include/board.h
new file mode 100644
index 000000000..2154af545
--- /dev/null
+++ b/nuttx/configs/ea3131/include/board.h
@@ -0,0 +1,167 @@
+/************************************************************************************
+ * configs/ea3131/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+# include "lpc31_cgudrvr.h"
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Frequency of the FFAST input */
+
+#define BOARD_FREQIN_FFAST (12000000) /* ffast (12 MHz crystal) */
+
+/* HPLL0 configuration */
+
+#define BOARD_HPLL0_FINSEL CGU_HPFINSEL_FFAST /* Frequency input selection */
+#define BOARD_HPLL0_NDEC 131 /* PLL N-divider value */
+#define BOARD_HPLL0_MDEC 29784 /* PLL M-divider value */
+#define BOARD_HPLL0_PDEC 7 /* PLL P-divider value */
+#define BOARD_HPLL0_SELR 0 /* SELR bandwidth selection */
+#define BOARD_HPLL0_SELI 8 /* SELI bandwidth selection */
+#define BOARD_HPLL0_SELP 31 /* SELP bandwidth selection */
+#define BOARD_HPLL0_MODE 0 /* PLL mode */
+#define BOARD_HPLL0_FREQ 406425600 /* Frequency of the PLL in MHz */
+
+/* HPLL1 configuration */
+
+#define BOARD_HPLL1_FINSEL CGU_HPFINSEL_FFAST /* Frequency input selection */
+#define BOARD_HPLL1_NDEC 770 /* PLL N-divider value */
+#define BOARD_HPLL1_MDEC 8191 /* PLL M-divider value */
+#define BOARD_HPLL1_PDEC 98 /* PLL P-divider value */
+#define BOARD_HPLL1_SELR 0 /* SELR bandwidth selection */
+#define BOARD_HPLL1_SELI 16 /* SELI bandwidth selection */
+#define BOARD_HPLL1_SELP 8 /* SELP bandwidth selection */
+#define BOARD_HPLL1_MODE 0 /* PLL mode */
+#define BOARD_HPLL1_FREQ 180000000 /* Frequency of the PLL in MHz */
+
+/* The following 3 bitsets determine which clocks will be enabled at initialization
+ * time.
+ */
+
+#define BOARD_CLKS_0_31 \
+ (_RBIT(CLKID_APB0CLK,0)|_RBIT(CLKID_APB1CLK,0)|_RBIT(CLKID_APB2CLK,0)|\
+ _RBIT(CLKID_APB3CLK,0)|_RBIT(CLKID_APB4CLK,0)|_RBIT(CLKID_AHB2INTCCLK,0)|\
+ _RBIT(CLKID_AHB0CLK,0)|_RBIT(CLKID_ARM926CORECLK,0)|_RBIT(CLKID_ARM926BUSIFCLK,0)|\
+ _RBIT(CLKID_ARM926RETIMECLK,0)|_RBIT(CLKID_ISRAM0CLK,0)|_RBIT(CLKID_ISRAM1CLK,0)|\
+ _RBIT(CLKID_ISROMCLK,0)|_RBIT(CLKID_INTCCLK,0)|_RBIT(CLKID_AHB2APB0PCLK,0)|\
+ _RBIT(CLKID_EVENTROUTERPCLK,0)|_RBIT(CLKID_CLOCKOUT,0))
+
+#define BOARD_CLKS_32_63 \
+ (_RBIT(CLKID_IOCONFPCLK,32)|_RBIT(CLKID_CGUPCLK,32)|_RBIT(CLKID_SYSCREGPCLK,32)|\
+ _RBIT(CLKID_OTPPCLK,32)|_RBIT(CLKID_AHB2APB1PCLK,32)|_RBIT(CLKID_AHB2APB2PCLK,32)|\
+ _RBIT(CLKID_AHB2APB3PCLK,32)|_RBIT(CLKID_EDGEDETPCLK,32))
+
+#define BOARD_CLKS_64_92 \
+ (0)
+
+/* LED definitions ******************************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Button definitions ***************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: lpc31_boardinitialize
+ *
+ * Description:
+ * All LPC31XX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void lpc31_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the state of all buttons. up_buttons()
+ * returns an 8-bit bit set with each bit associated with a button. See the
+ * BUTTON_* definitions above for the meaning of each bit.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ea3131/include/board_memorymap.h b/nuttx/configs/ea3131/include/board_memorymap.h
new file mode 100644
index 000000000..69fe0ae96
--- /dev/null
+++ b/nuttx/configs/ea3131/include/board_memorymap.h
@@ -0,0 +1,117 @@
+/************************************************************************************
+ * configs/ea3131/include/board_memorymap.h
+ * include/arch/board/board_memorymap.h
+ *
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_MEMORYMAP_H
+#define __ARCH_BOARD_BOARD_MEMORYMAP_H
+
+/* This file should never be included directly, but only indirectly via
+ * lpc31_memorymap.h.
+ */
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* If the LPC31xx ROM page table is selected, then the board-logic is required
+ * to provide:
+ *
+ * PGTABLE_BASE_PADDR - The physical address of the page table in ROM,
+ * PGTABLE_BASE_VADDR - The mapped address of the page table in ROM, and
+ * Mappings for each of the PSECTIONS in lpc31_memorymap.h
+ */
+
+#ifdef CONFIG_ARCH_ROMPGTABLE
+ /* The LPC31xx ROM page table uses a 1-1 physical to virtual memory mapping */
+
+# define LPC31_SHADOWSPACE_VSECTION 0x00000000 /* 0x00000000-0x00000fff: Shadow Area 4Kb */
+# define LPC31_INTSRAM_VSECTION 0x11028000 /* Internal SRAM 96Kb-192Kb */
+# define LPC31_INTSRAM0_VADDR 0x11028000 /* 0x11028000-0x1103ffff: Internal SRAM 0 96Kb */
+# define LPC31_INTSRAM1_VADDR 0x11040000 /* 0x11040000-0x11057fff: Internal SRAM 1 96Kb */
+# define LPC31_INTSROM0_VSECTION 0x12000000 /* 0x12000000-0x1201ffff: Internal SROM 0 128Kb */
+# define LPC31_APB01_VSECTION 0x13000000 /* 0x13000000-0x1300bfff: APB0 32Kb APB1 16Kb*/
+# define LPC31_APB0_VADDR 0x13000000 /* 0x13000000-0x13007fff: APB0 32Kb */
+# define LPC31_APB1_VADDR 0x13008000 /* 0x13008000-0x1300bfff: APB1 16Kb */
+# define LPC31_APB2_VSECTION 0x15000000 /* 0x15000000-0x15003fff: APB2 16Kb */
+# define LPC31_APB3_VSECTION 0x16000000 /* 0x16000000-0x160003ff: APB3 1Kb */
+# define LPC31_APB4MPMC_VSECTION 0x17000000 /* 8Kb */
+# define LPC31_APB4_VADDR 0x17000000 /* 0x17000000-0x17000fff: APB4 4Kb */
+# define LPC31_MPMC_VADDR 0x17008000 /* 0x17008000-0x17008fff: MPMC cfg 4Kb */
+# define LPC31_MCI_VSECTION 0x18000000 /* 0x18000000 0x180003ff: MCI/SD/SDIO 1Kb */
+# define LPC31_USBOTG_VSECTION 0x19000000 /* 0x19000000-0x19000fff: USB OTG 4Kb */
+# define LPC31_EXTSRAM_VSECTION 0x20020000 /* 64-128Kb */
+# define LPC31_EXTSRAM0_VADDR 0x20000000 /* 0x20000000-0x2001ffff: External SRAM 0 64-128Kb */
+# define LPC31_EXTSRAM1_VADDR 0x20020000 /* 0x20020000-0x2003ffff: External SRAM 1 64-128Kb */
+# define LPC31_EXTSDRAM0_VSECTION 0x30000000 /* 0x30000000-0x37ffffff: External SDRAM 0 128Mb */
+# define LPC31_INTC_VSECTION 0x60000000 /* 0x60000000-0x60000fff: Interrupt controller 4Kb */
+# define LPC31_NAND_VSECTION 0x70000000 /* 0x70000000-0x700007ff: NANDFLASH Ctrl 2Kb */
+
+ /* Define the address of the page table within the ROM */
+
+# define ROMPGTABLE_OFFSET 0x0001c000 /* Offset of the ROM page table in ROM */
+# define PGTABLE_BASE_PADDR (LPC31_INTSROM0_PSECTION+ROMPGTABLE_OFFSET)
+# define PGTABLE_BASE_VADDR (LPC31_INTSROM0_VSECTION+ROMPGTABLE_OFFSET)
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_MEMORYMAP_H */
diff --git a/nuttx/configs/ea3131/locked/Makefile b/nuttx/configs/ea3131/locked/Makefile
new file mode 100644
index 000000000..79fa82610
--- /dev/null
+++ b/nuttx/configs/ea3131/locked/Makefile
@@ -0,0 +1,120 @@
+############################################################################
+# configs/ea3131/locked/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+
+# Board-specific directory, board library, and application library
+
+PASS1_SRCDIR = arch/$(CONFIG_ARCH)/src
+PASS1_BOARDDIR = $(PASS1_SRCDIR)/board
+PASS1_LIBBOARD = $(PASS1_BOARDDIR)/libboard$(LIBEXT)
+
+# Where is the application library?
+
+ifneq ($(CONFIG_APPS_DIR),)
+PASS1_LIBAPPS = $(CONFIG_APPS_DIR)/libapps$(LIBEXT)
+else
+ifneq ($(APPDIR),)
+PASS1_LIBAPPS = $(APPDIR)/libapps$(LIBEXT)
+endif
+endif
+
+# Remove the application library (libapps) from the list of libraries. Add
+# the boad library (liboard)
+
+PASS1_LINKLIBS = $(filter-out $(PASS1_LIBAPPS),$(LINKLIBS))
+PASS1_LINKLIBS += $(PASS1_LIBBOARD)
+
+# Get the paths to the libraries and the links script path in format that
+# is appropriate for the host OS
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ PASS1_LIBPATHS = ${shell for path in $(PASS1_LINKLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
+ PASS1_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc}"
+else
+ # Linux/Cygwin-native toolchain
+ PASS1_LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(PASS1_LINKLIBS)))
+ PASS1_LDSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/locked/ld-locked.inc
+endif
+
+PASS1_LDFLAGS = -r $(PASS1_LDSCRIPT)
+PASS1_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(PASS1_LINKLIBS))))
+PASS1_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
+
+# Targets:
+
+all: $(PASS1_SRCDIR)/locked.r
+
+.PHONY: depend clean distclean
+
+# Create include-able linker script that specifies all of the symbols to be
+# resolved in the locked.r file.
+
+ld-locked.inc: mklocked.sh $(TOPDIR)/.config
+ @echo "MK: ld-locked.inc"
+ @./mklocked.sh "$(TOPDIR)"
+
+# Make the board library. This is normally done in arch/arm/src/Makefile.
+# However, we need it earlier here when doing a two-pass build so that libboard.a
+# is available to link against.
+
+$(PASS1_LIBBOARD):
+ @$(MAKE) -C $(TOPDIR)/configs/ea3131/src TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
+
+# Create the locked.r file containing all of the code (except the start-up code)
+# that needs to lie in the locked text region.
+
+locked.r: ld-locked.inc $(PASS1_LIBBOARD)
+ @echo "LD: locked.r"
+ @$(LD) -o $@ $(PASS1_LDFLAGS) $(PASS1_LIBPATHS) --start-group $(PASS1_LDLIBS) --end-group $(PASS1_LIBGCC)
+ @$(NM) $@ > locked.map
+ @fgrep " U " locked.map | grep -v os_start
+ @$(CROSSDEV)size $@
+
+$(PASS1_SRCDIR)/locked.r: locked.r
+ @cp -a locked.r $(TOPDIR)/$(PASS1_SRCDIR)/locked.r
+
+.depend:
+
+depend: .depend
+
+clean:
+ @rm -f locked.r locked.map *~ .*.swp
+
+distclean: clean
+ @rm -f ld-locked.inc
+
diff --git a/nuttx/configs/ea3131/locked/ld-locked.script b/nuttx/configs/ea3131/locked/ld-locked.script
new file mode 100644
index 000000000..955505364
--- /dev/null
+++ b/nuttx/configs/ea3131/locked/ld-locked.script
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * configs/ea3131/locked/ld-locked.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+INCLUDE ld-locked.inc
+OUTPUT_ARCH(arm)
+SECTIONS
+{
+ .text.locked : { *(.text .text.*) }
+ .data : { *(.data) }
+ .bss : { *(.bss) *(COMMON) }
+}
diff --git a/nuttx/configs/ea3131/locked/mklocked.sh b/nuttx/configs/ea3131/locked/mklocked.sh
new file mode 100755
index 000000000..731accde3
--- /dev/null
+++ b/nuttx/configs/ea3131/locked/mklocked.sh
@@ -0,0 +1,225 @@
+#!/bin/bash
+###########################################################################
+# configs/ea3131/locked/mklocked.sh
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+#set -x
+
+############################################################################
+# Arguments
+############################################################################
+
+USAGE="$0 <nuttx-dir>"
+
+TOPDIR="$1"
+CONFIG="$TOPDIR/.config"
+if [ -z "$TOPDIR" ]; then
+ echo "Missing Argument"
+ echo $USAGE
+ exit 1
+fi
+if [ ! -d "$TOPDIR" ]; then
+ echo "NuttX directory does not exist: $TOPDIR"
+ echo $USAGE
+ exit 1
+fi
+if [ ! -f "$CONFIG" ]; then
+ echo "Configuration file not found: $CONFIG"
+ exit 1
+fi
+
+############################################################################
+# Functions
+############################################################################
+
+function checkconfig () {
+ CONFIGLINE=`cat "$CONFIG" | grep "$1="`
+ if [ -z "$CONFIGLINE" ]; then
+ echo "n"
+ fi
+ if [ "X${CONFIGLINE}" = "X${1}=y" ]; then
+ echo "y"
+ else
+ echo "n"
+ fi
+}
+
+function checkzero () {
+ CONFIGLINE=`cat "$CONFIG" | grep "$1="`
+ if [ -z "$CONFIGLINE" ]; then
+ echo "y"
+ fi
+ if [ "X${CONFIGLINE}" = "X${1}=0" ]; then
+ echo "y"
+ else
+ echo "n"
+ fi
+}
+
+############################################################################
+# Interrupt Handlers
+############################################################################
+#
+# All interrupt handlers must be forced to lie in the locked .text region
+#
+# These are the vector entry points (only one is really needed since they
+# are all in the same file). These should drag in all of the vector
+# dispatching logic.
+#
+
+rm -f ld-locked.inc
+echo "EXTERN(up_vectorswi)" >>ld-locked.inc
+echo "EXTERN(up_vectordata)" >>ld-locked.inc
+echo "EXTERN(up_vectorprefetch)" >>ld-locked.inc
+echo "EXTERN(up_vectorundefinsn)" >>ld-locked.inc
+echo "EXTERN(up_vectorfiq)" >>ld-locked.inc
+echo "EXTERN(up_vectorirq)" >>ld-locked.inc
+echo "EXTERN(up_vectoraddrexcptn)" >>ld-locked.inc
+
+#
+# These are the initialization entry points of all device drivers that
+# handle interrupts. We really want to include as little as possible --
+# ideally just the interrupt handler itself, but that is not usually
+# possible.
+#
+# Of course, this list must be extended as interrupt handlers are added.
+
+echo "EXTERN(up_timerinit)" >>ld-locked.inc
+
+answer=$(checkconfig CONFIG_LPC31_UART)
+if [ $answer = y ]; then
+ echo "EXTERN(up_earlyserialinit)" >>ld-locked.inc
+fi
+
+# up_i2cinitialize -- Not conditioned on anything
+
+answer=$(checkconfig CONFIG_USBDEV)
+if [ $answer = y ]; then
+ echo "EXTERN(up_usbinitialize)" >>ld-locked.inc
+fi
+
+############################################################################
+# Initialization logic
+############################################################################
+# All initialization logic must be in memory because it must execute before
+# the page fill worker thread is started. Ideally this would be in some
+# region that is mapped initially, but then unmapped after initialization
+# is complete -- effectively freeing the memory used for the 1-time
+# initialization code. That optimization has not yet been made and, as
+# consequence, the 1-time initialization code takes up precious memory
+# in the locked memory region.
+#
+# up_boot is a low-level initialization function called by __start:
+
+echo "EXTERN(up_boot)" >>ld-locked.inc
+
+# All of the initialization functions that are called by os_start up to
+# the point where the page fill worker thread is started must also be
+# included in the locked text section (at least for now)
+
+answer=$(checkzero CONFIG_TASK_NAME_SIZE)
+if [ $answer = n ]; then
+ echo "EXTERN(up_boot)" >>ld-locked.inc
+fi
+
+echo "EXTERN(dq_addfirst)" >>ld-locked.inc
+echo "EXTERN(up_initial_state)" >>ld-locked.inc
+
+answer=$(checkconfig CONFIG_HEAP_BASE)
+if [ $answer = n ]; then
+ echo "EXTERN(up_allocate_heap)" >>ld-locked.inc
+fi
+
+echo "EXTERN(mm_initialize)" >>ld-locked.inc
+echo "EXTERN(irq_initialize)" >>ld-locked.inc
+echo "EXTERN(wd_initialize)" >>ld-locked.inc
+
+answer=$(checkconfig CONFIG_DISABLE_CLOCK)
+if [ $answer = n ]; then
+ echo "EXTERN(clock_initialize)" >>ld-locked.inc
+fi
+
+answer=$(checkconfig CONFIG_DISABLE_POSIX_TIMERS)
+if [ $answer = n ]; then
+ echo "EXTERN(timer_initialize)" >>ld-locked.inc
+fi
+
+answer=$(checkconfig CONFIG_DISABLE_SIGNALS)
+if [ $answer = n ]; then
+ echo "EXTERN(sig_initialize)" >>ld-locked.inc
+fi
+
+echo "EXTERN(sem_initialize)" >>ld-locked.inc
+
+answer=$(checkconfig CONFIG_DISABLE_MQUEUE)
+if [ $answer = n ]; then
+ echo "EXTERN(mq_initialize)" >>ld-locked.inc
+fi
+
+answer=$(checkconfig CONFIG_DISABLE_PTHREAD)
+if [ $answer = n ]; then
+ echo "EXTERN(pthread_initialize)" >>ld-locked.inc
+fi
+
+answer=$(checkzero CONFIG_NFILE_DESCRIPTORS)
+if [ $answer = n ]; then
+ echo "EXTERN(fs_initialize)" >>ld-locked.inc
+fi
+
+answer=$(checkconfig CONFIG_NET)
+if [ $answer = y ]; then
+ echo "EXTERN(net_initialize)" >>ld-locked.inc
+fi
+
+echo "EXTERN(up_initialize)" >>ld-locked.inc
+echo "EXTERN(lib_initialize)" >>ld-locked.inc
+echo "EXTERN(sched_setupidlefiles)" >>ld-locked.inc
+echo "EXTERN(task_create)" >>ld-locked.inc
+
+############################################################################
+# Idle Loop
+############################################################################
+#
+# The IDLE loop must be forced to lie in the locked .text region.
+
+echo "EXTERN(os_start)" >>ld-locked.inc
+echo "EXTERN(up_idle)" >>ld-locked.inc
+
+############################################################################
+# PG Fill Worker Thread
+############################################################################
+#
+# All of the page fill worker thread must be in the locked .text region.
+
+echo "EXTERN(pg_worker)" >>ld-locked.inc
diff --git a/nuttx/configs/ea3131/nsh/Make.defs b/nuttx/configs/ea3131/nsh/Make.defs
new file mode 100644
index 000000000..01b83a5a6
--- /dev/null
+++ b/nuttx/configs/ea3131/nsh/Make.defs
@@ -0,0 +1,165 @@
+############################################################################
+# configs/ea3131/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC31_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_LPC31_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CONFIG_LPC31_BUILDROOT),y)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ea3131/nsh/appconfig b/nuttx/configs/ea3131/nsh/appconfig
new file mode 100644
index 000000000..abfba2c45
--- /dev/null
+++ b/nuttx/configs/ea3131/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/ea3131/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/ea3131/nsh/defconfig b/nuttx/configs/ea3131/nsh/defconfig
new file mode 100644
index 000000000..928fdb239
--- /dev/null
+++ b/nuttx/configs/ea3131/nsh/defconfig
@@ -0,0 +1,394 @@
+############################################################################
+# configs/ea3131/nsh/defconfig
+#
+# Copyright (C) 2010,2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="lpc31xx"
+CONFIG_ARCH_CHIP_LPC31XX=y
+CONFIG_ARCH_CHIP_LPC3131=y
+CONFIG_ARCH_BOARD="ea3131"
+CONFIG_ARCH_BOARD_EA3131=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x11028000
+CONFIG_DRAM_VSTART=0x11028000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=y
+
+# Identify toolchain and linker options
+#
+CONFIG_LPC31_CODESOURCERYW=n
+CONFIG_LPC31_CODESOURCERYL=n
+CONFIG_LPC31_DEVKITARM=n
+CONFIG_LPC31_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC31_MCI=n
+CONFIG_LPC31_SPI=n
+CONFIG_LPC31_UART=y
+
+#
+# Exernal memory available on the board (see also CONFIG_MM_REGIONS)
+#
+CONFIG_LPC31_EXTSRAM0=n
+CONFIG_LPC31_EXTSRAM0HEAP=n
+CONFIG_LPC31_EXTSRAM0SIZE=131072
+CONFIG_LPC31_EXTSRAM1=n
+CONFIG_LPC31_EXTSRAM1HEAP=n
+CONFIG_LPC31_EXTSRAM1SIZE=131072
+CONFIG_LPC31_EXTSDRAM=n
+CONFIG_LPC31_EXTSDRAMHEAP=n
+CONFIG_LPC31_EXTSDRAMSIZE=67108864
+CONFIG_LPC31_EXTNAND=n
+CONFIG_LPC31_EXTNANDSIZE=67108864
+
+#
+# LPC31XX specific device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=y
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=15
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC31XX USB Configuration
+#
+CONFIG_LPC31_GIO_USBATTACH=6
+CONFIG_LPC31_GIO_USBDPPULLUP=17
+CONFIG_LPC31_VENDORID=0xd320
+CONFIG_LPC31_PRODUCTID=0x3211
+CONFIG_LPC31_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
diff --git a/nuttx/configs/ea3131/nsh/setenv.sh b/nuttx/configs/ea3131/nsh/setenv.sh
new file mode 100755
index 000000000..00b1e0c43
--- /dev/null
+++ b/nuttx/configs/ea3131/nsh/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/ea3131/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools subdirectory
+
+export LPCTOOL_DIR="${WD}/configs/ea3152/tools"
+
+# Add the path to the toolchain to the PATH varialble
+
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ea3131/ostest/Make.defs b/nuttx/configs/ea3131/ostest/Make.defs
new file mode 100644
index 000000000..0ed68f285
--- /dev/null
+++ b/nuttx/configs/ea3131/ostest/Make.defs
@@ -0,0 +1,165 @@
+############################################################################
+# configs/ea3131/ostest/Make.defs
+#
+# Copyright (C) 2009,2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC31_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_LPC31_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CONFIG_LPC31_BUILDROOT),y)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ea3131/ostest/appconfig b/nuttx/configs/ea3131/ostest/appconfig
new file mode 100644
index 000000000..c665ea7b2
--- /dev/null
+++ b/nuttx/configs/ea3131/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ea3131/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ea3131/ostest/defconfig b/nuttx/configs/ea3131/ostest/defconfig
new file mode 100644
index 000000000..6b6b9b584
--- /dev/null
+++ b/nuttx/configs/ea3131/ostest/defconfig
@@ -0,0 +1,394 @@
+############################################################################
+# configs/ea3131/ostest/defconfig
+#
+# Copyright (C) 2009-2010,2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="lpc31xx"
+CONFIG_ARCH_CHIP_LPC31XX=y
+CONFIG_ARCH_CHIP_LPC3131=y
+CONFIG_ARCH_BOARD="ea3131"
+CONFIG_ARCH_BOARD_EA3131=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x11028000
+CONFIG_DRAM_VSTART=0x11028000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=y
+
+# Identify toolchain and linker options
+#
+CONFIG_LPC31_CODESOURCERYW=n
+CONFIG_LPC31_CODESOURCERYL=n
+CONFIG_LPC31_DEVKITARM=n
+CONFIG_LPC31_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC31_MCI=n
+CONFIG_LPC31_SPI=n
+CONFIG_LPC31_UART=y
+
+#
+# Exernal memory available on the board (see also CONFIG_MM_REGIONS)
+#
+CONFIG_LPC31_EXTSRAM0=n
+CONFIG_LPC31_EXTSRAM0HEAP=n
+CONFIG_LPC31_EXTSRAM0SIZE=131072
+CONFIG_LPC31_EXTSRAM1=n
+CONFIG_LPC31_EXTSRAM1HEAP=n
+CONFIG_LPC31_EXTSRAM1SIZE=131072
+CONFIG_LPC31_EXTSDRAM=n
+CONFIG_LPC31_EXTSDRAMHEAP=n
+CONFIG_LPC31_EXTSDRAMSIZE=67108864
+CONFIG_LPC31_EXTNAND=n
+CONFIG_LPC31_EXTNANDSIZE=67108864
+
+#
+# LPC31XX specific device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=y
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=26
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC31XX USB Configuration
+#
+CONFIG_LPC31_GIO_USBATTACH=6
+CONFIG_LPC31_GIO_USBDPPULLUP=17
+CONFIG_LPC31_VENDORID=0xd320
+CONFIG_LPC31_PRODUCTID=0x3211
+CONFIG_LPC31_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMISRAM=y
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
diff --git a/nuttx/configs/ea3131/ostest/setenv.sh b/nuttx/configs/ea3131/ostest/setenv.sh
new file mode 100755
index 000000000..cd894a300
--- /dev/null
+++ b/nuttx/configs/ea3131/ostest/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/ea3131/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools subdirectory
+
+export LPCTOOL_DIR="${WD}/configs/ea3152/tools"
+
+# Add the path to the toolchain to the PATH varialble
+
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ea3131/pgnsh/Make.defs b/nuttx/configs/ea3131/pgnsh/Make.defs
new file mode 100644
index 000000000..d9a6794f5
--- /dev/null
+++ b/nuttx/configs/ea3131/pgnsh/Make.defs
@@ -0,0 +1,165 @@
+############################################################################
+# configs/ea3131/pgnsh/Make.defs
+#
+# Copyright (C) 2010,2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC31_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_LPC31_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/pg-ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/pg-ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CONFIG_LPC31_BUILDROOT),y)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ea3131/pgnsh/appconfig b/nuttx/configs/ea3131/pgnsh/appconfig
new file mode 100644
index 000000000..c8cb5bcb2
--- /dev/null
+++ b/nuttx/configs/ea3131/pgnsh/appconfig
@@ -0,0 +1,45 @@
+############################################################################
+# configs/ea3131/pgnsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+
diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig
new file mode 100644
index 000000000..8f49d59a8
--- /dev/null
+++ b/nuttx/configs/ea3131/pgnsh/defconfig
@@ -0,0 +1,437 @@
+############################################################################
+# configs/ea3131/pgnsh/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="lpc31xx"
+CONFIG_ARCH_CHIP_LPC31XX=y
+CONFIG_ARCH_CHIP_LPC3131=y
+CONFIG_ARCH_BOARD="ea3131"
+CONFIG_ARCH_BOARD_EA3131=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x11028000
+CONFIG_DRAM_VSTART=0x11028000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=n
+
+# Identify toolchain and linker options
+#
+CONFIG_LPC31_CODESOURCERYW=n
+CONFIG_LPC31_CODESOURCERYL=n
+CONFIG_LPC31_DEVKITARM=n
+CONFIG_LPC31_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC31_MCI=n
+CONFIG_LPC31_SPI=y
+CONFIG_LPC31_UART=y
+
+#
+# Exernal memory available on the board (see also CONFIG_MM_REGIONS)
+#
+CONFIG_LPC31_EXTSRAM0=n
+CONFIG_LPC31_EXTSRAM0HEAP=n
+CONFIG_LPC31_EXTSRAM0SIZE=131072
+CONFIG_LPC31_EXTSRAM1=n
+CONFIG_LPC31_EXTSRAM1HEAP=n
+CONFIG_LPC31_EXTSRAM1SIZE=131072
+CONFIG_LPC31_EXTSDRAM=n
+CONFIG_LPC31_EXTSDRAMHEAP=n
+CONFIG_LPC31_EXTSDRAMSIZE=67108864
+CONFIG_LPC31_EXTNAND=n
+CONFIG_LPC31_EXTNANDSIZE=67108864
+
+#
+# LPC31XX specific device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=y
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+
+#
+# MP25x Configuration
+#
+CONFIG_MP25P_SPIMODE=3
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# Setup for a two-pass build
+#
+CONFIG_BUILD_2PASS=y
+CONFIG_PASS1_BUILDIR=configs/ea3131/locked
+CONFIG_PASS1_TARGET=all
+CONFIG_PASS1_OBJECT=locked.r
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_PAGING=n
+CONFIG_DEBUG_FS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=15
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# OS setup related to on-demand paging:
+#
+CONFIG_PAGING=y
+CONFIG_PAGING_PAGESIZE=1024
+CONFIG_PAGING_NLOCKED=48
+#CONFIG_PAGING_LOCKED_PBASE
+#CONFIG_PAGING_LOCKED_VBASE
+CONFIG_PAGING_NPPAGED=96
+CONFIG_PAGING_NVPAGED=384
+CONFIG_PAGING_NDATA=32
+#CONFIG_PAGING_DEFPRIO
+CONFIG_PAGING_STACKSIZE=2048
+CONFIG_PAGING_BLOCKINGFILL=y
+#CONFIG_PAGING_WORKPERIOD
+#CONFIG_PAGING_TIMEOUT_TICKS
+#CONFIG_PAGING_VECPPAGE
+#CONFIG_PAGING_VECL2PADDR
+#CONFIG_PAGING_VECL2VADDR
+#CONFIG_PAGING_BINPATH="/mnt/pgsrc/nuttx.bin"
+CONFIG_PAGING_MOUNTPT="/mnt/pgsrc"
+CONFIG_PAGING_MINOR=0
+CONFIG_PAGING_SDSLOT=0
+CONFIG_PAGING_M25PX=n
+CONFIG_PAGING_AT45DB=n
+CONFIG_PAGING_BINOFFSET=0
+CONFIG_PAGING_SPIPORT=0
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC31XX USB Configuration
+#
+CONFIG_LPC31_GIO_USBATTACH=6
+CONFIG_LPC31_GIO_USBDPPULLUP=17
+CONFIG_LPC31_VENDORID=0xd320
+CONFIG_LPC31_PRODUCTID=0x3211
+CONFIG_LPC31_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMISRAM=y
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
diff --git a/nuttx/configs/ea3131/pgnsh/setenv.sh b/nuttx/configs/ea3131/pgnsh/setenv.sh
new file mode 100755
index 000000000..ead7c9ffa
--- /dev/null
+++ b/nuttx/configs/ea3131/pgnsh/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/ea3131/pgnsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools subdirectory
+
+export LPCTOOL_DIR="${WD}/configs/ea3152/tools"
+
+# Add the path to the toolchain to the PATH varialble
+
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ea3131/scripts/ld.script b/nuttx/configs/ea3131/scripts/ld.script
new file mode 100644
index 000000000..333117c19
--- /dev/null
+++ b/nuttx/configs/ea3131/scripts/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/ea3131/scripts/ld.script
+ *
+ * Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC3131 has 192Kb of ISRAM beginning at virtual address 0x1102:8000.
+ * LPC31xx boot ROM expects the boot image be compiled with entry point at
+ * 0x1102:9000. A 128b header will appear at this address (applied by
+ * lpc313xImgCreator) and the executable code must begin at 0x1102:9080.
+ */
+
+MEMORY
+{
+ isram (rwx) : ORIGIN = 0x11029080, LENGTH = 192K - 4224
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > isram
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > isram
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >isram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > isram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > isram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ea3131/scripts/pg-ld.script b/nuttx/configs/ea3131/scripts/pg-ld.script
new file mode 100644
index 000000000..90a713c7d
--- /dev/null
+++ b/nuttx/configs/ea3131/scripts/pg-ld.script
@@ -0,0 +1,151 @@
+/****************************************************************************
+ * configs/ea3131/scripts/pg-ld.script
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC3131 has 192Kb of ISRAM beginning at virtual address 0x1102:8000.
+ * LPC31xx boot ROM expects the boot image be compiled with entry point at
+ * 0x1102:9000. A 128b header will appear at this address (applied by
+ * lpc313xImgCreator) and the executable code must begin at 0x1102:9080.
+ *
+ * The .text vitual address space begins at the same location as the physical
+ * address space: 0x1102 8000. The virtual space is broken up into three
+ * regions:
+ *
+ * PHYSICAL VIRTUAL
+ * NAME DESCRIPTION SIZE START SIZE START
+ * -------- -------------------------- ----- ----------- ------- -----------
+ * locked Pages locked in memory. 48Kb 0x1102 8000 48Kb 0x1102 8000
+ * paged Pages in nonvolatile store. 96Kb 0x1103 4000 384Kb 0x1103 4000
+ * data .data/.bss/heap. 32Kb 0x1104 c000 32Kb 0x1109 4000
+ * Reserved for page table 16Kb 0x1105 4000 16Kb 0x1109 c000
+ * -------- -------------------------- ----- ----------- ------- -----------
+ * 192Kb 0x1105 8000 480Kb 0x110a 0000
+ *
+ * These region sizes must match the size in pages specified for each region
+ * in the NuttX configuration file: CONFIG_PAGING_NLOCKED, CONFIG_PAGING_NVPAGED,
+ * and CONFIG_PAGING_NDATA.
+ *
+ * NOTE 1: The locked region is really big here so that you can enable lots of
+ * debug output without overflowing the locked region. 32Kb would probably be
+ * plenty if this were a real, optimized application.
+ *
+ * NOTE 2: Different compilers will compile the code to different sizes. If you
+ * get a link time error saying that the locked region is full, you may have to
+ * re-organize this memory layout (here and in defconfig) to make the locked
+ * region even bigger.
+ */
+
+MEMORY
+{
+ locked (rx) : ORIGIN = 0x11029080, LENGTH = 48K - 4224
+ paged (rx) : ORIGIN = 0x11034000, LENGTH = 384K
+ data (rw) : ORIGIN = 0x11094000, LENGTH = 44K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .locked : {
+ _slocked = ABSOLUTE(.);
+ *(.vectors)
+ up_head.o locked.r (.text .text.*)
+ up_head.o locked.r (.fixup)
+ up_head.o locked.r (.gnu.warning)
+ up_head.o locked.r (.rodata .rodata.*)
+ up_head.o locked.r (.gnu.linkonce.t.*)
+ up_head.o locked.r (.glue_7)
+ up_head.o locked.r (.glue_7t)
+ up_head.o locked.r (.got)
+ up_head.o locked.r (.gcc_except_table)
+ up_head.o locked.r (.gnu.linkonce.r.*)
+ _elocked = ABSOLUTE(.);
+ } >locked
+
+ _eronly = ABSOLUTE(.);
+
+ .paged : {
+ _spaged = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _epaged = ABSOLUTE(.);
+ } > paged
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > data AT > locked
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >data
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } > data
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > data
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ea3131/src/Makefile b/nuttx/configs/ea3131/src/Makefile
new file mode 100644
index 000000000..c3774db71
--- /dev/null
+++ b/nuttx/configs/ea3131/src/Makefile
@@ -0,0 +1,105 @@
+############################################################################
+# configs/ea3131/src/Makefile
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_clkinit.c
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+ifeq ($(CONFIG_LPC31_EXTSDRAM),y)
+CSRCS += up_mem.c
+endif
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+ifeq ($(CONFIG_LPC31_SPI),y)
+CSRCS += up_spi.c
+endif
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_PAGING),y)
+CSRCS += up_fillpage.c
+endif
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ea3131/src/ea3131_internal.h b/nuttx/configs/ea3131/src/ea3131_internal.h
new file mode 100644
index 000000000..4a8ae3fa4
--- /dev/null
+++ b/nuttx/configs/ea3131/src/ea3131_internal.h
@@ -0,0 +1,127 @@
+/************************************************************************************
+ * configs/ea3131/src/ea3131_internal.h
+ * arch/arm/src/board/ea3131_internal.n
+ *
+ * Copyright (C) 2009-2010,2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EA3131_SRC_EA3131_INTERNAL_H
+#define __CONFIGS_EA3131_SRC_EA3131_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+#include "lpc31_ioconfig.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* EA3131L GPIOs ********************************************************************/
+
+/* LEDs -- interface through an I2C GPIO expander */
+
+/* BUTTONS -- NOTE that some have EXTI interrupts configured */
+
+/* SPI Chip Selects */
+/* SPI NOR flash is the only device on SPI. SPI_CS_OUT0 is its chip select */
+
+#define SPINOR_CS IOCONFIG_SPI_CSOUT0
+
+/* USB Soft Connect Pullup -- NONE */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_meminitialize
+ *
+ * Description:
+ * Initialize external memory resources (sram, sdram, nand, nor, etc.)
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC31_EXTSDRAM
+extern void lpc31_meminitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: lpc31_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the EA3131 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc31_spiinitialize(void);
+
+/************************************************************************************
+ * Name: lpc31_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the EA3131 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc31_usbinitialize(void);
+
+/************************************************************************************
+ * Name: lpc31_pginitialize
+ *
+ * Description:
+ * Set up mass storage device to support on demand paging.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_PAGING
+extern void weak_function lpc31_pginitialize(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_EA3131_SRC_EA3131_INTERNAL_H */
+
diff --git a/nuttx/configs/ea3131/src/up_boot.c b/nuttx/configs/ea3131/src/up_boot.c
new file mode 100644
index 000000000..1fd9069f8
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_boot.c
@@ -0,0 +1,119 @@
+/************************************************************************************
+ * configs/ea3131/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009,2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lpc31_internal.h"
+#include "ea3131_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_boardinitialize
+ *
+ * Description:
+ * All LPC31XX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc31_boardinitialize(void)
+{
+ /* Initialize configured, external memory resources */
+
+#ifdef CONFIG_LPC31_EXTSDRAM
+ lpc31_meminitialize();
+#endif
+
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * lpc31_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_LPC31_SPI)
+ if (lpc31_spiinitialize)
+ {
+ lpc31_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function lpc31_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_LPC31_USB)
+ if (lpc31_usbinitialize)
+ {
+ lpc31_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+
+ /* Set up mass storage device to support on demand paging */
+
+#if defined(CONFIG_PAGING)
+ if (lpc31_pginitialize)
+ {
+ lpc31_pginitialize();
+ }
+#endif
+}
diff --git a/nuttx/configs/ea3131/src/up_buttons.c b/nuttx/configs/ea3131/src/up_buttons.c
new file mode 100644
index 000000000..8dd468a9e
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_buttons.c
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * configs/ea3131/src/up_leds.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "ea3131_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ return 0;
+}
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/ea3131/src/up_clkinit.c b/nuttx/configs/ea3131/src/up_clkinit.c
new file mode 100644
index 000000000..247844a81
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_clkinit.c
@@ -0,0 +1,444 @@
+/****************************************************************************
+ * configs/ea3131/src/up_clkinit.c
+ * arch/arm/src/board/up_clkinit.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * References:
+ * - NXP UM10314 LPC3130/31 User manual Rev. 1.01 — 9 September 2009
+ * - NXP lpc313x.cdl.drivers.zip example driver code
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "lpc31_cgu.h"
+#include "lpc31_cgudrvr.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Sub-domain Clock Bitsets *************************************************/
+/* The following bitsets group clocks into bitsets associated with each
+ * domain and fractional divider subdomain.
+ *
+ * Domain 0 (DOMAINID_SYS), Clocks 0 - 29, Fraction dividers 0-6. Clocks not
+ * defined in the clock sets will be sourced with SYS_BASE_CLK.
+ */
+
+/* Domain 0, Fractional divider 0: */
+
+#define CGU_CLKSET_DOMAIN0_DIV0 \
+ (_D0B(CLKID_APB0CLK)|_D0B(CLKID_APB1CLK)|_D0B(CLKID_APB2CLK)|\
+ _D0B(CLKID_APB3CLK)|_D0B(CLKID_APB4CLK)|_D0B(CLKID_AHB2INTCCLK)|\
+ _D0B(CLKID_AHB0CLK)|_D0B(CLKID_DMAPCLK)|_D0B(CLKID_DMACLKGATED)|\
+ _D0B(CLKID_NANDFLASHS0CLK)|_D0B(CLKID_NANDFLASHPCLK)|\
+ _D0B(CLKID_ARM926BUSIFCLK)|_D0B(CLKID_SDMMCHCLK)|_D0B(CLKID_USBOTGAHBCLK)|\
+ _D0B(CLKID_ISRAM0CLK)|_D0B(CLKID_ISRAM1CLK)|_D0B(CLKID_ISROMCLK)|\
+ _D0B(CLKID_MPMCCFGCLK)|_D0B(CLKID_MPMCCFGCLK2)|_D0B(CLKID_INTCCLK))
+
+/* Domain 0, Fractional divider 1: */
+
+#define CGU_CLKSET_DOMAIN0_DIV1 \
+ (_D0B(CLKID_ARM926CORECLK))
+
+/* Domain 0, Fractional divider 2: */
+
+#define CGU_CLKSET_DOMAIN0_DIV2 \
+ (_D0B(CLKID_NANDFLASHAESCLK)|_D0B(CLKID_NANDFLASHNANDCLK))
+
+/* Domain 0, Fractional divider 3: */
+
+#define CGU_CLKSET_DOMAIN0_DIV3 \
+ (_D0B(CLKID_NANDFLASHECCCLK))
+
+/* Domain 0, Fractional divider 4: */
+
+#define CGU_CLKSET_DOMAIN0_DIV4 \
+ (_D0B(CLKID_SDMMCCCLKIN))
+
+/* Domain 0, Fractional divider 5: */
+
+#define CGU_CLKSET_DOMAIN0_DIV5 \
+ (_D0B(CLKID_CLOCKOUT))
+
+/* Domain 0, Fractional divider 6: */
+
+#define CGU_CLKSET_DOMAIN0_DIV6 \
+ (_D0B(CLKID_EBICLK))
+
+/* Domain 1 (DOMAINID_AHB0APB0), Clocks 30-39, Fraction dividers 7-8. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB0_BASE_CLK.
+ */
+
+/* Domain 1, Fractional divider 7: */
+
+#define CGU_CLKSET_DOMAIN1_DIV7 \
+ (_D1B(CLKID_ADCCLK))
+
+/* Domain 1, Fractional divider 8: */
+
+#define CGU_CLKSET_DOMAIN1_DIV8 \
+ (_D1B(CLKID_AHB2APB0PCLK)|_D1B(CLKID_EVENTROUTERPCLK)|\
+ _D1B(CLKID_ADCPCLK)|_D1B(CLKID_WDOGPCLK)|_D1B(CLKID_IOCONFPCLK)|\
+ _D1B(CLKID_CGUPCLK)|_D1B(CLKID_SYSCREGPCLK)|_D1B(CLKID_OTPPCLK)|\
+ _D1B(CLKID_RNGPCLK))
+
+/* Domain 2 (DOMAINID_AHB0APB1), Clocks 40-49, Fraction dividers 9-10. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB1_BASE_CLK.
+ */
+
+/* Domain 2, Fractional divider 9: */
+
+#define CGU_CLKSET_DOMAIN2_DIV9 \
+ (_D2B(CLKID_AHB2APB1PCLK)|_D2B(CLKID_TIMER0PCLK)|_D2B(CLKID_TIMER1PCLK)|\
+ _D2B(CLKID_TIMER2PCLK)|_D2B(CLKID_TIMER3PCLK)|_D2B(CLKID_PWMPCLK)|\
+ _D2B(CLKID_PWMPCLKREGS)|_D2B(CLKID_I2C0PCLK)|_D2B(CLKID_I2C1PCLK))
+
+/* Domain 2, Fractional divider 10: */
+
+#define CGU_CLKSET_DOMAIN2_DIV10 \
+ (_D2B(CLKID_PWMCLK))
+
+/* Domain 3 (DOMAINID_AHB0APB2), Clocks 50-57, Fraction dividers 11-13. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB2_BASE_CLK.
+ */
+
+/* Domain 3, Fractional divider 11: */
+
+#define CGU_CLKSET_DOMAIN3_DIV11 \
+ ( _D3B(CLKID_AHB2APB2PCLK)|_D3B(CLKID_PCMPCLK)|_D3B(CLKID_PCMAPBPCLK)|\
+ _D3B(CLKID_UARTAPBCLK)|_D3B(CLKID_LCDPCLK)|_D3B(CLKID_SPIPCLK)|\
+ _D3B(CLKID_SPIPCLKGATED))
+
+/* Domain 3, Fractional divider 12: */
+
+#define CGU_CLKSET_DOMAIN3_DIV12 \
+ (_D3B(CLKID_LCDCLK))
+
+/* Domain 3, Fractional divider 13: */
+
+#define CGU_CLKSET_DOMAIN3_DIV13 \
+ (0)
+
+/* Domain 4 (DOMAINID_AHB0APB3), Clocks 58-70, Fraction divider 14. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB3_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN4_DIV14 \
+ (_D4B(CLKID_AHB2APB3PCLK)|_D4B(CLKID_I2SCFGPCLK)|_D4B(CLKID_EDGEDETPCLK)|\
+ _D4B(CLKID_I2STXFIFO0PCLK)|_D4B(CLKID_I2STXIF0PCLK)|_D4B(CLKID_I2STXFIFO1PCLK)|\
+ _D4B(CLKID_I2STXIF1PCLK)|_D4B(CLKID_I2SRXFIFO0PCLK)|_D4B(CLKID_I2SRXIF0PCLK)|\
+ _D4B(CLKID_I2SRXFIFO1PCLK)|_D4B(CLKID_I2SRXIF1PCLK))
+
+/* Domain 5 (DOMAINID_PCM), Clock 71, Fraction divider 15. Clocks not
+ * defined in the clock sets will be sourced with AHB_APB3_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN5_DIV15 \
+ (_D5B(CLKID_PCMCLKIP))
+
+/* Domain 6 (DOMAINID_UART), Clock 72, Fraction divider 16. Clocks mpt
+ * defined in the clock sets will be sourced with UART_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN6_DIV16 \
+ (0)
+
+/* Domain 7 (DOMAINID_CLK1024FS), Clocks 73-86, Fraction dividers 17-22. Clocks
+ * not defined in the clock sets will be sourced with CLK1024FS_BASE_CLK.
+ */
+
+/* Domain 7, Fractional divider 17: */
+
+#define CGU_CLKSET_DOMAIN7_DIV17 \
+ ( _D7B(CLKID_I2SEDGEDETECTCLK)|_D7B(CLKID_I2STXWS0)|_D7B(CLKID_I2STXWS1)|\
+ _D7B(CLKID_I2SRXWS0)|_D7B(CLKID_I2SRXWS1))
+
+/* Domain 7, Fractional divider 18: */
+
+#define CGU_CLKSET_DOMAIN7_DIV18 \
+ ( _D7B(CLKID_I2STXBCK0N)|_D7B(CLKID_I2STXBCK1N))
+
+/* Domain 7, Fractional divider 19: */
+
+#define CGU_CLKSET_DOMAIN7_DIV19 \
+ ( _D7B(CLKID_I2STXCLK0)|_D7B(CLKID_CLK256FS))
+
+/* Domain 7, Fractional divider 20: */
+
+#define CGU_CLKSET_DOMAIN7_DIV20 \
+ ( _D7B(CLKID_I2SRXBCK0N)|_D7B(CLKID_I2SRXBCK1N))
+
+/* Domain 7, Fractional divider 21: */
+
+#define CGU_CLKSET_DOMAIN7_DIV21 \
+ (0)
+
+/* Domain 7, Fractional divider 22: */
+
+#define CGU_CLKSET_DOMAIN7_DIV22 \
+ (0)
+
+/* Domain 8 (DOMAINID_BCK0, clock 87, and domain 9 (DOMAINID_BCK1), clock 88,
+ * are directly connected
+ */
+
+/* Domain 10 (DOMAINID_SPI), Clocks 89-90, Fraction divider 23. Clocks
+ * not defined in the clock sets will be sourced with SPI_CLK_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN10_DIV23 \
+ ( _D10B(CLKID_SPICLK)|_D10B(CLKID_SPICLKGATED))
+
+/* Domain 11 (DOMAINID_SYSCLKO, clock 91, is directly connected */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* Default clock configuration for the EA3131 board. Every board must
+ * provide an implementation of g_boardclks. This rather complex structure
+ * is used by the boot-up logic to configure initial lpc313x clocking.
+ *
+ * FFAST: 12MHz
+ * MASTER PLL Freq: 180MHz;
+ * AUDIOPLL Freq: 1024Fs, Fs = 44.1kHz
+ *
+ * Domain Input Subdomain Divider Ratio
+ * ------------------------ ----------------- ----------------- -------------
+ * 0 - DOMAIN_SYS MASTER PLL(HPLL1) DOMAIN0_DIV0 1/2
+ * DOMAIN0_DIV1 1
+ * DOMAIN0_DIV2 1/2
+ * DOMAIN0_DIV3 1/4
+ * DOMAIN0_DIV4 1/4
+ * DOMAIN0_DIV5 1/2
+ * DOMAIN0_DIV6 1/2
+ *
+ * 1 - DOMAIN_AHB0APB0 FFAST DOMAIN1_DIV7 1/38
+ * DOMAIN1_DIV8 1/2
+ *
+ * 2 - DOMAIN_AHB0APB1 FFAST DOMAIN2_DIV9 1/2
+ * DOMAIN2_DIV10 1/2
+ *
+ * 3 - DOMAIN_AHB0APB2 MASTER PLL(HPLL1) DOMAIN3_DIV11 1/2
+ * DOMAIN3_DIV12 1/40
+ * DOMAIN3_DIV13 1 (not used)
+ *
+ * 4 - DOMAIN_AHB0APB3 FFAST DOMAIN4_DIV14 1/2
+ *
+ * 5 - DOMAIN_PCM MASTER PLL(HPLL1) DOMAIN5_DIV15 1/2
+ *
+ * 6 - DOMAIN_UART FFAST DOMAIN6_DIV16 1
+ *
+ * 7 - DOMAIN_CLCK1024FS AUDIO PLL(HPLL0) DOMAIN7_DIV17 1/256
+ * DOMAIN7_DIV18 1/4
+ * DOMAIN7_DIV19 1
+ * DOMAIN7_DIV20 1/4
+ * DOMAIN7_DIV21 1/32
+ * DOMAIN7_DIV22 1/2
+ *
+ * 8 - DOMAIN_I2SRXBCK0 I2SRX_BCK0 - -
+ *
+ * 9 - DOMAIN_I2SRXBCK1 I2SRX_BCK1 - -
+ *
+ * 10 - DOMAIN_SPI MASTER PLL(HPLL1) DOMAIN10_DIV23 1/2
+ *
+ * 11 - DOMAIN_SYSCLKO FFAST - -
+ */
+
+const struct lpc31_clkinit_s g_boardclks =
+{
+ /* Domain 0 (DOMAINID_SYS), Clocks 0 - 29, Fraction dividers 0-6 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV0},
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN0_DIV1},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV2},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN0_DIV3},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN0_DIV4},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV5},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV6}
+ }
+ },
+
+ /* Domain 1 (DOMAINID_AHB0APB0), Clocks 30-39, Fraction dividers 7-8 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{1, 1, 38}, CGU_CLKSET_DOMAIN1_DIV7},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN1_DIV8}
+ }
+ },
+
+ /* Domain 2 (DOMAINID_AHB0APB1), Clocks 40-49, Fraction dividers 9-10 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN2_DIV9},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN2_DIV10}
+ }
+ },
+
+ /* Domain 3 (DOMAINID_AHB0APB2), Clocks 50-57, Fraction dividers 11-13 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN3_DIV11},
+ {{1, 1, 40}, CGU_CLKSET_DOMAIN3_DIV12},
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN3_DIV13}
+ }
+ },
+
+ /* Domain 4 (DOMAINID_AHB0APB3), Clocks 58-70, Fraction divider 14 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN4_DIV14}
+ }
+ },
+
+ /* Domain 5 (DOMAINID_PCM), Clock 71, Fraction divider 15 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN5_DIV15}
+ }
+ },
+
+ /* Domain 6 (DOMAINID_UART), Clock 72, Fraction divider 16 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN6_DIV16}
+ }
+ },
+
+ /* Domain 7 (DOMAINID_CLK1024FS), Clocks 73-86, Fraction dividers 17-22 */
+
+ {
+ CGU_FREQIN_HPPLL0,
+ {
+ {{1, 1, 256}, CGU_CLKSET_DOMAIN7_DIV17},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN7_DIV18},
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN7_DIV19},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN7_DIV20},
+ {{1, 1, 32}, CGU_CLKSET_DOMAIN7_DIV21},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN7_DIV22}
+ }
+ },
+
+ /* Domain 8 (DOMAINID_BCK0, clock 87 */
+
+ {
+ CGU_FREQIN_I2SRXBCK0
+ },
+
+ /* Domain 9 (DOMAINID_BCK1, clock 88 */
+
+ {
+ CGU_FREQIN_I2SRXBCK1
+ },
+
+ /* Domain 10 (DOMAINID_SPI), Clocks 89-90, Fraction divider 23 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN10_DIV23}
+ }
+ },
+
+ /* Domain 11 (DOMAINID_SYSCLKO, clock 91 */
+
+ {
+ CGU_FREQIN_FFAST
+ },
+
+ /* Dynamic fractional divider configuration (7) */
+
+#if 0 /* Dynamic fractional divider initialization not implemented */
+ {
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 64}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {0, 0, 0}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 3}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 6}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 6}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 6}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 3}
+ }
+ }
+#endif
+};
+
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
diff --git a/nuttx/configs/ea3131/src/up_fillpage.c b/nuttx/configs/ea3131/src/up_fillpage.c
new file mode 100644
index 000000000..9fdd80864
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_fillpage.c
@@ -0,0 +1,525 @@
+/****************************************************************************
+ * configs/ea3131/src/up_fillpage.c
+ * arch/arm/src/board/up_fillpage.c
+ *
+ * Copyright (C) 2010,2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/sched.h>
+#include <nuttx/page.h>
+
+#ifdef CONFIG_PAGING
+#ifdef CONFIG_PAGING_BINPATH
+# include <sys/stat.h>
+# include <sys/types.h>
+# include <stdbool.h>
+# include <unistd.h>
+# include <fcntl.h>
+# ifdef CONFIG_PAGING_SDSLOT
+# include <stdio.h>
+# include <sys/mount.h>
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+# include "lpc31_internal.h"
+# endif
+#endif
+
+#if defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+# include <sys/ioctl.h>
+# include <nuttx/fs/ioctl.h>
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+#endif
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* SD SLOT number might depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_EA3131
+# define HAVE_SD 1
+# define HAVE_SPINOR 1
+# if defined(CONFIG_PAGING_SDSLOT) && CONFIG_PAGING_SDSLOT != 0
+# error "Only one SD slot"
+# undef CONFIG_PAGING_SDSLOT
+# endif
+#else
+ /* Add configuration for new LPC31XX boards here */
+# error "Unrecognized LPC31XX board"
+# undef CONFIG_PAGING_SDSLOT
+# undef HAVE_SD
+# undef HAVE_SPINOR
+#endif
+
+/* Sanity check: We can only perform paging using a single source device */
+
+#if defined(CONFIG_PAGING_M25PX) && defined(CONFIG_PAGING_AT45DB)
+# error "Both CONFIG_PAGING_M25PX and CONFIG_PAGING_AT45DB are defined"
+# undef CONFIG_PAGING_M25PX
+#endif
+#if defined(CONFIG_PAGING_BINPATH) && defined(CONFIG_PAGING_M25PX)
+# error "Both CONFIG_PAGING_BINPATH and CONFIG_PAGING_M25PX are defined"
+# undef CONFIG_PAGING_BINPATH
+#endif
+#if defined(CONFIG_PAGING_BINPATH) && defined(CONFIG_PAGING_AT45DB)
+# error "Both CONFIG_PAGING_BINPATH and CONFIG_PAGING_AT45DB are defined"
+# undef CONFIG_PAGING_BINPATH
+#endif
+
+/* Are we accessing the page source data through a file path? */
+
+#ifdef CONFIG_PAGING_BINPATH
+
+ /* Can't support SD if the board does not support SD (duh) */
+
+# if defined(CONFIG_PAGING_SDSLOT) && !defined(HAVE_SD)
+# error "This board does not support SD"
+# undef CONFIG_PAGING_SDSLOT
+# endif
+
+ /* Can't support SD if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+# if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI)
+# ifdef CONFIG_PAGING_SDSLOT
+# error "Mountpoints and/or MCI disabled"
+# endif
+# undef CONFIG_PAGING_SDSLOT
+# undef HAVE_SD
+# endif
+
+ /* A mountpoint for the FAT file system must be provided */
+
+# if !defined(CONFIG_PAGING_MOUNTPT) && defined(CONFIG_PAGING_SDSLOT)
+# error "No CONFIG_PAGING_MOUNTPT provided"
+# undef CONFIG_PAGING_SDSLOT
+# undef HAVE_SD
+# endif
+
+ /* If no minor number is provided, default to zero */
+
+# ifndef CONFIG_PAGING_MINOR
+# define CONFIG_PAGING_MINOR 0
+# endif
+
+#endif /* CONFIG_PAGING_BINPATH */
+
+/* Are we accessing the page source data through the M25P* MTD device? */
+
+#if defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+
+ /* Verify that SPI support is enabld */
+
+#ifndef CONFIG_LPC31_SPI
+# error "SPI support is not enabled"
+#endif
+
+ /* Make sure that some value is defined for the offset into the FLASH
+ * of the NuttX binary image.
+ */
+
+# ifndef CONFIG_PAGING_BINOFFSET
+# define CONFIG_PAGING_BINOFFSET 0
+# endif
+
+ /* Make sure that some value is defined for the SPI port number */
+
+# ifndef CONFIG_PAGING_SPIPORT
+# define CONFIG_PAGING_SPIPORT 0
+# endif
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* State structure needed to support paging from a file */
+
+#ifdef CONFIG_PAGING_BINPATH
+struct pg_source_s
+{
+ bool initialized; /* TRUE: we are initialized */
+ int fd; /* File descriptor of the nuttx.bin file */
+};
+#endif
+
+/* State structured needd to support paging through the M25P* MTD interface. */
+
+#if defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+struct pg_source_s
+{
+ /* If interrupts or DMA are used, then we will have to defer initialization */
+
+ bool initialized; /* TRUE: we are initialized */
+
+ /* This is the M25P* device state structure */
+
+ FAR struct mtd_dev_s *mtd;
+
+ /* This the the device geometry */
+
+#ifdef CONFIG_DEBUG
+ FAR struct mtd_geometry_s geo;
+#endif
+};
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#if defined(CONFIG_PAGING_BINPATH) || defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+static struct pg_source_s g_pgsrc;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc31_initsrc()
+ *
+ * Description:
+ * Initialize the source device that will support paging.
+ * If BINPATH is defined, then it is the full path to a file on a mounted file
+ * system. In this case initialization will be deferred until the first
+ * time that up_fillpage() is called.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_PAGING_BINPATH)
+static inline void lpc31_initsrc(void)
+{
+#ifdef CONFIG_PAGING_SDSLOT
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+#endif
+
+ /* Are we already initialized? */
+
+ if (!g_pgsrc.initialized)
+ {
+#ifdef CONFIG_PAGING_SDSLOT
+ char devname[16];
+#endif
+
+ pgllvdbg("Initializing %s\n", CONFIG_PAGING_BINPATH);
+
+ /* No, do we need to mount an SD device? */
+
+#ifdef CONFIG_PAGING_SDSLOT
+
+ /* Yes.. First, get an instance of the SDIO interface */
+
+ sdio = sdio_initialize(CONFIG_PAGING_SDSLOT);
+ DEBUGASSERT(sdio != NULL);
+
+ /* Then bind the SDIO interface to the SD driver */
+
+ ret = mmcsd_slotinitialize(CONFIG_PAGING_MINOR, sdio);
+ DEBUGASSERT(ret == OK);
+
+ /* Then let's guess and say that there is a card in the slot.
+ * (We are basically jodido anyway if there is no card in the slot).
+ */
+
+ sdio_mediachange(sdio, true);
+
+ /* Now mount the file system */
+
+ snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_PAGING_MINOR);
+ ret = mount(devname, CONFIG_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL);
+ DEBUGASSERT(ret == OK);
+
+#endif /* CONFIG_PAGING_SDSLOT */
+
+ /* Open the selected path for read-only access */
+
+ g_pgsrc.fd = open(CONFIG_PAGING_BINPATH, O_RDONLY);
+ DEBUGASSERT(g_pgsrc.fd >= 0);
+
+ /* Then we are initialized */
+
+ g_pgsrc.initialized = true;
+ }
+}
+
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+static inline void lpc31_initsrc(void)
+{
+ FAR struct spi_dev_s *spi;
+#ifdef CONFIG_DEBUG
+ uint32_t capacity;
+ int ret;
+#endif
+
+ /* Are we already initialized? */
+
+ if (!g_pgsrc.initialized)
+ {
+ /* No... the initialize now */
+
+ pgllvdbg("Initializing\n");
+
+ /* First get an instance of the SPI device interface */
+
+ spi = up_spiinitialize(CONFIG_PAGING_SPIPORT);
+ DEBUGASSERT(spi != NULL);
+
+ /* Then bind the SPI interface to the MTD driver */
+
+#ifdef CONFIG_PAGING_M25PX
+ g_pgsrc.mtd = m25p_initialize(spi);
+#else
+ g_pgsrc.mtd = at45db_initialize(spi);
+#endif
+ DEBUGASSERT(g_pgsrc.mtd != NULL);
+
+ /* Verify that we can use the device */
+
+#ifdef CONFIG_DEBUG
+ /* Get the device geometry. (casting to uintptr_t first eliminates
+ * complaints on some architectures where the sizeof long is different
+ * from the size of a pointer).
+ */
+
+ ret = MTD_IOCTL(g_pgsrc.mtd, MTDIOC_GEOMETRY, (unsigned long)&g_pgsrc.geo);
+ DEBUGASSERT(ret >= 0);
+ capacity = g_pgsrc.geo.erasesize*g_pgsrc.geo.neraseblocks;
+ pgllvdbg("capacity: %d\n", capacity);
+ DEBUGASSERT(capacity >= (CONFIG_PAGING_BINOFFSET + PG_TEXT_VSIZE));
+#endif
+
+ /* We are now initialized */
+
+ g_pgsrc.initialized = true;
+ }
+}
+
+#else
+# define lpc31_initsrc()
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_fillpage()
+ *
+ * Description:
+ * After a page is allocated and mapped by up_allocpage(), the actual
+ * filling of the page with data from the non-volatile, must be performed
+ * by a separate call to the architecture-specific function, up_fillpage().
+ * This function is non-blocking, it will start an asynchronous page fill.
+ * The common paging logic will provide a callback function, pg_callback,
+ * that will be called when the page fill is finished (or an error occurs).
+ * This callback is assumed to occur from an interrupt level when the
+ * device driver completes the fill operation.
+ *
+ * NOTE 1: Allocating and filling a page is a two step process. up_allocpage()
+ * allocates the page, and up_fillpage() fills it with data from some non-
+ * volatile storage device. This distinction is made because up_allocpage()
+ * can probably be implemented in board-independent logic whereas up_fillpage()
+ * probably must be implemented as board-specific logic.
+ *
+ * NOTE 2: The initial mapping of vpage will be read-able, write-able,
+ * but non-cacheable. No special actions will be required of
+ * up_fillpage() in order to write into this allocated page. If the
+ * virtual address maps to a text region, however, this function should
+ * remap the region so that is is read/execute only. It should be made
+ * cache-able in any case.
+
+ * Input Parameters:
+ * tcb - A reference to the task control block of the task that needs to
+ * have a page fill. Architecture-specific logic can retrieve page
+ * fault information from the architecture-specific context
+ * information in this TCB to perform the fill.
+ * pg_callbck - The function to be called when the page fill is complete.
+ *
+ * Returned Value:
+ * This function will return zero (OK) if the page fill was successfully
+ * started (the result of the page fill is passed to the callback function
+ * as the result argument). A negated errno value may be returned if an
+ * error occurs. All errors, however, are fatal.
+ *
+ * NOTE: -EBUSY has a special meaning. It is used internally to mean that
+ * the callback function has not executed. Therefore, -EBUSY should
+ * never be provided in the result argument of pg_callback.
+ *
+ * Assumptions:
+ * - This function is called from the normal tasking context (but
+ * interrupts siabled). The implementation must take whatever actions
+ * are necessary to assure that the operation is safe within this context.
+ * - Upon return, the caller will sleep waiting for the page fill callback
+ * to occur. The callback function will perform the wakeup.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PAGING_BLOCKINGFILL
+
+/* Version 1: Supports blocking fill operations */
+
+int up_fillpage(FAR _TCB *tcb, FAR void *vpage)
+{
+#if defined(CONFIG_PAGING_BINPATH)
+ ssize_t nbytes;
+ off_t offset;
+ off_t pos;
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+ ssize_t nbytes;
+ off_t offset;
+#endif
+
+ pglldbg("TCB: %p vpage: %p far: %08x\n", tcb, vpage, tcb->xcp.far);
+ DEBUGASSERT(tcb->xcp.far >= PG_PAGED_VBASE && tcb->xcp.far < PG_PAGED_VEND);
+
+ /* If BINPATH is defined, then it is the full path to a file on a mounted file
+ * system. In this case initialization will be deferred until the first
+ * time that up_fillpage() is called. Are we initialized?
+ */
+
+#if defined(CONFIG_PAGING_BINPATH)
+
+ /* Perform initialization of the paging source device (if necessary) */
+
+ lpc31_initsrc();
+
+ /* Create an offset into the binary image that corresponds to the
+ * virtual address. File offset 0 corresponds to PG_LOCKED_VBASE.
+ */
+
+ offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE;
+
+ /* Seek to that position */
+
+ pos = lseek(g_pgsrc.fd, offset, SEEK_SET);
+ DEBUGASSERT(pos != (off_t)-1);
+
+ /* And read the page data from that offset */
+
+ nbytes = read(g_pgsrc.fd, vpage, PAGESIZE);
+ DEBUGASSERT(nbytes == PAGESIZE);
+ return OK;
+
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB) /* !CONFIG_PAGING_BINPATH */
+
+ /* Perform initialization of the paging source device (if necessary) */
+
+ lpc31_initsrc();
+
+ /* Create an offset into the binary image that corresponds to the
+ * virtual address. File offset 0 corresponds to PG_LOCKED_VBASE.
+ */
+
+ offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_PAGING_BINOFFSET;
+
+ /* Read the page at the correct offset into the SPI FLASH device */
+
+ nbytes = MTD_READ(g_pgsrc.mtd, offset, PAGESIZE, (FAR uint8_t *)vpage);
+ DEBUGASSERT(nbytes == PAGESIZE);
+ return OK;
+
+#else /* !CONFIG_PAGING_BINPATH && !CONFIG_PAGING_M25PX && !CONFIG_PAGING_AT45DB */
+
+# warning "Not implemented"
+ return -ENOSYS;
+
+#endif /* !CONFIG_PAGING_BINPATH && !CONFIG_PAGING_M25PX && !CONFIG_PAGING_AT45DB */
+}
+
+#else /* CONFIG_PAGING_BLOCKINGFILL */
+
+/* Version 2: Supports non-blocking, asynchronous fill operations */
+
+int up_fillpage(FAR _TCB *tcb, FAR void *vpage, up_pgcallback_t pg_callback)
+{
+ pglldbg("TCB: %p vpage: %d far: %08x\n", tcb, vpage, tcb->xcp.far);
+ DEBUGASSERT(tcb->xcp.far >= PG_PAGED_VBASE && tcb->xcp.far < PG_PAGED_VEND);
+
+#if defined(CONFIG_PAGING_BINPATH)
+# error "File system-based paging must always be implemented with blocking calls"
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+# error "SPI FLASH paging must always be implemented with blocking calls"
+#else
+# warning "Not implemented"
+#endif
+
+ return -ENOSYS;
+}
+
+#endif /* CONFIG_PAGING_BLOCKINGFILL */
+
+/************************************************************************************
+ * Name: lpc31_pginitialize
+ *
+ * Description:
+ * Set up mass storage device to support on demand paging.
+ *
+ ************************************************************************************/
+
+void weak_function lpc31_pginitialize(void)
+{
+ /* This initialization does nothing in this example setup. But this function is
+ * where you might, for example:
+ *
+ * - Initialize and configure a mass storage device to support on-demand paging.
+ * This might be, perhaps an SD card or NAND memory. An SPI FLASH would probably
+ * already have been configured by lpc31_spiinitialize(void);
+ * - Set up resources to support up_fillpage() operation. For example, perhaps the
+ * the text image is stored in a named binary file. In this case, the virtual
+ * text addresses might map to offsets into that file.
+ * - Do whatever else is necessary to make up_fillpage() ready for the first time
+ * that it is called.
+ *
+ * In reality, however, this function is not very useful: This function is called
+ * from a low level (before os_start() is even called), it may not be possible to
+ * perform file system operations or even to get debug output yet. Therefore,
+ * to keep life simple, initialization will be deferred in all cases until the first
+ * time that up_fillpage() is called.
+ */
+}
+
+#endif /* CONFIG_PAGING */
diff --git a/nuttx/configs/ea3131/src/up_leds.c b/nuttx/configs/ea3131/src/up_leds.c
new file mode 100644
index 000000000..ab22c7657
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_leds.c
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/ea3131/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lpc31_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ea3131/src/up_mem.c b/nuttx/configs/ea3131/src/up_mem.c
new file mode 100644
index 000000000..060f58eec
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_mem.c
@@ -0,0 +1,359 @@
+/****************************************************************************
+ * configs/ea3131/src/up_mem.c
+ * arch/arm/src/board/up_mem.c
+ *
+ * Copyright (C) 2009-2010,2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * References:
+ * - NXP UM10314 LPC3130/31 User manual Rev. 1.01 — 9 September 2009
+ * - NXP lpc313x.cdl.drivers.zip example driver code
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "lpc31_syscreg.h"
+#include "lpc31_cgudrvr.h"
+#include "lpc31_mpmc.h"
+#include "ea3131_internal.h"
+
+#ifdef CONFIG_LPC31_EXTSDRAM
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The MPMC delay based on trace lengths between SDRAM and the chip and on
+ * the delay strategy used for SDRAM.
+ */
+
+#define EA3131_MPMC_DELAY 0x824
+
+/*Delay constants in nanosecondss for MT48LC32M16LF SDRAM on board */
+
+#define EA3131_SDRAM_TRP (20)
+#define EA3131_SDRAM_TRFC (66)
+#define EA3131_SDRAM_TRAS (44)
+#define EA3131_SDRAM_TREX (75)
+#define EA3131_SDRAM_TARP 4
+#define EA3131_SDRAM_TWR (75)
+#define EA3131_SDRAM_TRC (66)
+#define EA3131_SDRAM_TRRD (15)
+#define EA3131_SDRAM_TMRD (20)
+#define EA3131_SDRAM_TXSR (75)
+#define EA3131_SDRAM_TDAL (50)
+#define EA3131_SDRAM_REFRESH (100)
+#define EA3131_SDRAM_OPERREFRESH (7812)
+
+/* Macro used to convert the above values (in nanoseconds) into units of
+ * the HCLK.
+ */
+
+#define NS2HCLKS(ns,hclk2,mask) \
+ ((uint32_t)(((uint64_t)ns *(uint64_t)hclk2) / 1000000000ull) & mask)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc31_sdraminitialize
+ *
+ * Description:
+ * Configure SDRAM on the EA3131 board
+ *
+ * Micron Initialization Sequence from their data sheet for the Micron
+ * MT48LC32M16A2 32M x 16 SDRAM chip:
+ *
+ * "SDRAMs must be powered up and initialized in a predefined manner.
+ * Operational procedures other than those specified may result in
+ * undefined operation. Once power is applied to VDD and VDDQ
+ * (simultaneously) and the clock is stable (stable clock is defined as
+ * a signal cycling within timing constraints specified for the clock
+ * pin), the SDRAM requires a 100µs delay prior to issuing any command
+ * other than a COMMAND INHIBIT or NOP.
+ *
+ * "Starting at some point during this 100µs period and continuing at least
+ * through the end of this period, COMMAND INHIBIT or NOP commands should
+ * be applied. Once the 100µs delay has been satisfied with at least one
+ * COMMAND INHIBIT or NOP command having been applied, a PRECHARGE command
+ * should be applied. All banks must then be precharged, thereby placing
+ * the device in the all banks idle state.
+ *
+ * "Once in the idle state, two AUTO REFRESH cycles must be performed. After
+ * the AUTO REFRESH cycles are complete, the SDRAM is ready for mode
+ * register programming.
+ *
+ * "Because the mode register will power up in an unknown state, it should
+ * be loaded prior to applying any operational command."
+ *
+ * The JEDEC recommendation for initializing SDRAM is:
+ *
+ * APPLY POWER (Vdd/Vddq equally, and CLK is stable)
+ * Wait 200uS
+ * PRECHARGE all
+ * 8 AUTO REFRESH COMMANDS
+ * LOAD MODE REGISTER
+ * SDRAM is ready for operation
+ *
+ * The Micron SDRAM parts will work fine with the JEDEC sequence, but also
+ * allow for a quicker init sequence of:
+ *
+ * APPLY POWER (Vdd/Vddq equally, and CLK is stable)
+ * Wait at least 100uS (during which time start applying and
+ * continue applying NOP or COMMAND INHIBIT)
+ * PRECHARGE all
+ * 2 AUTO REFRESH COMMANDS (min requirement, more than 2 is also ok)
+ * LOAD MODE REGISTER
+ * SDRAM is ready for operation
+ *
+ ****************************************************************************/
+
+static void lpc31_sdraminitialize(void)
+{
+ uint32_t tmp;
+ uint32_t regval;
+
+ /* These run-time calculations can be reduced dramatically if hclk is
+ * replaced with an apriori value.
+ */
+
+#ifdef CONFIG_LPC31_SDRAMHCLK
+# define HCLK CONFIG_LPC31_SDRAMHCLK
+#else
+ uint32_t hclk = lpc31_clkfreq(CLKID_MPMCCFGCLK2, DOMAINID_SYS);
+# define HCLK hclk
+#endif
+
+ /* Check RTL for divide by 2 possible. If so change then enable the followng logic */
+#if 0
+ uint32_t hclk2 = hclk;
+
+ if (((getreg32(LPC31_MPMC_CONFIG) & MPMC_CONFIG_CLK)) != 0)
+ {
+ hclk2 >>= 1;
+ }
+# define HCLK2 hclk2
+#else
+# define HCLK2 hclk
+#endif
+ up_udelay(100);
+
+ /* Set command delay startergy */
+
+ putreg32(MPMC_DYNREADCONFIG_CMDDEL, LPC31_MPMC_DYNREADCONFIG);
+
+ /* Configure device config register nSDCE0 for proper width SDRAM */
+
+ putreg32((MPMC_DYNCONFIG0_MDSDRAM|MPMC_DYNCONFIG_HP16_32MX16),
+ LPC31_MPMC_DYNCONFIG0);
+ putreg32((MPMC_DYNRASCAS0_RAS2CLK|MPMC_DYNRASCAS0_CAS2CLK),
+ LPC31_MPMC_DYNRASCAS0);
+
+ /* Min 20ns program 1 so that at least 2 HCLKs are used */
+
+ putreg32(NS2HCLKS(EA3131_SDRAM_TRP, HCLK2, MPMC_DYNTRP_MASK),
+ LPC31_MPMC_DYNTRP);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TRAS, HCLK2, MPMC_DYNTRAS_MASK),
+ LPC31_MPMC_DYNTRAS);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TREX, HCLK2, MPMC_DYNTSREX_MASK),
+ LPC31_MPMC_DYNTSREX);
+ putreg32(EA3131_SDRAM_TARP,
+ LPC31_MPMC_DYNTAPR);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TDAL, HCLK2, MPMC_DYNTDAL_MASK),
+ LPC31_MPMC_DYNTDAL);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TWR, HCLK2, MPMC_DYNTWR_MASK),
+ LPC31_MPMC_DYNTWR);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TRC, HCLK2, MPMC_DYNTRC_MASK),
+ LPC31_MPMC_DYNTRC);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TRFC, HCLK2, MPMC_DYNTRFC_MASK),
+ LPC31_MPMC_DYNTRFC);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TXSR, HCLK2, MPMC_DYNTXSR_MASK),
+ LPC31_MPMC_DYNTXSR);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TRRD, HCLK2, MPMC_DYNTRRD_MASK),
+ LPC31_MPMC_DYNTRRD);
+ putreg32(NS2HCLKS(EA3131_SDRAM_TMRD, HCLK2, MPMC_DYNTMRD_MASK),
+ LPC31_MPMC_DYNTMRD);
+ up_udelay(100);
+
+ /* Issue continuous NOP commands */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_INOP),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Load ~200us delay value to timer1 */
+
+ up_udelay(200);
+
+ /* Issue a "pre-charge all" command */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_IPALL),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Minimum refresh pulse interval (tRFC) for MT48LC32M16A2=80nsec,
+ * 100nsec provides more than adequate interval.
+ */
+
+ putreg32(NS2HCLKS(EA3131_SDRAM_REFRESH, HCLK, MPMC_DYNREFRESH_TIMER_MASK),
+ LPC31_MPMC_DYNREFRESH);
+
+ /* Load ~250us delay value to timer1 */
+
+ up_udelay(250);
+
+ /* Recommended refresh interval for normal operation of the Micron
+ * MT48LC16LFFG = 7.8125usec (128KHz rate). ((HCLK / 128000) - 1) =
+ * refresh counter interval rate, (subtract one for safety margin).
+ */
+
+ putreg32(NS2HCLKS(EA3131_SDRAM_OPERREFRESH, HCLK, MPMC_DYNREFRESH_TIMER_MASK),
+ LPC31_MPMC_DYNREFRESH);
+
+ /* Select mode register update mode */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_IMODE),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Program the SDRAM internal mode registers on bank nSDCE0 and reconfigure
+ * the SDRAM chips. Bus speeds up to 90MHz requires use of a CAS latency = 2.
+ * To get correct value on address bus CAS cycle, requires a shift by 13 for
+ * 16bit mode
+ */
+
+ tmp = getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 13));
+
+ putreg32((MPMC_DYNCONFIG0_MDSDRAM|MPMC_DYNCONFIG_HP16_32MX16),
+ LPC31_MPMC_DYNCONFIG0);
+ putreg32((MPMC_DYNRASCAS0_RAS2CLK|MPMC_DYNRASCAS0_CAS2CLK),
+ LPC31_MPMC_DYNRASCAS0);
+
+ /* Select normal operating mode */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_INORMAL),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Enable buffers */
+
+ regval = getreg32(LPC31_MPMC_DYNCONFIG0);
+ regval |= MPMC_DYNCONFIG0_B;
+ putreg32(regval, LPC31_MPMC_DYNCONFIG0);
+
+ putreg32((MPMC_DYNCONTROL_INORMAL|MPMC_DYNCONTROL_CS),
+ LPC31_MPMC_DYNCONTROL);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc31_meminitialize
+ *
+ * Description:
+ * Initialize external memory resources (sram, sdram, nand, nor, etc.)
+ *
+ ****************************************************************************/
+
+void lpc31_meminitialize(void)
+{
+ /* Configure the LCD pins in external bus interface (EBI/MPMC) memory mode.
+ *
+ * LCD_CSB -> MPMC_NSTCS_0
+ * LCD_DB_1 -> MPMC_NSTCS_1
+ * LCD_DB_0 -> MPMC_CLKOUT
+ * LCD_E_RD -> MPMC_CKE
+ * LCD_RS -> MPMC_NDYCS
+ * LCD_RW_WR -> MPMC_DQM_1
+ * LCD_DB_2 -> EBI_A_2
+ * LCD_DB_3 -> EBI_A_3 l
+ * LCD_DB_4 -> EBI_A_4 l
+ * LCD_DB_5 -> EBI_A_5 l
+ * LCD_DB_6 -> EBI_A_6
+ * LCD_DB_7 -> EBI_A_7
+ * LCD_DB_8 -> EBI_A_8
+ * LCD_DB_9 -> EBI_A_9
+ * LCD_DB_10 -> EBI_A_10
+ * LCD_DB_11 -> EBI_A_11
+ * LCD_DB_12 -> EBI_A_12
+ * LCD_DB_13 -> EBI_A_13
+ * LCD_DB_14 -> EBI_A_14
+ * LCD_DB_15 -> EBI_A_15
+ */
+
+ putreg32(SYSCREG_MUX_LCDEBISEL_EBIMPMC, LPC31_SYSCREG_MUX_LCDEBISEL);
+
+ /* Enable EBI clock */
+
+ lpc31_enableclock(CLKID_EBICLK);
+
+ /* Enable MPMC controller clocks */
+
+ lpc31_enableclock(CLKID_MPMCCFGCLK);
+ lpc31_enableclock(CLKID_MPMCCFGCLK2);
+ lpc31_enableclock(CLKID_MPMCCFGCLK3);
+
+ /* Enable the external memory controller */
+
+ putreg32(MPMC_CONTROL_E, LPC31_MPMC_CONTROL);
+
+ /* Force HCLK to MPMC_CLK to 1:1 ratio, little-endian mode */
+
+ putreg32(0, LPC31_MPMC_CONFIG);
+
+ /* Set MPMC delay based on trace lengths between SDRAM and the chip
+ * and on the delay strategy used for SDRAM.
+ */
+
+ putreg32(EA3131_MPMC_DELAY, LPC31_SYSCREG_MPMC_DELAYMODES);
+
+ /* Configure Micron MT48LC32M16A2 SDRAM on the EA3131 board */
+
+ lpc31_sdraminitialize();
+}
+#endif /* CONFIG_LPC31_EXTSDRAM */
diff --git a/nuttx/configs/ea3131/src/up_nsh.c b/nuttx/configs/ea3131/src/up_nsh.c
new file mode 100644
index 000000000..29ee7ed2c
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_nsh.c
@@ -0,0 +1,165 @@
+/****************************************************************************
+ * config/ea3131/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_LPC31_MCI
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "lpc31_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_EA3131
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LPC31XX boards here */
+
+# error "Unrecognized LPC31XX board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("nsh_archinitialize: Initializing SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the LPC313X10E-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/ea3131/src/up_spi.c b/nuttx/configs/ea3131/src/up_spi.c
new file mode 100644
index 000000000..18000d6b4
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_spi.c
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/ea3131/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lpc31_internal.h"
+#include "ea3131_internal.h"
+
+#ifdef CONFIG_LPC31_SPI
+#if 0 /* At present, EA3131 specific logic is hard-coded in the file lpc31_spi.c
+ * in arch/arm/src/lpc31xx */
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the EA3131 board.
+ *
+ ************************************************************************************/
+
+void weak_function lpc31_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI has already been provided. Pin configuration is performed
+ * on-the-fly, so no additional setup is required.
+ */
+}
+
+/************************************************************************************
+ * Name: lpc31_spiselect and lpc31_spistatus
+ *
+ * Description:
+ * The external functions, lpc31_spiselect and lpc31_spistatus must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common LPC31XX logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in lpc31_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide lpc31_spiselect() and lpc31_spistatus() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* 0 */
+#endif /* CONFIG_LPC31_SPI */
+
diff --git a/nuttx/configs/ea3131/src/up_usbmsc.c b/nuttx/configs/ea3131/src/up_usbmsc.c
new file mode 100644
index 000000000..5f4850ea1
--- /dev/null
+++ b/nuttx/configs/ea3131/src/up_usbmsc.c
@@ -0,0 +1,126 @@
+/****************************************************************************
+ * configs/ea3131/src/up_usbmsc.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the SAM3U MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <nuttx/fs/fs.h>
+#include <nuttx/fs/mkfatfs.h>
+#include <nuttx/ramdisk.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH1
+# define CONFIG_EXAMPLES_USBMSC_DEVPATH1 "/dev/ram"
+#endif
+
+static const char g_source[] = CONFIG_EXAMPLES_USBMSC_DEVPATH1;
+static struct fat_format_s g_fmt = FAT_FORMAT_INITIALIZER;
+
+#define USBMSC_NSECTORS 64
+#define USBMSC_SECTORSIZE 512
+#define BUFFER_SIZE (USBMSC_NSECTORS*USBMSC_SECTORSIZE)
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ uint8_t *pbuffer;
+ int ret;
+
+ pbuffer = (uint8_t *) malloc (BUFFER_SIZE);
+ if (!pbuffer)
+ {
+ lib_lowprintf ("usbmsc_archinitialize: Failed to allocate ramdisk of size %d\n",
+ BUFFER_SIZE);
+ return -ENOMEM;
+ }
+
+ /* Register a RAMDISK device to manage this RAM image */
+
+ ret = ramdisk_register(CONFIG_EXAMPLES_USBMSC_DEVMINOR1,
+ pbuffer,
+ USBMSC_NSECTORS,
+ USBMSC_SECTORSIZE,
+ true);
+ if (ret < 0)
+ {
+ printf("create_ramdisk: Failed to register ramdisk at %s: %d\n",
+ g_source, -ret);
+ free(pbuffer);
+ return ret;
+ }
+
+ /* Create a FAT filesystem on the ramdisk */
+
+ ret = mkfatfs(g_source, &g_fmt);
+ if (ret < 0)
+ {
+ printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n",
+ g_source);
+ /* free(pbuffer); -- RAM disk is registered */
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/nuttx/configs/ea3131/tools/Makefile b/nuttx/configs/ea3131/tools/Makefile
new file mode 100644
index 000000000..0d6f43d09
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/Makefile
@@ -0,0 +1,53 @@
+############################################################################
+# configs/ea3131/tools/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+OBJS = lpchdr.o crc32.o
+BIN = lpchdr
+
+CFLAGS += -Wall -g
+
+all: $(BIN)
+.PHONY: clean
+
+$(OBJS): %.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+
+lpchdr: $(OBJS)
+ $(CC) -o $@ $^
+
+clean:
+ @rm -f $(BIN) *.o *~
+
+
diff --git a/nuttx/configs/ea3131/tools/armusbocd.cfg b/nuttx/configs/ea3131/tools/armusbocd.cfg
new file mode 100644
index 000000000..733e3768c
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/armusbocd.cfg
@@ -0,0 +1,34 @@
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG A"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15BA 0x0003
+jtag_speed 2
+
+#use combined on interfaces or targets that can't set TRST/SRST separately
+reset_config trst_and_srst separate
+
+#jtag scan chain
+#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
+jtag_device 4 0x1 0xf 0xe
+
+#target configuration
+daemon_startup reset
+
+#target <type> <startup mode>
+#target arm9ejs <reset mode> <chainpos> <endianness> <variant>
+target arm926ejs little run_and_halt 0 arm926ejs
+run_and_halt_time 0 30
+
+#target_script 0 reset oocd_flash2138.script
+working_area 0 0x1102800 0x60000 nobackup
+
+#flash configuration
+#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v2 12000 calc_checksum
+
+# For more information about the configuration files, take a look at:
+# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger
diff --git a/nuttx/configs/ea3131/tools/crc32.c b/nuttx/configs/ea3131/tools/crc32.c
new file mode 100644
index 000000000..6e98e4724
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/crc32.c
@@ -0,0 +1,123 @@
+/************************************************************************************************
+ * configs/ea3131/tools/crc32.c
+ *
+ * This file is a part of NuttX:
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ *
+ * The logic in this file was developed by Gary S. Brown:
+ *
+ * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or code or tables
+ * extracted from it, as desired without restriction.
+ *
+ * First, the polynomial itself and its table of feedback terms. The polynomial is:
+ *
+ * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
+ *
+ * Note that we take it "backwards" and put the highest-order term in the lowest-order bit.
+ * The X^32 term is "implied"; the LSB is the X^31 term, etc. The X^0 term (usually shown
+ * as "+1") results in the MSB being 1
+ *
+ * Note that the usual hardware shift register implementation, which is what we're using
+ * (we're merely optimizing it by doing eight-bit chunks at a time) shifts bits into the
+ * lowest-order term. In our implementation, that means shifting towards the right. Why
+ * do we do it this way? Because the calculated CRC must be transmitted in order from
+ * highest-order term to lowest-order term. UARTs transmit characters in order from LSB
+ * to MSB. By storing the CRC this way we hand it to the UART in the order low-byte to
+ * high-byte; the UART sends each low-bit to hight-bit; and the result is transmission bit
+ * by bit from highest- to lowest-order term without requiring any bit shuffling on our
+ * part. Reception works similarly
+ *
+ * The feedback terms table consists of 256, 32-bit entries. Notes
+ *
+ * - The table can be generated at runtime if desired; code to do so is shown later. It
+ * might not be obvious, but the feedback terms simply represent the results of eight
+ * shift/xor operations for all combinations of data and CRC register values
+ *
+ * - The values must be right-shifted by eight bits by the updcrc logic; the shift must
+ * be u_(bring in zeroes). On some hardware you could probably optimize the shift in
+ * assembler by using byte-swap instructions polynomial $edb88320
+ ************************************************************************************************/
+
+/************************************************************************************************
+ * Included Files
+ ************************************************************************************************/
+
+#include <sys/types.h>
+#include <stdint.h>
+#include "lpchdr.h"
+
+/************************************************************************************************
+ * Private Data
+ ************************************************************************************************/
+
+static const uint32_t crc32_tab[] =
+{
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+};
+
+/************************************************************************************************
+ * Public Functions
+ ************************************************************************************************/
+/************************************************************************************************
+ * Name: crc32part
+ *
+ * Description:
+ * Continue CRC calculation on a part of the buffer.
+ *
+ ************************************************************************************************/
+
+uint32_t crc32part(const uint8_t *src, size_t len, uint32_t crc32val)
+{
+ size_t i;
+
+ for (i = 0; i < len; i++)
+ {
+ crc32val = crc32_tab[(crc32val ^ src[i]) & 0xff] ^ (crc32val >> 8);
+ }
+ return crc32val;
+}
+
+/************************************************************************************************
+ * Name: crc32
+ *
+ * Description:
+ * Return a 32-bit CRC of the contents of the 'src' buffer, length 'len'
+ *
+ ************************************************************************************************/
+
+uint32_t crc32(const uint8_t *src, size_t len)
+{
+ return crc32part(src, len, 0);
+}
diff --git a/nuttx/configs/ea3131/tools/lpchdr.c b/nuttx/configs/ea3131/tools/lpchdr.c
new file mode 100644
index 000000000..d21cf3906
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/lpchdr.c
@@ -0,0 +1,297 @@
+/************************************************************************************
+ * configs/ea3131/tools/lpchdr.c
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "lpchdr.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#define IO_BUF_SIZE 1024
+#define HDR_SIZE 0x80
+#define HDR_CRC_SIZE 0x6c
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+static const char *g_infile;
+static const char *g_outfile;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+static void show_usage(const char *progname, int exitcode)
+{
+ fprintf(stderr, "%s -o <outfile> <infile>\n", progname);
+ exit(exitcode);
+}
+
+static void parse_args(int argc, char **argv)
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, ":o:")) >= 0)
+ {
+ switch (ch)
+ {
+ case 'o':
+ g_outfile = optarg;
+ break;
+
+ case ':':
+ fprintf(stderr, "Missing option argumen\n");
+ show_usage(argv[0], 1);
+
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognized option\n");
+ show_usage(argv[0], 1);
+ }
+ }
+
+ if (optind >= argc)
+ {
+ fprintf(stderr, "Missing binary input file name\n");
+ show_usage(argv[0], 1);
+ }
+
+ g_infile = argv[optind];
+ optind++;
+
+ if (optind < argc)
+ {
+ fprintf(stderr, "Garbage at the end of the command line\n");
+ show_usage(argv[0], 1);
+ }
+}
+
+static inline uint32_t infilecrc32(int infd, size_t len, size_t padlen)
+{
+ off_t offset;
+ uint8_t buffer[IO_BUF_SIZE];
+ ssize_t nbytes;
+ size_t bytesread;
+ uint32_t crc;
+
+ offset = lseek(infd, 0, SEEK_SET);
+ if (offset == (off_t)-1)
+ {
+ fprintf(stderr, "lseek failed: %s\n", strerror(errno));
+ exit(4);
+ }
+
+ crc = 0;
+ for (bytesread = 0; bytesread < len; bytesread += nbytes)
+ {
+ nbytes = read(infd, buffer, IO_BUF_SIZE);
+ if (nbytes < 0)
+ {
+ fprintf(stderr, "read failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbytes == 0)
+ {
+ fprintf(stderr, "Unexpected end-of-file: %s\n", strerror(errno));
+ exit(4);
+ }
+ else
+ {
+ crc = crc32part(buffer, nbytes, crc);
+ }
+ }
+
+ /* Add the zero-padding at the end of the binary in the CRC */
+
+ memset(buffer, 0, IO_BUF_SIZE);
+ return crc32part(buffer, padlen, crc);
+}
+
+static inline void writefile(int infd, int outfd, size_t len, size_t padlen)
+{
+ off_t offset;
+ uint8_t buffer[IO_BUF_SIZE];
+ ssize_t nbytesread;
+ ssize_t nbyteswritten;
+ size_t totalread;
+
+ offset = lseek(infd, 0, SEEK_SET);
+ if (offset == (off_t)-1)
+ {
+ fprintf(stderr, "lseek failed: %s\n", strerror(errno));
+ exit(4);
+ }
+
+ for (totalread = 0; totalread < len; totalread += nbytesread)
+ {
+ nbytesread = read(infd, buffer, IO_BUF_SIZE);
+ if (nbytesread < 0)
+ {
+ fprintf(stderr, "read failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbytesread == 0)
+ {
+ fprintf(stderr, "Unexpected end-of-file: %s\n", strerror(errno));
+ exit(4);
+ }
+ else
+ {
+ nbyteswritten = write(outfd, buffer, nbytesread);
+ if (nbyteswritten < 0)
+ {
+ fprintf(stderr, "write failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbyteswritten != nbytesread)
+ {
+ fprintf(stderr, "Short writes not handled\n");
+ exit(4);
+ }
+ }
+ }
+
+ /* Write the zero-padding at the end of the binary */
+
+ memset(buffer, 0, IO_BUF_SIZE);
+ nbyteswritten = write(outfd, buffer, padlen);
+ if (nbyteswritten < 0)
+ {
+ fprintf(stderr, "write failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbyteswritten != padlen)
+ {
+ fprintf(stderr, "Short writes not handled\n");
+ exit(4);
+ }
+}
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+int main(int argc, char **argv, char **envp)
+{
+ struct lpc31_header_s g_hdr;
+ struct stat buf;
+ ssize_t nbytes;
+ size_t padlen;
+ int infd;
+ int outfd;
+ int ret;
+
+ /* Parse arguments */
+
+ parse_args(argc, argv);
+
+ /* Open files */
+
+ infd = open(g_infile, O_RDONLY);
+ if (infd < 0)
+ {
+ fprintf(stderr, "Failed to open %s for reading: %s\n", g_infile, strerror(errno));
+ exit(2);
+ }
+
+ outfd = open(g_outfile, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (outfd < 0)
+ {
+ fprintf(stderr, "Failed to open %s for writing: %s\n", g_outfile, strerror(errno));
+ exit(2);
+ }
+
+ /* Get the size of the binary file */
+
+ ret = fstat(infd, &buf);
+ if (ret < 0)
+ {
+ fprintf(stderr, "stat of %s failed: %s\n", g_infile, strerror(errno));
+ exit(3);
+ }
+
+ /* Initialize the header */
+
+ memset(&g_hdr, 0, sizeof(struct lpc31_header_s));
+ g_hdr.vector = 0xea00001e; /* b 0x11029080 */
+ g_hdr.magic = 0x41676d69;
+#if 1 /* CRC doesn't seem to be functional */
+ g_hdr.imageType = 0x0000000a;
+#else
+ g_hdr.imageType = 0x0000000b;
+#endif
+ g_hdr.imageLength = (buf.st_size + sizeof(struct lpc31_header_s) + 511) & ~0x1ff;
+
+ /* This is how much we must pad at the end of the binary image. */
+
+ padlen = g_hdr.imageLength - buf.st_size;
+
+ /* Calculate CRCs */
+
+ g_hdr.execution_crc32 = infilecrc32(infd, buf.st_size, padlen);
+ g_hdr.header_crc32 = crc32((const uint8_t*)&g_hdr, HDR_CRC_SIZE);
+
+ /* Write the header */
+
+ nbytes = write(outfd, &g_hdr, HDR_SIZE);
+ if (nbytes != 0x80)
+ {
+ fprintf(stderr, "write of header to of %s failed: %s\n", g_outfile, strerror(errno));
+ exit(4);
+ }
+
+ /* Copy the input file to the output */
+
+ writefile(infd, outfd, buf.st_size, padlen);
+ close(infd);
+ close(outfd);
+ return 0;
+}
+
+
diff --git a/nuttx/configs/ea3131/tools/lpchdr.h b/nuttx/configs/ea3131/tools/lpchdr.h
new file mode 100644
index 000000000..7ada6bb35
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/lpchdr.h
@@ -0,0 +1,105 @@
+/************************************************************************************
+ * configs/ea3131/tools/lpchdr.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EA3131_TOOLS_LPCHDR_H
+#define __CONFIGS_EA3131_TOOLS_LPCHDR_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+struct lpc31_header_s
+{
+ /* OFFS DESCRIPTION */
+ uint32_t vector; /* 0x00 Valid ARM instruction. Usually this will be
+ * a branch instruction to entry point of the
+ * image. */
+ uint32_t magic; /* 0x04 This field is used by boot ROM to detect a
+ * valid image header. This field should always
+ * be set to 0x41676d69. */
+ uint32_t execution_crc32; /* 0x08 CRC32 value of execution part of the image. If
+ * the ‘image_type’ is set to ‘0xA’, this field
+ * is ignored by boot ROM. */
+ uint32_t Reserved0[4]; /* 0x0c-0x18: Should be zero. */
+ uint32_t imageType; /* 0x1c Specifies whether CRC check should be done
+ * on the image or not:
+ * 0xA – No CRC check required.
+ * 0xB – Do CRC32 check on both header and
+ * execution part of the image. */
+ uint32_t imageLength; /* 0x20 Total image length including header rounded
+ * up to the nearest 512 byte boundary. In C
+ * language the field can be computed as:
+ * imageLength = (Actual length + 511) & ~0x1FF; */
+ uint32_t releaseID; /* 0x24 Release or version number of the image. Note,
+ * this field is not used by boot ROM but is
+ * provided to track the image versions. */
+ uint32_t buildTime; /* 0x28 Time (expressed in EPOC time format) at which
+ * image is built. Note, this field is not used
+ * by boot ROM but is provided to track the image
+ * versions. */
+ uint32_t sbzBootParameter; /* 0x2c hould be zero. */
+ uint32_t cust_reserved[15]; /* 0x30-0x68: Reserved for customer use (60 bytes) */
+ uint32_t header_crc32; /* 0x6c CRC32 value of the header (bytes 0x00 to 0x6C
+ * of the image). If the ‘image_type’ is set
+ * to ‘0xA’, this field is ignored by boot ROM. */
+ uint32_t Reserved1[4]; /* 0x70-0x7c: Should be zero. */
+ /* 0x80 Start of program code (128Kb max). The final
+ * image has to be padded to the nearest 512
+ * byte boundary */
+};
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+extern uint32_t crc32part(const uint8_t *src, size_t len, uint32_t crc32val);
+extern uint32_t crc32(const uint8_t *src, size_t len);
+
+#endif /* __CONFIGS_EA3131_TOOLS_LPCHDR_H */
+
diff --git a/nuttx/configs/ea3131/tools/mklpc.sh b/nuttx/configs/ea3131/tools/mklpc.sh
new file mode 100755
index 000000000..0198a29fc
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/mklpc.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# This script lies in sub-directory configs/ea3131/tools but make be executed
+# from either that directory or TOPDIR
+
+MYNAME=`basename $0`
+if [ -x "$PWD/$MYNAME" ]; then
+ TOPDIR="$PWD/../../.."
+else
+ if [ -x "$PWD/configs/ea3131/tools/$MYNAME" ]; then
+ TOPDIR="$PWD"
+ else
+ echo "This script must be executed from a known director"
+ exit 1
+ fi
+fi
+echo "TOOLDIR: $TOOLDIR"
+
+# The lpchdr could be named lpchdr.exe if we are running under Cygwin or
+# just lpchdr under Linux
+
+TOOLDIR=$TOPDIR/configs/ea3131/tools
+
+if [ ! -d "$TOOLDIR" ]; then
+ echo "Tool directory $TOOLDIR does not exist"
+ exit 1
+fi
+
+if [ -x "$TOOLDIR/lpchdr.exe" ]; then
+ LPCHDR="$TOOLDIR/lpchdr.exe"
+else
+ if [ -x "$TOOLDIR/lpchdr" ]; then
+ LPCHDR="$TOOLDIR/lpchdr"
+ else
+ echo "lpchdr executable does not exist in $TOODIR"
+ echo " - cd $TOOLDIR"
+ echo " - make"
+ fi
+fi
+echo "LPCHDR: $LPCHDR"
+
+# Now get the path to the NuttX executable
+
+NUTTXPATH="$TOPDIR/nuttx.bin"
+
+if [ ! -f "$NUTTXPATH" ]; then
+ echo "NuttX binary does not exist at $NUTTXPATH"
+ echo " - cd $TOPDIR"
+ echo " - make"
+ exit 1
+fi
+echo "NUTTXPATH: $NUTTXPATH"
+
+# Create the binary
+
+echo "COMMAND: $LPCHDR -o $TOPDIR/nuttx.lpc $NUTTXPATH"
+"$LPCHDR" -o "$TOPDIR/nuttx.lpc" "$NUTTXPATH" || \
+ { echo "$LPCHDR failed" ; exit 1 ; }
+echo "Successfully created binary"
+
diff --git a/nuttx/configs/ea3131/tools/oocd.sh b/nuttx/configs/ea3131/tools/oocd.sh
new file mode 100755
index 000000000..7948c1e03
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/oocd.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+TOPDIR=$1
+USAGE="$0 <TOPDIR> [-d]"
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ exit 1
+fi
+
+OPENOCD_PATH="/cygdrive/c/gccfd/openocd/bin"
+OPENOCD_EXE=openocd-ftd2xx.exe
+OPENOCD_CFG="${TOPDIR}/configs/ea3131/tools/armusbocd.cfg"
+OPENOCD_ARGS="-f `cygpath -w ${OPENOCD_CFG}`"
+~/projects/nuttx/nuttx/configs/ea3131/tool
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+if [ ! -d ${OPENOCD_PATH} ]; then
+ echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
+ exit 1
+fi
+if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
+ echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+fi
+if [ ! -f ${OPENOCD_CFG} ]; then
+ echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
+ exit 1
+fi
+
+echo "Starting OpenOCD"
+${OPENOCD_PATH}/${OPENOCD_EXE} ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
+
+
+
+
diff --git a/nuttx/configs/ea3131/tools/usb-driver.txt b/nuttx/configs/ea3131/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/ea3131/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/ea3131/usbserial/Make.defs b/nuttx/configs/ea3131/usbserial/Make.defs
new file mode 100644
index 000000000..92a53d1da
--- /dev/null
+++ b/nuttx/configs/ea3131/usbserial/Make.defs
@@ -0,0 +1,165 @@
+############################################################################
+# configs/ea3131/usbserial/Make.defs
+#
+# Copyright (C) 2010,2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC31_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_LPC31_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CONFIG_LPC31_BUILDROOT),y)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ea3131/usbserial/appconfig b/nuttx/configs/ea3131/usbserial/appconfig
new file mode 100644
index 000000000..76ec23eb0
--- /dev/null
+++ b/nuttx/configs/ea3131/usbserial/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ea3131/usbserial/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbserial
+
diff --git a/nuttx/configs/ea3131/usbserial/defconfig b/nuttx/configs/ea3131/usbserial/defconfig
new file mode 100644
index 000000000..7dae3c2cf
--- /dev/null
+++ b/nuttx/configs/ea3131/usbserial/defconfig
@@ -0,0 +1,409 @@
+############################################################################
+# configs/ea3131/usbserial/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="lpc31xx"
+CONFIG_ARCH_CHIP_LPC31XX=y
+CONFIG_ARCH_CHIP_LPC3131=y
+CONFIG_ARCH_BOARD="ea3131"
+CONFIG_ARCH_BOARD_EA3131=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x11028000
+CONFIG_DRAM_VSTART=0x11028000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=y
+
+# Identify toolchain and linker options
+#
+CONFIG_LPC31_CODESOURCERYW=n
+CONFIG_LPC31_CODESOURCERYL=y
+CONFIG_LPC31_DEVKITARM=n
+CONFIG_LPC31_BUILDROOT=n
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC31_MCI=n
+CONFIG_LPC31_SPI=n
+CONFIG_LPC31_UART=y
+
+#
+# Exernal memory available on the board (see also CONFIG_MM_REGIONS)
+#
+CONFIG_LPC31_EXTSRAM0=n
+CONFIG_LPC31_EXTSRAM0HEAP=n
+CONFIG_LPC31_EXTSRAM0SIZE=131072
+CONFIG_LPC31_EXTSRAM1=n
+CONFIG_LPC31_EXTSRAM1HEAP=n
+CONFIG_LPC31_EXTSRAM1SIZE=131072
+CONFIG_LPC31_EXTSDRAM=n
+CONFIG_LPC31_EXTSDRAMHEAP=n
+CONFIG_LPC31_EXTSDRAMSIZE=67108864
+CONFIG_LPC31_EXTNAND=n
+CONFIG_LPC31_EXTNANDSIZE=67108864
+
+#
+# LPC31XX specific device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=y
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="usbserial_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=28
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+CONFIG_FS_WRITABLE=y
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=y
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=y
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC31XX USB Configuration
+#
+CONFIG_LPC31_GIO_USBATTACH=6
+CONFIG_LPC31_GIO_USBDPPULLUP=17
+CONFIG_LPC31_VENDORID=0xd320
+CONFIG_LPC31_PRODUCTID=0x3211
+CONFIG_LPC31_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=y
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=512
+CONFIG_USBMSC_BULKOUTREQLEN=512
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/ram0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMISRAM=y
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
diff --git a/nuttx/configs/ea3131/usbserial/setenv.sh b/nuttx/configs/ea3131/usbserial/setenv.sh
new file mode 100755
index 000000000..69a6bb442
--- /dev/null
+++ b/nuttx/configs/ea3131/usbserial/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/ea3131/usbserial/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools subdirectory
+
+export LPCTOOL_DIR="${WD}/configs/ea3152/tools"
+
+# Add the path to the toolchain to the PATH varialble
+
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ea3131/usbstorage/Make.defs b/nuttx/configs/ea3131/usbstorage/Make.defs
new file mode 100644
index 000000000..e4400e3fc
--- /dev/null
+++ b/nuttx/configs/ea3131/usbstorage/Make.defs
@@ -0,0 +1,165 @@
+############################################################################
+# configs/ea3131/usbstorage/Make.defs
+#
+# Copyright (C) 2010,2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC31_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_LPC31_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CONFIG_LPC31_BUILDROOT),y)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ea3131/usbstorage/appconfig b/nuttx/configs/ea3131/usbstorage/appconfig
new file mode 100644
index 000000000..8db7e05d6
--- /dev/null
+++ b/nuttx/configs/ea3131/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ea3131/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/ea3131/usbstorage/defconfig b/nuttx/configs/ea3131/usbstorage/defconfig
new file mode 100644
index 000000000..6ee7bb40d
--- /dev/null
+++ b/nuttx/configs/ea3131/usbstorage/defconfig
@@ -0,0 +1,410 @@
+############################################################################
+# configs/ea3131/usbstorage/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="lpc31xx"
+CONFIG_ARCH_CHIP_LPC31XX=y
+CONFIG_ARCH_CHIP_LPC3131=y
+CONFIG_ARCH_BOARD="ea3131"
+CONFIG_ARCH_BOARD_EA3131=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x11028000
+CONFIG_DRAM_VSTART=0x11028000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=y
+
+# Identify toolchain and linker options
+#
+CONFIG_LPC31_CODESOURCERYW=n
+CONFIG_LPC31_CODESOURCERYL=y
+CONFIG_LPC31_DEVKITARM=n
+CONFIG_LPC31_BUILDROOT=n
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC31_MCI=n
+CONFIG_LPC31_SPI=n
+CONFIG_LPC31_UART=y
+
+#
+# Exernal memory available on the board (see also CONFIG_MM_REGIONS)
+#
+CONFIG_LPC31_EXTSRAM0=n
+CONFIG_LPC31_EXTSRAM0HEAP=n
+CONFIG_LPC31_EXTSRAM0SIZE=131072
+CONFIG_LPC31_EXTSRAM1=n
+CONFIG_LPC31_EXTSRAM1HEAP=n
+CONFIG_LPC31_EXTSRAM1SIZE=131072
+CONFIG_LPC31_EXTSDRAM=n
+CONFIG_LPC31_EXTSDRAMHEAP=n
+CONFIG_LPC31_EXTSDRAMSIZE=67108864
+CONFIG_LPC31_EXTNAND=n
+CONFIG_LPC31_EXTNANDSIZE=67108864
+
+#
+# LPC31XX specific device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=y
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=28
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+CONFIG_FS_WRITABLE=y
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=y
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC31XX USB Configuration
+#
+CONFIG_LPC31_GIO_USBATTACH=6
+CONFIG_LPC31_GIO_USBDPPULLUP=17
+CONFIG_LPC31_VENDORID=0xd320
+CONFIG_LPC31_PRODUCTID=0x3211
+CONFIG_LPC31_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=512
+CONFIG_USBMSC_BULKOUTREQLEN=512
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/ram0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMISRAM=y
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
diff --git a/nuttx/configs/ea3131/usbstorage/setenv.sh b/nuttx/configs/ea3131/usbstorage/setenv.sh
new file mode 100755
index 000000000..648150228
--- /dev/null
+++ b/nuttx/configs/ea3131/usbstorage/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/ea3131/usbstorage/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools subdirectory
+
+export LPCTOOL_DIR="${WD}/configs/ea3152/tools"
+
+# Add the path to the toolchain to the PATH varialble
+
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ea3152/Kconfig b/nuttx/configs/ea3152/Kconfig
new file mode 100644
index 000000000..c23751a3d
--- /dev/null
+++ b/nuttx/configs/ea3152/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_EA3152
+endif
diff --git a/nuttx/configs/ea3152/README.txt b/nuttx/configs/ea3152/README.txt
new file mode 100644
index 000000000..44f65981e
--- /dev/null
+++ b/nuttx/configs/ea3152/README.txt
@@ -0,0 +1,411 @@
+README
+^^^^^^
+
+ This README file discusses the port of NuttX to the Embedded Artists
+ EA3152 board.
+
+Contents
+^^^^^^^^
+
+ o Development Environment
+ o GNU Toolchain Options
+ o IDEs
+ o NuttX buildroot Toolchain
+ o Boot Sequence
+ o Image Format
+ o Image Download to ISRAM
+ o Using OpenOCD and GDB
+ o ARM/EA3152-specific Configuration Options
+ o Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. Raisonance GNU toolchain, or
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_LPC31_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC31_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC31_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC31_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC31_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc31xx,
+ arch/arm/src/common, arch/arm/src/arm, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc31xx/lpc31_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh ea3152/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/arm926t-defconfig-4.2.4 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+Boot Sequence
+^^^^^^^^^^^^^
+ LPC313x has on chip bootrom which loads properly formatted images from multiple
+ sources into SRAM. These sources include including SPI Flash, NOR Flash, UART,
+ USB, SD Card, and NAND Flash.
+
+ In all configurations, NuttX is loaded directly into ISRAM. NuttX is linked
+ to execute from ISRAM, regardless of the boot source.
+
+Image Format
+^^^^^^^^^^^^
+
+ In order to use the bootrom bootloader, a special header must be added to the
+ beginning of the binary image that includes information about the binary (things
+ like the entry point, the size, and CRC's to verify the image.
+
+ NXP provides a Windows program to append such a header to the binary image.
+ However, (1) that program won't run under Linux, and (2) when I try it under
+ WinXP, Symantec immediately claims that the program is misbehaving and deletes
+ it!
+
+ To work around both of these issues, I have created a small program under
+ configs/ea3152/tools to add the header. This program can be built under
+ either Linux or Cygwin (and probably other tool environments as well). That
+ tool can be built as follows:
+
+ - cd configs/ea3152/tools
+ - make
+
+ Then, to build the NuttX binary ready to load with the bootloader, just
+ following these steps:
+
+ - cd tools/ # Configure Nuttx
+ - ./configure.sh ea3152/ostest # (using the ostest configuration for this example)
+ - cd .. # Set up environment
+ - . ./setenv.sh # (see notes below)
+ - make # Make NuttX. This will produce nuttx.bin
+ - mklpc.sh # Make the bootloader binary (nuttx.lpc)
+
+ NOTES:
+
+ 1. setenv.sh just sets up pathes to the toolchain and also to
+ configs/ea3152/tools where mklpc.sh resides. Use of setenv.sh is optional.
+ If you don't use setenv.sh, then just set your PATH variable appropriately or
+ use the full path to mklpc.sh in the final step.
+ 2. You can instruct Symantec to ignore the errors and it will stop quarantining
+ the NXP program.
+ 3. The CRC32 logic in configs/ea3152/tools doesn't seem to work. As a result,
+ the CRC is currently disabled in the header:
+
+ RCS file: /cvsroot/nuttx/nuttx/configs/ea3152/tools/lpchdr.c,v
+ retrieving revision 1.2
+ diff -r1.2 lpchdr.c
+ 264c264
+ < g_hdr.imageType = 0x0000000b;
+ ---
+ > g_hdr.imageType = 0x0000000a;
+
+Image Download to ISRAM
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Assuming that you already have the FTDI driver installed*, then here is the
+are the steps that I use for loading new code into the EA3152:
+
+- Create the bootloader binary, nuttx.lpc, as described above.
+- Connected the EA3152 using the FTDI USB port (not the lpc3152 USB port)
+ This will power up the EA3152 and start the bootloader.
+- Start a terminal emulator (such as TeraTerm) at 115200 8NI.
+- Reset the EA3152 and you should see:
+ LPC31xx READY FOR PLAIN IMAGE>
+- Send the nuttx.lpc file and you should see:
+ Download finished
+
+That will load the NuttX binary into ISRAM and attempt to execute it.
+
+*See the LPC313x documentation if you do not have the FTDI driver installed.
+
+Using OpenOCD and GDB
+^^^^^^^^^^^^^^^^^^^^^
+
+ I have been using the Olimex ARM-USB-OCD JTAG debugger with the EA3152
+ (http://www.olimex.com). The OpenOCD configuration file is here:
+ tools/armusbocb.cfg. There is also a script on the tools directory that
+ I used to start the OpenOCD daemon on my system called oocd.sh. That
+ script would probably require some modifications to work in another
+ environment:
+
+ - possibly the value of OPENOCD_PATH
+ - If you are working under Linux you will need to change any
+ occurances of `cygpath -w blablabla` to just blablabla
+
+ Then you should be able to start the OpenOCD daemon like:
+
+ configs/ea3152/tools/oocd.sh $PWD
+
+ Where it is assumed that you are executing oocd.sh from the top level
+ directory where NuttX is installed.
+
+ Once the OpenOCD daemon has been started, you can connect to it via
+ GDB using the following GDB command:
+
+ arm-elf-gdb
+ (gdb) target remote localhost:3333
+
+ And you can load the NuttX ELF file:
+
+ (gdb) symbol-file nuttx
+ (gdb) load nuttx
+
+ARM/EA3152-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ARM926EJS=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc313x
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_LPC3152
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=ea3152
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_EA3152
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - For most ARM9 architectures, this describes the
+ size of installed DRAM. For the LPC313X, it is used only to
+ deterimine how to map the executable regions. It is SDRAM size
+ only if you are executing out of the external SDRAM; or it could
+ be NOR FLASH size, external SRAM size, or internal SRAM size.
+
+ CONFIG_DRAM_START - The start address of installed DRAM (physical)
+
+ CONFIG_DRAM_VSTART - The startaddress of DRAM (virtual)
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_IRQPRIO - The LPC313x supports interrupt prioritization
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader.
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+ CONFIG_ARCH_DMA - Support DMA initialization
+ CONFIG_ARCH_LOWVECTORS - define if vectors reside at address 0x0000:00000
+ Undefine if vectors reside at address 0xffff:0000
+ CONFIG_ARCH_ROMPGTABLE - A pre-initialized, read-only page table is available.
+ If defined, then board-specific logic must also define PGTABLE_BASE_PADDR,
+ PGTABLE_BASE_VADDR, and all memory section mapping in a file named
+ board_memorymap.h.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_LPC31_MCI, CONFIG_LPC31_SPI, CONFIG_LPC31_UART
+
+ External memory available on the board (see also CONFIG_MM_REGIONS)
+
+ CONFIG_LPC31_EXTSRAM0 - Select if external SRAM0 is present
+ CONFIG_LPC31_EXTSRAM0HEAP - Select if external SRAM0 should be
+ configured as part of the NuttX heap.
+ CONFIG_LPC31_EXTSRAM0SIZE - Size (in bytes) of the installed
+ external SRAM0 memory
+ CONFIG_LPC31_EXTSRAM1 - Select if external SRAM1 is present
+ CONFIG_LPC31_EXTSRAM1HEAP - Select if external SRAM1 should be
+ configured as part of the NuttX heap.
+ CONFIG_LPC31_EXTSRAM1SIZE - Size (in bytes) of the installed
+ external SRAM1 memory
+ CONFIG_LPC31_EXTSDRAM - Select if external SDRAM is present
+ CONFIG_LPC31_EXTSDRAMHEAP - Select if external SDRAM should be
+ configured as part of the NuttX heap.
+ CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed
+ external SDRAM memory
+ CONFIG_LPC31_EXTNAND - Select if external NAND is present
+ CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed
+ external NAND memory
+
+ LPC313X specific device driver settings
+
+ CONFIG_UART_SERIAL_CONSOLE - selects the UART for the
+ console and ttys0
+ CONFIG_UART_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UART_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UART_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UART_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UART_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UART_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each EA3152 configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh ea3152/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
diff --git a/nuttx/configs/ea3152/include/board.h b/nuttx/configs/ea3152/include/board.h
new file mode 100644
index 000000000..848c4137c
--- /dev/null
+++ b/nuttx/configs/ea3152/include/board.h
@@ -0,0 +1,167 @@
+/************************************************************************************
+ * configs/ea3152/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+# include "lpc31_cgudrvr.h"
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Frequency of the FFAST input */
+
+#define BOARD_FREQIN_FFAST (12000000) /* ffast (12 MHz crystal) */
+
+/* HPLL0 configuration */
+
+#define BOARD_HPLL0_FINSEL CGU_HPFINSEL_FFAST /* Frequency input selection */
+#define BOARD_HPLL0_NDEC 131 /* PLL N-divider value */
+#define BOARD_HPLL0_MDEC 29784 /* PLL M-divider value */
+#define BOARD_HPLL0_PDEC 7 /* PLL P-divider value */
+#define BOARD_HPLL0_SELR 0 /* SELR bandwidth selection */
+#define BOARD_HPLL0_SELI 8 /* SELI bandwidth selection */
+#define BOARD_HPLL0_SELP 31 /* SELP bandwidth selection */
+#define BOARD_HPLL0_MODE 0 /* PLL mode */
+#define BOARD_HPLL0_FREQ 406425600 /* Frequency of the PLL in MHz */
+
+/* HPLL1 configuration */
+
+#define BOARD_HPLL1_FINSEL CGU_HPFINSEL_FFAST /* Frequency input selection */
+#define BOARD_HPLL1_NDEC 770 /* PLL N-divider value */
+#define BOARD_HPLL1_MDEC 8191 /* PLL M-divider value */
+#define BOARD_HPLL1_PDEC 98 /* PLL P-divider value */
+#define BOARD_HPLL1_SELR 0 /* SELR bandwidth selection */
+#define BOARD_HPLL1_SELI 16 /* SELI bandwidth selection */
+#define BOARD_HPLL1_SELP 8 /* SELP bandwidth selection */
+#define BOARD_HPLL1_MODE 0 /* PLL mode */
+#define BOARD_HPLL1_FREQ 180000000 /* Frequency of the PLL in MHz */
+
+/* The following 3 bitsets determine which clocks will be enabled at initialization
+ * time.
+ */
+
+#define BOARD_CLKS_0_31 \
+ (_RBIT(CLKID_APB0CLK,0)|_RBIT(CLKID_APB1CLK,0)|_RBIT(CLKID_APB2CLK,0)|\
+ _RBIT(CLKID_APB3CLK,0)|_RBIT(CLKID_APB4CLK,0)|_RBIT(CLKID_AHB2INTCCLK,0)|\
+ _RBIT(CLKID_AHB0CLK,0)|_RBIT(CLKID_ARM926CORECLK,0)|_RBIT(CLKID_ARM926BUSIFCLK,0)|\
+ _RBIT(CLKID_ARM926RETIMECLK,0)|_RBIT(CLKID_ISRAM0CLK,0)|_RBIT(CLKID_ISRAM1CLK,0)|\
+ _RBIT(CLKID_ISROMCLK,0)|_RBIT(CLKID_INTCCLK,0)|_RBIT(CLKID_AHB2APB0PCLK,0)|\
+ _RBIT(CLKID_EVENTROUTERPCLK,0)|_RBIT(CLKID_CLOCKOUT,0))
+
+#define BOARD_CLKS_32_63 \
+ (_RBIT(CLKID_IOCONFPCLK,32)|_RBIT(CLKID_CGUPCLK,32)|_RBIT(CLKID_SYSCREGPCLK,32)|\
+ _RBIT(CLKID_OTPPCLK,32)|_RBIT(CLKID_AHB2APB1PCLK,32)|_RBIT(CLKID_AHB2APB2PCLK,32)|\
+ _RBIT(CLKID_AHB2APB3PCLK,32)|_RBIT(CLKID_EDGEDETPCLK,32))
+
+#define BOARD_CLKS_64_92 \
+ (0)
+
+/* LED definitions ******************************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Button definitions ***************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: lpc31_boardinitialize
+ *
+ * Description:
+ * All LPC31XX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void lpc31_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the state of all buttons. up_buttons()
+ * returns an 8-bit bit set with each bit associated with a button. See the
+ * BUTTON_* definitions above for the meaning of each bit.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ea3152/include/board_memorymap.h b/nuttx/configs/ea3152/include/board_memorymap.h
new file mode 100644
index 000000000..c9242e6d2
--- /dev/null
+++ b/nuttx/configs/ea3152/include/board_memorymap.h
@@ -0,0 +1,117 @@
+/************************************************************************************
+ * configs/ea3152/include/board_memorymap.h
+ * include/arch/board/board_memorymap.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_MEMORYMAP_H
+#define __ARCH_BOARD_BOARD_MEMORYMAP_H
+
+/* This file should never be included directly, but only indirectly via
+ * lpc31_memorymap.h.
+ */
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* If the LPC31xx ROM page table is selected, then the board-logic is required
+ * to provide:
+ *
+ * PGTABLE_BASE_PADDR - The physical address of the page table in ROM,
+ * PGTABLE_BASE_VADDR - The mapped address of the page table in ROM, and
+ * Mappings for each of the PSECTIONS in lpc31_memorymap.h
+ */
+
+#ifdef CONFIG_ARCH_ROMPGTABLE
+ /* The LPC31xx ROM page table uses a 1-1 physical to virtual memory mapping */
+
+# define LPC31_SHADOWSPACE_VSECTION 0x00000000 /* 0x00000000-0x00000fff: Shadow Area 4Kb */
+# define LPC31_INTSRAM_VSECTION 0x11028000 /* Internal SRAM 96Kb-192Kb */
+# define LPC31_INTSRAM0_VADDR 0x11028000 /* 0x11028000-0x1103ffff: Internal SRAM 0 96Kb */
+# define LPC31_INTSRAM1_VADDR 0x11040000 /* 0x11040000-0x11057fff: Internal SRAM 1 96Kb */
+# define LPC31_INTSROM0_VSECTION 0x12000000 /* 0x12000000-0x1201ffff: Internal SROM 0 128Kb */
+# define LPC31_APB01_VSECTION 0x13000000 /* 0x13000000-0x1300bfff: APB0 32Kb APB1 16Kb*/
+# define LPC31_APB0_VADDR 0x13000000 /* 0x13000000-0x13007fff: APB0 32Kb */
+# define LPC31_APB1_VADDR 0x13008000 /* 0x13008000-0x1300bfff: APB1 16Kb */
+# define LPC31_APB2_VSECTION 0x15000000 /* 0x15000000-0x15003fff: APB2 16Kb */
+# define LPC31_APB3_VSECTION 0x16000000 /* 0x16000000-0x160003ff: APB3 1Kb */
+# define LPC31_APB4MPMC_VSECTION 0x17000000 /* 8Kb */
+# define LPC31_APB4_VADDR 0x17000000 /* 0x17000000-0x17000fff: APB4 4Kb */
+# define LPC31_MPMC_VADDR 0x17008000 /* 0x17008000-0x17008fff: MPMC cfg 4Kb */
+# define LPC31_MCI_VSECTION 0x18000000 /* 0x18000000 0x180003ff: MCI/SD/SDIO 1Kb */
+# define LPC31_USBOTG_VSECTION 0x19000000 /* 0x19000000-0x19000fff: USB OTG 4Kb */
+# define LPC31_EXTSRAM_VSECTION 0x20020000 /* 64-128Kb */
+# define LPC31_EXTSRAM0_VADDR 0x20000000 /* 0x20000000-0x2001ffff: External SRAM 0 64-128Kb */
+# define LPC31_EXTSRAM1_VADDR 0x20020000 /* 0x20020000-0x2003ffff: External SRAM 1 64-128Kb */
+# define LPC31_EXTSDRAM0_VSECTION 0x30000000 /* 0x30000000-0x37ffffff: External SDRAM 0 128Mb */
+# define LPC31_INTC_VSECTION 0x60000000 /* 0x60000000-0x60000fff: Interrupt controller 4Kb */
+# define LPC31_NAND_VSECTION 0x70000000 /* 0x70000000-0x700007ff: NANDFLASH Ctrl 2Kb */
+
+ /* Define the address of the page table within the ROM */
+
+# define ROMPGTABLE_OFFSET 0x0001c000 /* Offset of the ROM page table in ROM */
+# define PGTABLE_BASE_PADDR (LPC31_INTSROM0_PSECTION+ROMPGTABLE_OFFSET)
+# define PGTABLE_BASE_VADDR (LPC31_INTSROM0_VSECTION+ROMPGTABLE_OFFSET)
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_MEMORYMAP_H */
diff --git a/nuttx/configs/ea3152/ostest/Make.defs b/nuttx/configs/ea3152/ostest/Make.defs
new file mode 100644
index 000000000..19e213b0a
--- /dev/null
+++ b/nuttx/configs/ea3152/ostest/Make.defs
@@ -0,0 +1,165 @@
+############################################################################
+# configs/ea3152/ostest/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC31_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC31_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_LPC31_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CONFIG_LPC31_BUILDROOT),y)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ea3152/ostest/appconfig b/nuttx/configs/ea3152/ostest/appconfig
new file mode 100644
index 000000000..cef52ea44
--- /dev/null
+++ b/nuttx/configs/ea3152/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ea3152/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ea3152/ostest/defconfig b/nuttx/configs/ea3152/ostest/defconfig
new file mode 100644
index 000000000..5af1310f4
--- /dev/null
+++ b/nuttx/configs/ea3152/ostest/defconfig
@@ -0,0 +1,395 @@
+############################################################################
+# configs/ea3152/ostest/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="lpc31xx"
+CONFIG_ARCH_CHIP_LPC31XX=y
+CONFIG_ARCH_CHIP_LPC3152=y
+CONFIG_ARCH_BOARD="ea3152"
+CONFIG_ARCH_BOARD_EA3152=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x11028000
+CONFIG_DRAM_VSTART=0x11028000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=y
+
+# Identify toolchain and linker options
+#
+CONFIG_LPC31_CODESOURCERYW=n
+CONFIG_LPC31_CODESOURCERYL=n
+CONFIG_LPC31_DEVKITARM=n
+CONFIG_LPC31_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC31_MCI=n
+CONFIG_LPC31_SPI=n
+CONFIG_LPC31_UART=y
+
+#
+# Exernal memory available on the board (see also CONFIG_MM_REGIONS)
+#
+CONFIG_LPC31_EXTSRAM0=n
+CONFIG_LPC31_EXTSRAM0HEAP=n
+CONFIG_LPC31_EXTSRAM0SIZE=131072
+CONFIG_LPC31_EXTSRAM1=n
+CONFIG_LPC31_EXTSRAM1HEAP=n
+CONFIG_LPC31_EXTSRAM1SIZE=131072
+CONFIG_LPC31_EXTSDRAM=n
+CONFIG_LPC31_EXTSDRAMHEAP=n
+CONFIG_LPC31_EXTSDRAMSIZE=67108864
+CONFIG_LPC31_EXTNAND=n
+CONFIG_LPC31_EXTNANDSIZE=67108864
+
+#
+# LPC31XX specific device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=y
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_BAUD=115200
+CONFIG_UART_BITS=8
+CONFIG_UART_PARITY=0
+CONFIG_UART_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=26
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC31XX USB Configuration
+#
+CONFIG_LPC31_GIO_USBATTACH=6
+CONFIG_LPC31_GIO_USBDPPULLUP=17
+CONFIG_LPC31_VENDORID=0xd320
+CONFIG_LPC31_PRODUCTID=0x3211
+CONFIG_LPC31_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMISRAM=y
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
diff --git a/nuttx/configs/ea3152/ostest/setenv.sh b/nuttx/configs/ea3152/ostest/setenv.sh
new file mode 100755
index 000000000..418f4701e
--- /dev/null
+++ b/nuttx/configs/ea3152/ostest/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/ea3152/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools subdirectory
+
+export LPCTOOL_DIR="${WD}/configs/ea3152/tools"
+
+# Add the path to the toolchain to the PATH varialble
+
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ea3152/scripts/ld.script b/nuttx/configs/ea3152/scripts/ld.script
new file mode 100644
index 000000000..cf5b5d519
--- /dev/null
+++ b/nuttx/configs/ea3152/scripts/ld.script
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/ea3152/scripts/ld.script
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC3152 has 192Kb of ISRAM beginning at virtual address 0x1102:8000.
+ * LPC31xx boot ROM expects the boot image be compiled with entry point at
+ * 0x1102:9000. A 128b header will appear at this address (applied by
+ * lpc313xImgCreator) and the executable code must begin at 0x1102:9080.
+ */
+
+MEMORY
+{
+ isram (rwx) : ORIGIN = 0x11029080, LENGTH = 192K - 4224
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > isram
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > isram
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >isram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } > isram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > isram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ea3152/src/Makefile b/nuttx/configs/ea3152/src/Makefile
new file mode 100644
index 000000000..91a7fe379
--- /dev/null
+++ b/nuttx/configs/ea3152/src/Makefile
@@ -0,0 +1,105 @@
+############################################################################
+# configs/ea3152/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_clkinit.c
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+ifeq ($(CONFIG_LPC31_EXTSDRAM),y)
+CSRCS += up_mem.c
+endif
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+ifeq ($(CONFIG_LPC31_SPI),y)
+CSRCS += up_spi.c
+endif
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_PAGING),y)
+CSRCS += up_fillpage.c
+endif
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ea3152/src/ea3152_internal.h b/nuttx/configs/ea3152/src/ea3152_internal.h
new file mode 100644
index 000000000..ee93c36a1
--- /dev/null
+++ b/nuttx/configs/ea3152/src/ea3152_internal.h
@@ -0,0 +1,127 @@
+/************************************************************************************
+ * configs/ea3152/src/ea3152_internal.h
+ * arch/arm/src/board/ea3152_internal.n
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EA3152_SRC_EA3152_INTERNAL_H
+#define __CONFIGS_EA3152_SRC_EA3152_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+#include "lpc31_ioconfig.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* EA3152L GPIOs ********************************************************************/
+
+/* LEDs -- interface through an I2C GPIO expander */
+
+/* BUTTONS -- NOTE that some have EXTI interrupts configured */
+
+/* SPI Chip Selects */
+/* SPI NOR flash is the only device on SPI. SPI_CS_OUT0 is its chip select */
+
+#define SPINOR_CS IOCONFIG_SPI_CSOUT0
+
+/* USB Soft Connect Pullup -- NONE */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_meminitialize
+ *
+ * Description:
+ * Initialize external memory resources (sram, sdram, nand, nor, etc.)
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC31_EXTSDRAM
+extern void lpc31_meminitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: lpc31_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the EA3152 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc31_spiinitialize(void);
+
+/************************************************************************************
+ * Name: lpc31_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the EA3152 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc31_usbinitialize(void);
+
+/************************************************************************************
+ * Name: lpc31_pginitialize
+ *
+ * Description:
+ * Set up mass storage device to support on demand paging.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_PAGING
+extern void weak_function lpc31_pginitialize(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_EA3152_SRC_EA3152_INTERNAL_H */
+
diff --git a/nuttx/configs/ea3152/src/up_boot.c b/nuttx/configs/ea3152/src/up_boot.c
new file mode 100644
index 000000000..c8870cfdf
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_boot.c
@@ -0,0 +1,119 @@
+/************************************************************************************
+ * configs/ea3152/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lpc31_internal.h"
+#include "ea3152_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_boardinitialize
+ *
+ * Description:
+ * All LPC31XX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc31_boardinitialize(void)
+{
+ /* Initialize configured, external memory resources */
+
+#ifdef CONFIG_LPC31_EXTSDRAM
+ lpc31_meminitialize();
+#endif
+
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * lpc31_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_LPC31_SPI)
+ if (lpc31_spiinitialize)
+ {
+ lpc31_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function lpc31_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_LPC31_USB)
+ if (lpc31_usbinitialize)
+ {
+ lpc31_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+
+ /* Set up mass storage device to support on demand paging */
+
+#if defined(CONFIG_PAGING)
+ if (lpc31_pginitialize)
+ {
+ lpc31_pginitialize();
+ }
+#endif
+}
diff --git a/nuttx/configs/ea3152/src/up_buttons.c b/nuttx/configs/ea3152/src/up_buttons.c
new file mode 100644
index 000000000..d56bfd766
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_buttons.c
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * configs/ea3152/src/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "ea3152_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ return 0;
+}
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/ea3152/src/up_clkinit.c b/nuttx/configs/ea3152/src/up_clkinit.c
new file mode 100644
index 000000000..04dfe3411
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_clkinit.c
@@ -0,0 +1,444 @@
+/****************************************************************************
+ * configs/ea3152/src/up_clkinit.c
+ * arch/arm/src/board/up_clkinit.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * References:
+ * - NXP UM10314 LPC3130/31 User manual Rev. 1.01 — 9 September 2009
+ * - NXP lpc313x.cdl.drivers.zip example driver code
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "lpc31_cgu.h"
+#include "lpc31_cgudrvr.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Sub-domain Clock Bitsets *************************************************/
+/* The following bitsets group clocks into bitsets associated with each
+ * domain and fractional divider subdomain.
+ *
+ * Domain 0 (DOMAINID_SYS), Clocks 0 - 29, Fraction dividers 0-6. Clocks not
+ * defined in the clock sets will be sourced with SYS_BASE_CLK.
+ */
+
+/* Domain 0, Fractional divider 0: */
+
+#define CGU_CLKSET_DOMAIN0_DIV0 \
+ (_D0B(CLKID_APB0CLK)|_D0B(CLKID_APB1CLK)|_D0B(CLKID_APB2CLK)|\
+ _D0B(CLKID_APB3CLK)|_D0B(CLKID_APB4CLK)|_D0B(CLKID_AHB2INTCCLK)|\
+ _D0B(CLKID_AHB0CLK)|_D0B(CLKID_DMAPCLK)|_D0B(CLKID_DMACLKGATED)|\
+ _D0B(CLKID_NANDFLASHS0CLK)|_D0B(CLKID_NANDFLASHPCLK)|\
+ _D0B(CLKID_ARM926BUSIFCLK)|_D0B(CLKID_SDMMCHCLK)|_D0B(CLKID_USBOTGAHBCLK)|\
+ _D0B(CLKID_ISRAM0CLK)|_D0B(CLKID_ISRAM1CLK)|_D0B(CLKID_ISROMCLK)|\
+ _D0B(CLKID_MPMCCFGCLK)|_D0B(CLKID_MPMCCFGCLK2)|_D0B(CLKID_INTCCLK))
+
+/* Domain 0, Fractional divider 1: */
+
+#define CGU_CLKSET_DOMAIN0_DIV1 \
+ (_D0B(CLKID_ARM926CORECLK))
+
+/* Domain 0, Fractional divider 2: */
+
+#define CGU_CLKSET_DOMAIN0_DIV2 \
+ (_D0B(CLKID_NANDFLASHAESCLK)|_D0B(CLKID_NANDFLASHNANDCLK))
+
+/* Domain 0, Fractional divider 3: */
+
+#define CGU_CLKSET_DOMAIN0_DIV3 \
+ (_D0B(CLKID_NANDFLASHECCCLK))
+
+/* Domain 0, Fractional divider 4: */
+
+#define CGU_CLKSET_DOMAIN0_DIV4 \
+ (_D0B(CLKID_SDMMCCCLKIN))
+
+/* Domain 0, Fractional divider 5: */
+
+#define CGU_CLKSET_DOMAIN0_DIV5 \
+ (_D0B(CLKID_CLOCKOUT))
+
+/* Domain 0, Fractional divider 6: */
+
+#define CGU_CLKSET_DOMAIN0_DIV6 \
+ (_D0B(CLKID_EBICLK))
+
+/* Domain 1 (DOMAINID_AHB0APB0), Clocks 30-39, Fraction dividers 7-8. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB0_BASE_CLK.
+ */
+
+/* Domain 1, Fractional divider 7: */
+
+#define CGU_CLKSET_DOMAIN1_DIV7 \
+ (_D1B(CLKID_ADCCLK))
+
+/* Domain 1, Fractional divider 8: */
+
+#define CGU_CLKSET_DOMAIN1_DIV8 \
+ (_D1B(CLKID_AHB2APB0PCLK)|_D1B(CLKID_EVENTROUTERPCLK)|\
+ _D1B(CLKID_ADCPCLK)|_D1B(CLKID_WDOGPCLK)|_D1B(CLKID_IOCONFPCLK)|\
+ _D1B(CLKID_CGUPCLK)|_D1B(CLKID_SYSCREGPCLK)|_D1B(CLKID_OTPPCLK)|\
+ _D1B(CLKID_RNGPCLK))
+
+/* Domain 2 (DOMAINID_AHB0APB1), Clocks 40-49, Fraction dividers 9-10. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB1_BASE_CLK.
+ */
+
+/* Domain 2, Fractional divider 9: */
+
+#define CGU_CLKSET_DOMAIN2_DIV9 \
+ (_D2B(CLKID_AHB2APB1PCLK)|_D2B(CLKID_TIMER0PCLK)|_D2B(CLKID_TIMER1PCLK)|\
+ _D2B(CLKID_TIMER2PCLK)|_D2B(CLKID_TIMER3PCLK)|_D2B(CLKID_PWMPCLK)|\
+ _D2B(CLKID_PWMPCLKREGS)|_D2B(CLKID_I2C0PCLK)|_D2B(CLKID_I2C1PCLK))
+
+/* Domain 2, Fractional divider 10: */
+
+#define CGU_CLKSET_DOMAIN2_DIV10 \
+ (_D2B(CLKID_PWMCLK))
+
+/* Domain 3 (DOMAINID_AHB0APB2), Clocks 50-57, Fraction dividers 11-13. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB2_BASE_CLK.
+ */
+
+/* Domain 3, Fractional divider 11: */
+
+#define CGU_CLKSET_DOMAIN3_DIV11 \
+ ( _D3B(CLKID_AHB2APB2PCLK)|_D3B(CLKID_PCMPCLK)|_D3B(CLKID_PCMAPBPCLK)|\
+ _D3B(CLKID_UARTAPBCLK)|_D3B(CLKID_LCDPCLK)|_D3B(CLKID_SPIPCLK)|\
+ _D3B(CLKID_SPIPCLKGATED))
+
+/* Domain 3, Fractional divider 12: */
+
+#define CGU_CLKSET_DOMAIN3_DIV12 \
+ (_D3B(CLKID_LCDCLK))
+
+/* Domain 3, Fractional divider 13: */
+
+#define CGU_CLKSET_DOMAIN3_DIV13 \
+ (0)
+
+/* Domain 4 (DOMAINID_AHB0APB3), Clocks 58-70, Fraction divider 14. Clocks
+ * not defined in the clock sets will be sourced with AHB_APB3_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN4_DIV14 \
+ (_D4B(CLKID_AHB2APB3PCLK)|_D4B(CLKID_I2SCFGPCLK)|_D4B(CLKID_EDGEDETPCLK)|\
+ _D4B(CLKID_I2STXFIFO0PCLK)|_D4B(CLKID_I2STXIF0PCLK)|_D4B(CLKID_I2STXFIFO1PCLK)|\
+ _D4B(CLKID_I2STXIF1PCLK)|_D4B(CLKID_I2SRXFIFO0PCLK)|_D4B(CLKID_I2SRXIF0PCLK)|\
+ _D4B(CLKID_I2SRXFIFO1PCLK)|_D4B(CLKID_I2SRXIF1PCLK))
+
+/* Domain 5 (DOMAINID_PCM), Clock 71, Fraction divider 15. Clocks not
+ * defined in the clock sets will be sourced with AHB_APB3_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN5_DIV15 \
+ (_D5B(CLKID_PCMCLKIP))
+
+/* Domain 6 (DOMAINID_UART), Clock 72, Fraction divider 16. Clocks mpt
+ * defined in the clock sets will be sourced with UART_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN6_DIV16 \
+ (0)
+
+/* Domain 7 (DOMAINID_CLK1024FS), Clocks 73-86, Fraction dividers 17-22. Clocks
+ * not defined in the clock sets will be sourced with CLK1024FS_BASE_CLK.
+ */
+
+/* Domain 7, Fractional divider 17: */
+
+#define CGU_CLKSET_DOMAIN7_DIV17 \
+ ( _D7B(CLKID_I2SEDGEDETECTCLK)|_D7B(CLKID_I2STXWS0)|_D7B(CLKID_I2STXWS1)|\
+ _D7B(CLKID_I2SRXWS0)|_D7B(CLKID_I2SRXWS1))
+
+/* Domain 7, Fractional divider 18: */
+
+#define CGU_CLKSET_DOMAIN7_DIV18 \
+ ( _D7B(CLKID_I2STXBCK0N)|_D7B(CLKID_I2STXBCK1N))
+
+/* Domain 7, Fractional divider 19: */
+
+#define CGU_CLKSET_DOMAIN7_DIV19 \
+ ( _D7B(CLKID_I2STXCLK0)|_D7B(CLKID_CLK256FS))
+
+/* Domain 7, Fractional divider 20: */
+
+#define CGU_CLKSET_DOMAIN7_DIV20 \
+ ( _D7B(CLKID_I2SRXBCK0N)|_D7B(CLKID_I2SRXBCK1N))
+
+/* Domain 7, Fractional divider 21: */
+
+#define CGU_CLKSET_DOMAIN7_DIV21 \
+ (0)
+
+/* Domain 7, Fractional divider 22: */
+
+#define CGU_CLKSET_DOMAIN7_DIV22 \
+ (0)
+
+/* Domain 8 (DOMAINID_BCK0, clock 87, and domain 9 (DOMAINID_BCK1), clock 88,
+ * are directly connected
+ */
+
+/* Domain 10 (DOMAINID_SPI), Clocks 89-90, Fraction divider 23. Clocks
+ * not defined in the clock sets will be sourced with SPI_CLK_BASE_CLK.
+ */
+
+#define CGU_CLKSET_DOMAIN10_DIV23 \
+ ( _D10B(CLKID_SPICLK)|_D10B(CLKID_SPICLKGATED))
+
+/* Domain 11 (DOMAINID_SYSCLKO, clock 91, is directly connected */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* Default clock configuration for the EA3152 board. Every board must
+ * provide an implementation of g_boardclks. This rather complex structure
+ * is used by the boot-up logic to configure initial lpc313x clocking.
+ *
+ * FFAST: 12MHz
+ * MASTER PLL Freq: 180MHz;
+ * AUDIOPLL Freq: 1024Fs, Fs = 44.1kHz
+ *
+ * Domain Input Subdomain Divider Ratio
+ * ------------------------ ----------------- ----------------- -------------
+ * 0 - DOMAIN_SYS MASTER PLL(HPLL1) DOMAIN0_DIV0 1/2
+ * DOMAIN0_DIV1 1
+ * DOMAIN0_DIV2 1/2
+ * DOMAIN0_DIV3 1/4
+ * DOMAIN0_DIV4 1/4
+ * DOMAIN0_DIV5 1/2
+ * DOMAIN0_DIV6 1/2
+ *
+ * 1 - DOMAIN_AHB0APB0 FFAST DOMAIN1_DIV7 1/38
+ * DOMAIN1_DIV8 1/2
+ *
+ * 2 - DOMAIN_AHB0APB1 FFAST DOMAIN2_DIV9 1/2
+ * DOMAIN2_DIV10 1/2
+ *
+ * 3 - DOMAIN_AHB0APB2 MASTER PLL(HPLL1) DOMAIN3_DIV11 1/2
+ * DOMAIN3_DIV12 1/40
+ * DOMAIN3_DIV13 1 (not used)
+ *
+ * 4 - DOMAIN_AHB0APB3 FFAST DOMAIN4_DIV14 1/2
+ *
+ * 5 - DOMAIN_PCM MASTER PLL(HPLL1) DOMAIN5_DIV15 1/2
+ *
+ * 6 - DOMAIN_UART FFAST DOMAIN6_DIV16 1
+ *
+ * 7 - DOMAIN_CLCK1024FS AUDIO PLL(HPLL0) DOMAIN7_DIV17 1/256
+ * DOMAIN7_DIV18 1/4
+ * DOMAIN7_DIV19 1
+ * DOMAIN7_DIV20 1/4
+ * DOMAIN7_DIV21 1/32
+ * DOMAIN7_DIV22 1/2
+ *
+ * 8 - DOMAIN_I2SRXBCK0 I2SRX_BCK0 - -
+ *
+ * 9 - DOMAIN_I2SRXBCK1 I2SRX_BCK1 - -
+ *
+ * 10 - DOMAIN_SPI MASTER PLL(HPLL1) DOMAIN10_DIV23 1/2
+ *
+ * 11 - DOMAIN_SYSCLKO FFAST - -
+ */
+
+const struct lpc31_clkinit_s g_boardclks =
+{
+ /* Domain 0 (DOMAINID_SYS), Clocks 0 - 29, Fraction dividers 0-6 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV0},
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN0_DIV1},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV2},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN0_DIV3},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN0_DIV4},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV5},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN0_DIV6}
+ }
+ },
+
+ /* Domain 1 (DOMAINID_AHB0APB0), Clocks 30-39, Fraction dividers 7-8 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{1, 1, 38}, CGU_CLKSET_DOMAIN1_DIV7},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN1_DIV8}
+ }
+ },
+
+ /* Domain 2 (DOMAINID_AHB0APB1), Clocks 40-49, Fraction dividers 9-10 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN2_DIV9},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN2_DIV10}
+ }
+ },
+
+ /* Domain 3 (DOMAINID_AHB0APB2), Clocks 50-57, Fraction dividers 11-13 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN3_DIV11},
+ {{1, 1, 40}, CGU_CLKSET_DOMAIN3_DIV12},
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN3_DIV13}
+ }
+ },
+
+ /* Domain 4 (DOMAINID_AHB0APB3), Clocks 58-70, Fraction divider 14 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN4_DIV14}
+ }
+ },
+
+ /* Domain 5 (DOMAINID_PCM), Clock 71, Fraction divider 15 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN5_DIV15}
+ }
+ },
+
+ /* Domain 6 (DOMAINID_UART), Clock 72, Fraction divider 16 */
+
+ {
+ CGU_FREQIN_FFAST,
+ {
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN6_DIV16}
+ }
+ },
+
+ /* Domain 7 (DOMAINID_CLK1024FS), Clocks 73-86, Fraction dividers 17-22 */
+
+ {
+ CGU_FREQIN_HPPLL0,
+ {
+ {{1, 1, 256}, CGU_CLKSET_DOMAIN7_DIV17},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN7_DIV18},
+ {{0, 0, 0}, CGU_CLKSET_DOMAIN7_DIV19},
+ {{1, 1, 4}, CGU_CLKSET_DOMAIN7_DIV20},
+ {{1, 1, 32}, CGU_CLKSET_DOMAIN7_DIV21},
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN7_DIV22}
+ }
+ },
+
+ /* Domain 8 (DOMAINID_BCK0, clock 87 */
+
+ {
+ CGU_FREQIN_I2SRXBCK0
+ },
+
+ /* Domain 9 (DOMAINID_BCK1, clock 88 */
+
+ {
+ CGU_FREQIN_I2SRXBCK1
+ },
+
+ /* Domain 10 (DOMAINID_SPI), Clocks 89-90, Fraction divider 23 */
+
+ {
+ CGU_FREQIN_HPPLL1,
+ {
+ {{1, 1, 2}, CGU_CLKSET_DOMAIN10_DIV23}
+ }
+ },
+
+ /* Domain 11 (DOMAINID_SYSCLKO, clock 91 */
+
+ {
+ CGU_FREQIN_FFAST
+ },
+
+ /* Dynamic fractional divider configuration (7) */
+
+#if 0 /* Dynamic fractional divider initialization not implemented */
+ {
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 64}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {0, 0, 0}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 3}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 6}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 6}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 6}
+ },
+ {
+ CGU_DYNSEL_ALLBITS, {1, 1, 3}
+ }
+ }
+#endif
+};
+
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
diff --git a/nuttx/configs/ea3152/src/up_fillpage.c b/nuttx/configs/ea3152/src/up_fillpage.c
new file mode 100644
index 000000000..880f70036
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_fillpage.c
@@ -0,0 +1,525 @@
+/****************************************************************************
+ * configs/ea3152/src/up_fillpage.c
+ * arch/arm/src/board/up_fillpage.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/sched.h>
+#include <nuttx/page.h>
+
+#ifdef CONFIG_PAGING
+#ifdef CONFIG_PAGING_BINPATH
+# include <sys/stat.h>
+# include <sys/types.h>
+# include <stdbool.h>
+# include <unistd.h>
+# include <fcntl.h>
+# ifdef CONFIG_PAGING_SDSLOT
+# include <stdio.h>
+# include <sys/mount.h>
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+# include "lpc31_internal.h"
+# endif
+#endif
+
+#if defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+# include <sys/ioctl.h>
+# include <nuttx/fs/ioctl.h>
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+#endif
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* SD SLOT number might depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_EA3152
+# define HAVE_SD 1
+# define HAVE_SPINOR 1
+# if defined(CONFIG_PAGING_SDSLOT) && CONFIG_PAGING_SDSLOT != 0
+# error "Only one SD slot"
+# undef CONFIG_PAGING_SDSLOT
+# endif
+#else
+ /* Add configuration for new LPC31XX boards here */
+# error "Unrecognized LPC31XX board"
+# undef CONFIG_PAGING_SDSLOT
+# undef HAVE_SD
+# undef HAVE_SPINOR
+#endif
+
+/* Sanity check: We can only perform paging using a single source device */
+
+#if defined(CONFIG_PAGING_M25PX) && defined(CONFIG_PAGING_AT45DB)
+# error "Both CONFIG_PAGING_M25PX and CONFIG_PAGING_AT45DB are defined"
+# undef CONFIG_PAGING_M25PX
+#endif
+#if defined(CONFIG_PAGING_BINPATH) && defined(CONFIG_PAGING_M25PX)
+# error "Both CONFIG_PAGING_BINPATH and CONFIG_PAGING_M25PX are defined"
+# undef CONFIG_PAGING_BINPATH
+#endif
+#if defined(CONFIG_PAGING_BINPATH) && defined(CONFIG_PAGING_AT45DB)
+# error "Both CONFIG_PAGING_BINPATH and CONFIG_PAGING_AT45DB are defined"
+# undef CONFIG_PAGING_BINPATH
+#endif
+
+/* Are we accessing the page source data through a file path? */
+
+#ifdef CONFIG_PAGING_BINPATH
+
+ /* Can't support SD if the board does not support SD (duh) */
+
+# if defined(CONFIG_PAGING_SDSLOT) && !defined(HAVE_SD)
+# error "This board does not support SD"
+# undef CONFIG_PAGING_SDSLOT
+# endif
+
+ /* Can't support SD if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+# if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI)
+# ifdef CONFIG_PAGING_SDSLOT
+# error "Mountpoints and/or MCI disabled"
+# endif
+# undef CONFIG_PAGING_SDSLOT
+# undef HAVE_SD
+# endif
+
+ /* A mountpoint for the FAT file system must be provided */
+
+# if !defined(CONFIG_PAGING_MOUNTPT) && defined(CONFIG_PAGING_SDSLOT)
+# error "No CONFIG_PAGING_MOUNTPT provided"
+# undef CONFIG_PAGING_SDSLOT
+# undef HAVE_SD
+# endif
+
+ /* If no minor number is provided, default to zero */
+
+# ifndef CONFIG_PAGING_MINOR
+# define CONFIG_PAGING_MINOR 0
+# endif
+
+#endif /* CONFIG_PAGING_BINPATH */
+
+/* Are we accessing the page source data through the M25P* MTD device? */
+
+#if defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+
+ /* Verify that SPI support is enabld */
+
+#ifndef CONFIG_LPC31_SPI
+# error "SPI support is not enabled"
+#endif
+
+ /* Make sure that some value is defined for the offset into the FLASH
+ * of the NuttX binary image.
+ */
+
+# ifndef CONFIG_PAGING_BINOFFSET
+# define CONFIG_PAGING_BINOFFSET 0
+# endif
+
+ /* Make sure that some value is defined for the SPI port number */
+
+# ifndef CONFIG_PAGING_SPIPORT
+# define CONFIG_PAGING_SPIPORT 0
+# endif
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* State structure needed to support paging from a file */
+
+#ifdef CONFIG_PAGING_BINPATH
+struct pg_source_s
+{
+ bool initialized; /* TRUE: we are initialized */
+ int fd; /* File descriptor of the nuttx.bin file */
+};
+#endif
+
+/* State structured needd to support paging through the M25P* MTD interface. */
+
+#if defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+struct pg_source_s
+{
+ /* If interrupts or DMA are used, then we will have to defer initialization */
+
+ bool initialized; /* TRUE: we are initialized */
+
+ /* This is the M25P* device state structure */
+
+ FAR struct mtd_dev_s *mtd;
+
+ /* This the the device geometry */
+
+#ifdef CONFIG_DEBUG
+ FAR struct mtd_geometry_s geo;
+#endif
+};
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#if defined(CONFIG_PAGING_BINPATH) || defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+static struct pg_source_s g_pgsrc;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc31_initsrc()
+ *
+ * Description:
+ * Initialize the source device that will support paging.
+ * If BINPATH is defined, then it is the full path to a file on a mounted file
+ * system. In this case initialization will be deferred until the first
+ * time that up_fillpage() is called.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_PAGING_BINPATH)
+static inline void lpc31_initsrc(void)
+{
+#ifdef CONFIG_PAGING_SDSLOT
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+#endif
+
+ /* Are we already initialized? */
+
+ if (!g_pgsrc.initialized)
+ {
+#ifdef CONFIG_PAGING_SDSLOT
+ char devname[16];
+#endif
+
+ pgllvdbg("Initializing %s\n", CONFIG_PAGING_BINPATH);
+
+ /* No, do we need to mount an SD device? */
+
+#ifdef CONFIG_PAGING_SDSLOT
+
+ /* Yes.. First, get an instance of the SDIO interface */
+
+ sdio = sdio_initialize(CONFIG_PAGING_SDSLOT);
+ DEBUGASSERT(sdio != NULL);
+
+ /* Then bind the SDIO interface to the SD driver */
+
+ ret = mmcsd_slotinitialize(CONFIG_PAGING_MINOR, sdio);
+ DEBUGASSERT(ret == OK);
+
+ /* Then let's guess and say that there is a card in the slot.
+ * (We are basically jodido anyway if there is no card in the slot).
+ */
+
+ sdio_mediachange(sdio, true);
+
+ /* Now mount the file system */
+
+ snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_PAGING_MINOR);
+ ret = mount(devname, CONFIG_PAGING_MOUNTPT, "vfat", MS_RDONLY, NULL);
+ DEBUGASSERT(ret == OK);
+
+#endif /* CONFIG_PAGING_SDSLOT */
+
+ /* Open the selected path for read-only access */
+
+ g_pgsrc.fd = open(CONFIG_PAGING_BINPATH, O_RDONLY);
+ DEBUGASSERT(g_pgsrc.fd >= 0);
+
+ /* Then we are initialized */
+
+ g_pgsrc.initialized = true;
+ }
+}
+
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+static inline void lpc31_initsrc(void)
+{
+ FAR struct spi_dev_s *spi;
+#ifdef CONFIG_DEBUG
+ uint32_t capacity;
+ int ret;
+#endif
+
+ /* Are we already initialized? */
+
+ if (!g_pgsrc.initialized)
+ {
+ /* No... the initialize now */
+
+ pgllvdbg("Initializing\n");
+
+ /* First get an instance of the SPI device interface */
+
+ spi = up_spiinitialize(CONFIG_PAGING_SPIPORT);
+ DEBUGASSERT(spi != NULL);
+
+ /* Then bind the SPI interface to the MTD driver */
+
+#ifdef CONFIG_PAGING_M25PX
+ g_pgsrc.mtd = m25p_initialize(spi);
+#else
+ g_pgsrc.mtd = at45db_initialize(spi);
+#endif
+ DEBUGASSERT(g_pgsrc.mtd != NULL);
+
+ /* Verify that we can use the device */
+
+#ifdef CONFIG_DEBUG
+ /* Get the device geometry. (casting to uintptr_t first eliminates
+ * complaints on some architectures where the sizeof long is different
+ * from the size of a pointer).
+ */
+
+ ret = MTD_IOCTL(g_pgsrc.mtd, MTDIOC_GEOMETRY, (unsigned long)&g_pgsrc.geo);
+ DEBUGASSERT(ret >= 0);
+ capacity = g_pgsrc.geo.erasesize*g_pgsrc.geo.neraseblocks;
+ pgllvdbg("capacity: %d\n", capacity);
+ DEBUGASSERT(capacity >= (CONFIG_PAGING_BINOFFSET + PG_TEXT_VSIZE));
+#endif
+
+ /* We are now initialized */
+
+ g_pgsrc.initialized = true;
+ }
+}
+
+#else
+# define lpc31_initsrc()
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_fillpage()
+ *
+ * Description:
+ * After a page is allocated and mapped by up_allocpage(), the actual
+ * filling of the page with data from the non-volatile, must be performed
+ * by a separate call to the architecture-specific function, up_fillpage().
+ * This function is non-blocking, it will start an asynchronous page fill.
+ * The common paging logic will provide a callback function, pg_callback,
+ * that will be called when the page fill is finished (or an error occurs).
+ * This callback is assumed to occur from an interrupt level when the
+ * device driver completes the fill operation.
+ *
+ * NOTE 1: Allocating and filling a page is a two step process. up_allocpage()
+ * allocates the page, and up_fillpage() fills it with data from some non-
+ * volatile storage device. This distinction is made because up_allocpage()
+ * can probably be implemented in board-independent logic whereas up_fillpage()
+ * probably must be implemented as board-specific logic.
+ *
+ * NOTE 2: The initial mapping of vpage will be read-able, write-able,
+ * but non-cacheable. No special actions will be required of
+ * up_fillpage() in order to write into this allocated page. If the
+ * virtual address maps to a text region, however, this function should
+ * remap the region so that is is read/execute only. It should be made
+ * cache-able in any case.
+
+ * Input Parameters:
+ * tcb - A reference to the task control block of the task that needs to
+ * have a page fill. Architecture-specific logic can retrieve page
+ * fault information from the architecture-specific context
+ * information in this TCB to perform the fill.
+ * pg_callbck - The function to be called when the page fill is complete.
+ *
+ * Returned Value:
+ * This function will return zero (OK) if the page fill was successfully
+ * started (the result of the page fill is passed to the callback function
+ * as the result argument). A negated errno value may be returned if an
+ * error occurs. All errors, however, are fatal.
+ *
+ * NOTE: -EBUSY has a special meaning. It is used internally to mean that
+ * the callback function has not executed. Therefore, -EBUSY should
+ * never be provided in the result argument of pg_callback.
+ *
+ * Assumptions:
+ * - This function is called from the normal tasking context (but
+ * interrupts siabled). The implementation must take whatever actions
+ * are necessary to assure that the operation is safe within this context.
+ * - Upon return, the caller will sleep waiting for the page fill callback
+ * to occur. The callback function will perform the wakeup.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PAGING_BLOCKINGFILL
+
+/* Version 1: Supports blocking fill operations */
+
+int up_fillpage(FAR _TCB *tcb, FAR void *vpage)
+{
+#if defined(CONFIG_PAGING_BINPATH)
+ ssize_t nbytes;
+ off_t offset;
+ off_t pos;
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+ ssize_t nbytes;
+ off_t offset;
+#endif
+
+ pglldbg("TCB: %p vpage: %p far: %08x\n", tcb, vpage, tcb->xcp.far);
+ DEBUGASSERT(tcb->xcp.far >= PG_PAGED_VBASE && tcb->xcp.far < PG_PAGED_VEND);
+
+ /* If BINPATH is defined, then it is the full path to a file on a mounted file
+ * system. In this case initialization will be deferred until the first
+ * time that up_fillpage() is called. Are we initialized?
+ */
+
+#if defined(CONFIG_PAGING_BINPATH)
+
+ /* Perform initialization of the paging source device (if necessary) */
+
+ lpc31_initsrc();
+
+ /* Create an offset into the binary image that corresponds to the
+ * virtual address. File offset 0 corresponds to PG_LOCKED_VBASE.
+ */
+
+ offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE;
+
+ /* Seek to that position */
+
+ pos = lseek(g_pgsrc.fd, offset, SEEK_SET);
+ DEBUGASSERT(pos != (off_t)-1);
+
+ /* And read the page data from that offset */
+
+ nbytes = read(g_pgsrc.fd, vpage, PAGESIZE);
+ DEBUGASSERT(nbytes == PAGESIZE);
+ return OK;
+
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB) /* !CONFIG_PAGING_BINPATH */
+
+ /* Perform initialization of the paging source device (if necessary) */
+
+ lpc31_initsrc();
+
+ /* Create an offset into the binary image that corresponds to the
+ * virtual address. File offset 0 corresponds to PG_LOCKED_VBASE.
+ */
+
+ offset = (off_t)tcb->xcp.far - PG_LOCKED_VBASE + CONFIG_PAGING_BINOFFSET;
+
+ /* Read the page at the correct offset into the SPI FLASH device */
+
+ nbytes = MTD_READ(g_pgsrc.mtd, offset, PAGESIZE, (FAR uint8_t *)vpage);
+ DEBUGASSERT(nbytes == PAGESIZE);
+ return OK;
+
+#else /* !CONFIG_PAGING_BINPATH && !CONFIG_PAGING_M25PX && !CONFIG_PAGING_AT45DB */
+
+# warning "Not implemented"
+ return -ENOSYS;
+
+#endif /* !CONFIG_PAGING_BINPATH && !CONFIG_PAGING_M25PX && !CONFIG_PAGING_AT45DB */
+}
+
+#else /* CONFIG_PAGING_BLOCKINGFILL */
+
+/* Version 2: Supports non-blocking, asynchronous fill operations */
+
+int up_fillpage(FAR _TCB *tcb, FAR void *vpage, up_pgcallback_t pg_callback)
+{
+ pglldbg("TCB: %p vpage: %d far: %08x\n", tcb, vpage, tcb->xcp.far);
+ DEBUGASSERT(tcb->xcp.far >= PG_PAGED_VBASE && tcb->xcp.far < PG_PAGED_VEND);
+
+#if defined(CONFIG_PAGING_BINPATH)
+# error "File system-based paging must always be implemented with blocking calls"
+#elif defined(CONFIG_PAGING_M25PX) || defined(CONFIG_PAGING_AT45DB)
+# error "SPI FLASH paging must always be implemented with blocking calls"
+#else
+# warning "Not implemented"
+#endif
+
+ return -ENOSYS;
+}
+
+#endif /* CONFIG_PAGING_BLOCKINGFILL */
+
+/************************************************************************************
+ * Name: lpc31_pginitialize
+ *
+ * Description:
+ * Set up mass storage device to support on demand paging.
+ *
+ ************************************************************************************/
+
+void weak_function lpc31_pginitialize(void)
+{
+ /* This initialization does nothing in this example setup. But this function is
+ * where you might, for example:
+ *
+ * - Initialize and configure a mass storage device to support on-demand paging.
+ * This might be, perhaps an SD card or NAND memory. An SPI FLASH would probably
+ * already have been configured by lpc31_spiinitialize(void);
+ * - Set up resources to support up_fillpage() operation. For example, perhaps the
+ * the text image is stored in a named binary file. In this case, the virtual
+ * text addresses might map to offsets into that file.
+ * - Do whatever else is necessary to make up_fillpage() ready for the first time
+ * that it is called.
+ *
+ * In reality, however, this function is not very useful: This function is called
+ * from a low level (before os_start() is even called), it may not be possible to
+ * perform file system operations or even to get debug output yet. Therefore,
+ * to keep life simple, initialization will be deferred in all cases until the first
+ * time that up_fillpage() is called.
+ */
+}
+
+#endif /* CONFIG_PAGING */
diff --git a/nuttx/configs/ea3152/src/up_leds.c b/nuttx/configs/ea3152/src/up_leds.c
new file mode 100644
index 000000000..4c6aeea0f
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_leds.c
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/ea3152/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lpc31_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ea3152/src/up_mem.c b/nuttx/configs/ea3152/src/up_mem.c
new file mode 100644
index 000000000..4f6c71e87
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_mem.c
@@ -0,0 +1,359 @@
+/****************************************************************************
+ * configs/ea3152/src/up_mem.c
+ * arch/arm/src/board/up_mem.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * References:
+ * - NXP UM10314 LPC3130/31 User manual Rev. 1.01 — 9 September 2009
+ * - NXP lpc313x.cdl.drivers.zip example driver code
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "lpc31_syscreg.h"
+#include "lpc31_cgudrvr.h"
+#include "lpc31_mpmc.h"
+#include "ea3152_internal.h"
+
+#ifdef CONFIG_LPC31_EXTSDRAM
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The MPMC delay based on trace lengths between SDRAM and the chip and on
+ * the delay strategy used for SDRAM.
+ */
+
+#define EA3152_MPMC_DELAY 0x824
+
+/* Delay constants in nanosecondss for MT48LC32M16LF SDRAM on board */
+
+#define EA3152_SDRAM_TRP (20)
+#define EA3152_SDRAM_TRFC (66)
+#define EA3152_SDRAM_TRAS (44)
+#define EA3152_SDRAM_TREX (75)
+#define EA3152_SDRAM_TARP 4
+#define EA3152_SDRAM_TWR (75)
+#define EA3152_SDRAM_TRC (66)
+#define EA3152_SDRAM_TRRD (15)
+#define EA3152_SDRAM_TMRD (20)
+#define EA3152_SDRAM_TXSR (75)
+#define EA3152_SDRAM_TDAL (50)
+#define EA3152_SDRAM_REFRESH (100)
+#define EA3152_SDRAM_OPERREFRESH (7812)
+
+/* Macro used to convert the above values (in nanoseconds) into units of
+ * the HCLK.
+ */
+
+#define NS2HCLKS(ns,hclk2,mask) \
+ ((uint32_t)(((uint64_t)ns *(uint64_t)hclk2) / 1000000000ull) & mask)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc31_sdraminitialize
+ *
+ * Description:
+ * Configure SDRAM on the EA3152 board
+ *
+ * Micron Initialization Sequence from their data sheet for the Micron
+ * MT48LC32M16A2 32M x 16 SDRAM chip:
+ *
+ * "SDRAMs must be powered up and initialized in a predefined manner.
+ * Operational procedures other than those specified may result in
+ * undefined operation. Once power is applied to VDD and VDDQ
+ * (simultaneously) and the clock is stable (stable clock is defined as
+ * a signal cycling within timing constraints specified for the clock
+ * pin), the SDRAM requires a 100µs delay prior to issuing any command
+ * other than a COMMAND INHIBIT or NOP.
+ *
+ * "Starting at some point during this 100µs period and continuing at least
+ * through the end of this period, COMMAND INHIBIT or NOP commands should
+ * be applied. Once the 100µs delay has been satisfied with at least one
+ * COMMAND INHIBIT or NOP command having been applied, a PRECHARGE command
+ * should be applied. All banks must then be precharged, thereby placing
+ * the device in the all banks idle state.
+ *
+ * "Once in the idle state, two AUTO REFRESH cycles must be performed. After
+ * the AUTO REFRESH cycles are complete, the SDRAM is ready for mode
+ * register programming.
+ *
+ * "Because the mode register will power up in an unknown state, it should
+ * be loaded prior to applying any operational command."
+ *
+ * The JEDEC recommendation for initializing SDRAM is:
+ *
+ * APPLY POWER (Vdd/Vddq equally, and CLK is stable)
+ * Wait 200uS
+ * PRECHARGE all
+ * 8 AUTO REFRESH COMMANDS
+ * LOAD MODE REGISTER
+ * SDRAM is ready for operation
+ *
+ * The Micron SDRAM parts will work fine with the JEDEC sequence, but also
+ * allow for a quicker init sequence of:
+ *
+ * APPLY POWER (Vdd/Vddq equally, and CLK is stable)
+ * Wait at least 100uS (during which time start applying and
+ * continue applying NOP or COMMAND INHIBIT)
+ * PRECHARGE all
+ * 2 AUTO REFRESH COMMANDS (min requirement, more than 2 is also ok)
+ * LOAD MODE REGISTER
+ * SDRAM is ready for operation
+ *
+ ****************************************************************************/
+
+static void lpc31_sdraminitialize(void)
+{
+ uint32_t tmp;
+ uint32_t regval;
+
+ /* These run-time calculations can be reduced dramatically if hclk is
+ * replaced with an apriori value.
+ */
+
+#ifdef CONFIG_LPC31_SDRAMHCLK
+# define HCLK CONFIG_LPC31_SDRAMHCLK
+#else
+ uint32_t hclk = lpc31_clkfreq(CLKID_MPMCCFGCLK2, DOMAINID_SYS);
+# define HCLK hclk
+#endif
+
+ /* Check RTL for divide by 2 possible. If so change then enable the followng logic */
+#if 0
+ uint32_t hclk2 = hclk;
+
+ if (((getreg32(LPC31_MPMC_CONFIG) & MPMC_CONFIG_CLK)) != 0)
+ {
+ hclk2 >>= 1;
+ }
+# define HCLK2 hclk2
+#else
+# define HCLK2 hclk
+#endif
+ up_udelay(100);
+
+ /* Set command delay startergy */
+
+ putreg32(MPMC_DYNREADCONFIG_CMDDEL, LPC31_MPMC_DYNREADCONFIG);
+
+ /* Configure device config register nSDCE0 for proper width SDRAM */
+
+ putreg32((MPMC_DYNCONFIG0_MDSDRAM|MPMC_DYNCONFIG_HP16_32MX16),
+ LPC31_MPMC_DYNCONFIG0);
+ putreg32((MPMC_DYNRASCAS0_RAS2CLK|MPMC_DYNRASCAS0_CAS2CLK),
+ LPC31_MPMC_DYNRASCAS0);
+
+ /* Min 20ns program 1 so that at least 2 HCLKs are used */
+
+ putreg32(NS2HCLKS(EA3152_SDRAM_TRP, HCLK2, MPMC_DYNTRP_MASK),
+ LPC31_MPMC_DYNTRP);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TRAS, HCLK2, MPMC_DYNTRAS_MASK),
+ LPC31_MPMC_DYNTRAS);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TREX, HCLK2, MPMC_DYNTSREX_MASK),
+ LPC31_MPMC_DYNTSREX);
+ putreg32(EA3152_SDRAM_TARP,
+ LPC31_MPMC_DYNTAPR);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TDAL, HCLK2, MPMC_DYNTDAL_MASK),
+ LPC31_MPMC_DYNTDAL);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TWR, HCLK2, MPMC_DYNTWR_MASK),
+ LPC31_MPMC_DYNTWR);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TRC, HCLK2, MPMC_DYNTRC_MASK),
+ LPC31_MPMC_DYNTRC);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TRFC, HCLK2, MPMC_DYNTRFC_MASK),
+ LPC31_MPMC_DYNTRFC);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TXSR, HCLK2, MPMC_DYNTXSR_MASK),
+ LPC31_MPMC_DYNTXSR);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TRRD, HCLK2, MPMC_DYNTRRD_MASK),
+ LPC31_MPMC_DYNTRRD);
+ putreg32(NS2HCLKS(EA3152_SDRAM_TMRD, HCLK2, MPMC_DYNTMRD_MASK),
+ LPC31_MPMC_DYNTMRD);
+ up_udelay(100);
+
+ /* Issue continuous NOP commands */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_INOP),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Load ~200us delay value to timer1 */
+
+ up_udelay(200);
+
+ /* Issue a "pre-charge all" command */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_IPALL),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Minimum refresh pulse interval (tRFC) for MT48LC32M16A2=80nsec,
+ * 100nsec provides more than adequate interval.
+ */
+
+ putreg32(NS2HCLKS(EA3152_SDRAM_REFRESH, HCLK, MPMC_DYNREFRESH_TIMER_MASK),
+ LPC31_MPMC_DYNREFRESH);
+
+ /* Load ~250us delay value to timer1 */
+
+ up_udelay(250);
+
+ /* Recommended refresh interval for normal operation of the Micron
+ * MT48LC16LFFG = 7.8125usec (128KHz rate). ((HCLK / 128000) - 1) =
+ * refresh counter interval rate, (subtract one for safety margin).
+ */
+
+ putreg32(NS2HCLKS(EA3152_SDRAM_OPERREFRESH, HCLK, MPMC_DYNREFRESH_TIMER_MASK),
+ LPC31_MPMC_DYNREFRESH);
+
+ /* Select mode register update mode */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_IMODE),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Program the SDRAM internal mode registers on bank nSDCE0 and reconfigure
+ * the SDRAM chips. Bus speeds up to 90MHz requires use of a CAS latency = 2.
+ * To get correct value on address bus CAS cycle, requires a shift by 13 for
+ * 16bit mode
+ */
+
+ tmp = getreg32(LPC31_EXTSDRAM0_VSECTION | (0x23 << 13));
+
+ putreg32((MPMC_DYNCONFIG0_MDSDRAM|MPMC_DYNCONFIG_HP16_32MX16),
+ LPC31_MPMC_DYNCONFIG0);
+ putreg32((MPMC_DYNRASCAS0_RAS2CLK|MPMC_DYNRASCAS0_CAS2CLK),
+ LPC31_MPMC_DYNRASCAS0);
+
+ /* Select normal operating mode */
+
+ putreg32((MPMC_DYNCONTROL_CE|MPMC_DYNCONTROL_CS|MPMC_DYNCONTROL_INORMAL),
+ LPC31_MPMC_DYNCONTROL);
+
+ /* Enable buffers */
+
+ regval = getreg32(LPC31_MPMC_DYNCONFIG0);
+ regval |= MPMC_DYNCONFIG0_B;
+ putreg32(regval, LPC31_MPMC_DYNCONFIG0);
+
+ putreg32((MPMC_DYNCONTROL_INORMAL|MPMC_DYNCONTROL_CS),
+ LPC31_MPMC_DYNCONTROL);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc31_meminitialize
+ *
+ * Description:
+ * Initialize external memory resources (sram, sdram, nand, nor, etc.)
+ *
+ ****************************************************************************/
+
+void lpc31_meminitialize(void)
+{
+ /* Configure the LCD pins in external bus interface (EBI/MPMC) memory mode.
+ *
+ * LCD_CSB -> MPMC_NSTCS_0
+ * LCD_DB_1 -> MPMC_NSTCS_1
+ * LCD_DB_0 -> MPMC_CLKOUT
+ * LCD_E_RD -> MPMC_CKE
+ * LCD_RS -> MPMC_NDYCS
+ * LCD_RW_WR -> MPMC_DQM_1
+ * LCD_DB_2 -> EBI_A_2
+ * LCD_DB_3 -> EBI_A_3 l
+ * LCD_DB_4 -> EBI_A_4 l
+ * LCD_DB_5 -> EBI_A_5 l
+ * LCD_DB_6 -> EBI_A_6
+ * LCD_DB_7 -> EBI_A_7
+ * LCD_DB_8 -> EBI_A_8
+ * LCD_DB_9 -> EBI_A_9
+ * LCD_DB_10 -> EBI_A_10
+ * LCD_DB_11 -> EBI_A_11
+ * LCD_DB_12 -> EBI_A_12
+ * LCD_DB_13 -> EBI_A_13
+ * LCD_DB_14 -> EBI_A_14
+ * LCD_DB_15 -> EBI_A_15
+ */
+
+ putreg32(SYSCREG_MUX_LCDEBISEL_EBIMPMC, LPC31_SYSCREG_MUX_LCDEBISEL);
+
+ /* Enable EBI clock */
+
+ lpc31_enableclock(CLKID_EBICLK);
+
+ /* Enable MPMC controller clocks */
+
+ lpc31_enableclock(CLKID_MPMCCFGCLK);
+ lpc31_enableclock(CLKID_MPMCCFGCLK2);
+ lpc31_enableclock(CLKID_MPMCCFGCLK3);
+
+ /* Enable the external memory controller */
+
+ putreg32(MPMC_CONTROL_E, LPC31_MPMC_CONTROL);
+
+ /* Force HCLK to MPMC_CLK to 1:1 ratio, little-endian mode */
+
+ putreg32(0, LPC31_MPMC_CONFIG);
+
+ /* Set MPMC delay based on trace lengths between SDRAM and the chip
+ * and on the delay strategy used for SDRAM.
+ */
+
+ putreg32(EA3152_MPMC_DELAY, LPC31_SYSCREG_MPMC_DELAYMODES);
+
+ /* Configure Micron MT48LC32M16A2 SDRAM on the EA3152 board */
+
+ lpc31_sdraminitialize();
+}
+#endif /* CONFIG_LPC31_EXTSDRAM */
diff --git a/nuttx/configs/ea3152/src/up_nsh.c b/nuttx/configs/ea3152/src/up_nsh.c
new file mode 100644
index 000000000..2b523b44a
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_nsh.c
@@ -0,0 +1,165 @@
+/****************************************************************************
+ * config/ea3152/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_LPC31_MCI
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "lpc31_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_EA3152
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LPC31XX boards here */
+
+# error "Unrecognized LPC31XX board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("nsh_archinitialize: Initializing SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the LPC313X10E-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/ea3152/src/up_spi.c b/nuttx/configs/ea3152/src/up_spi.c
new file mode 100644
index 000000000..2dd7b1e23
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_spi.c
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/ea3152/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lpc31_internal.h"
+#include "ea3152_internal.h"
+
+#ifdef CONFIG_LPC31_SPI
+#if 0 /* At present, EA3152 specific logic is hard-coded in the file lpc31_spi.c
+ * in arch/arm/src/lpc31xx */
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the EA3152 board.
+ *
+ ************************************************************************************/
+
+void weak_function lpc31_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI has already been provided. Pin configuration is performed
+ * on-the-fly, so no additional setup is required.
+ */
+}
+
+/************************************************************************************
+ * Name: lpc31_spiselect and lpc31_spistatus
+ *
+ * Description:
+ * The external functions, lpc31_spiselect and lpc31_spistatus must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common LPC31XX logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in lpc31_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide lpc31_spiselect() and lpc31_spistatus() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* 0 */
+#endif /* CONFIG_LPC31_SPI */
+
diff --git a/nuttx/configs/ea3152/src/up_usbmsc.c b/nuttx/configs/ea3152/src/up_usbmsc.c
new file mode 100644
index 000000000..2c3356b4e
--- /dev/null
+++ b/nuttx/configs/ea3152/src/up_usbmsc.c
@@ -0,0 +1,126 @@
+/****************************************************************************
+ * configs/ea3152/src/up_usbmsc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the SAM3U MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <nuttx/fs/fs.h>
+#include <nuttx/fs/mkfatfs.h>
+#include <nuttx/ramdisk.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH1
+# define CONFIG_EXAMPLES_USBMSC_DEVPATH1 "/dev/ram"
+#endif
+
+static const char g_source[] = CONFIG_EXAMPLES_USBMSC_DEVPATH1;
+static struct fat_format_s g_fmt = FAT_FORMAT_INITIALIZER;
+
+#define USBMSC_NSECTORS 64
+#define USBMSC_SECTORSIZE 512
+#define BUFFER_SIZE (USBMSC_NSECTORS*USBMSC_SECTORSIZE)
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ uint8_t *pbuffer;
+ int ret;
+
+ pbuffer = (uint8_t *) malloc (BUFFER_SIZE);
+ if (!pbuffer)
+ {
+ lib_lowprintf ("usbmsc_archinitialize: Failed to allocate ramdisk of size %d\n",
+ BUFFER_SIZE);
+ return -ENOMEM;
+ }
+
+ /* Register a RAMDISK device to manage this RAM image */
+
+ ret = ramdisk_register(CONFIG_EXAMPLES_USBMSC_DEVMINOR1,
+ pbuffer,
+ USBMSC_NSECTORS,
+ USBMSC_SECTORSIZE,
+ true);
+ if (ret < 0)
+ {
+ printf("create_ramdisk: Failed to register ramdisk at %s: %d\n",
+ g_source, -ret);
+ free(pbuffer);
+ return ret;
+ }
+
+ /* Create a FAT filesystem on the ramdisk */
+
+ ret = mkfatfs(g_source, &g_fmt);
+ if (ret < 0)
+ {
+ printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n",
+ g_source);
+ /* free(pbuffer); -- RAM disk is registered */
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/nuttx/configs/ea3152/tools/Makefile b/nuttx/configs/ea3152/tools/Makefile
new file mode 100644
index 000000000..3da818658
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/Makefile
@@ -0,0 +1,53 @@
+############################################################################
+# configs/ea3152/tools/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+OBJS = lpchdr.o crc32.o
+BIN = lpchdr
+
+CFLAGS += -Wall -g
+
+all: $(BIN)
+.PHONY: clean
+
+$(OBJS): %.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+
+lpchdr: $(OBJS)
+ $(CC) -o $@ $^
+
+clean:
+ @rm -f $(BIN) *.o *~
+
+
diff --git a/nuttx/configs/ea3152/tools/armusbocd.cfg b/nuttx/configs/ea3152/tools/armusbocd.cfg
new file mode 100644
index 000000000..5765dda79
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/armusbocd.cfg
@@ -0,0 +1,34 @@
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG A"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15BA 0x0003
+jtag_speed 2
+
+#use combined on interfaces or targets that can't set TRST/SRST separately
+reset_config trst_and_srst separate
+
+#jtag scan chain
+#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
+jtag_device 4 0x1 0xf 0xe
+
+#target configuration
+daemon_startup reset
+
+#target <type> <startup mode>
+#target arm9ejs <reset mode> <chainpos> <endianness> <variant>
+target arm926ejs little run_and_halt 1 arm926ejs
+run_and_halt_time 0 30
+
+#target_script 0 reset oocd_flash2138.script
+working_area 0 0x1102800 0x60000 nobackup
+
+#flash configuration
+#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v2 12000 calc_checksum
+
+# For more information about the configuration files, take a look at:
+# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger
diff --git a/nuttx/configs/ea3152/tools/crc32.c b/nuttx/configs/ea3152/tools/crc32.c
new file mode 100644
index 000000000..1b323fbcb
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/crc32.c
@@ -0,0 +1,123 @@
+/************************************************************************************************
+ * configs/ea3152/tools/crc32.c
+ *
+ * This file is a part of NuttX:
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ *
+ * The logic in this file was developed by Gary S. Brown:
+ *
+ * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or code or tables
+ * extracted from it, as desired without restriction.
+ *
+ * First, the polynomial itself and its table of feedback terms. The polynomial is:
+ *
+ * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
+ *
+ * Note that we take it "backwards" and put the highest-order term in the lowest-order bit.
+ * The X^32 term is "implied"; the LSB is the X^31 term, etc. The X^0 term (usually shown
+ * as "+1") results in the MSB being 1
+ *
+ * Note that the usual hardware shift register implementation, which is what we're using
+ * (we're merely optimizing it by doing eight-bit chunks at a time) shifts bits into the
+ * lowest-order term. In our implementation, that means shifting towards the right. Why
+ * do we do it this way? Because the calculated CRC must be transmitted in order from
+ * highest-order term to lowest-order term. UARTs transmit characters in order from LSB
+ * to MSB. By storing the CRC this way we hand it to the UART in the order low-byte to
+ * high-byte; the UART sends each low-bit to hight-bit; and the result is transmission bit
+ * by bit from highest- to lowest-order term without requiring any bit shuffling on our
+ * part. Reception works similarly
+ *
+ * The feedback terms table consists of 256, 32-bit entries. Notes
+ *
+ * - The table can be generated at runtime if desired; code to do so is shown later. It
+ * might not be obvious, but the feedback terms simply represent the results of eight
+ * shift/xor operations for all combinations of data and CRC register values
+ *
+ * - The values must be right-shifted by eight bits by the updcrc logic; the shift must
+ * be u_(bring in zeroes). On some hardware you could probably optimize the shift in
+ * assembler by using byte-swap instructions polynomial $edb88320
+ ************************************************************************************************/
+
+/************************************************************************************************
+ * Included Files
+ ************************************************************************************************/
+
+#include <sys/types.h>
+#include <stdint.h>
+#include "lpchdr.h"
+
+/************************************************************************************************
+ * Private Data
+ ************************************************************************************************/
+
+static const uint32_t crc32_tab[] =
+{
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+};
+
+/************************************************************************************************
+ * Public Functions
+ ************************************************************************************************/
+/************************************************************************************************
+ * Name: crc32part
+ *
+ * Description:
+ * Continue CRC calculation on a part of the buffer.
+ *
+ ************************************************************************************************/
+
+uint32_t crc32part(const uint8_t *src, size_t len, uint32_t crc32val)
+{
+ size_t i;
+
+ for (i = 0; i < len; i++)
+ {
+ crc32val = crc32_tab[(crc32val ^ src[i]) & 0xff] ^ (crc32val >> 8);
+ }
+ return crc32val;
+}
+
+/************************************************************************************************
+ * Name: crc32
+ *
+ * Description:
+ * Return a 32-bit CRC of the contents of the 'src' buffer, length 'len'
+ *
+ ************************************************************************************************/
+
+uint32_t crc32(const uint8_t *src, size_t len)
+{
+ return crc32part(src, len, 0);
+}
diff --git a/nuttx/configs/ea3152/tools/jlink.cfg b/nuttx/configs/ea3152/tools/jlink.cfg
new file mode 100644
index 000000000..f5ff7c7be
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/jlink.cfg
@@ -0,0 +1,8 @@
+#
+# Segger J-Link
+#
+# http://www.segger.com/jlink.html
+#
+
+interface jlink
+
diff --git a/nuttx/configs/ea3152/tools/lpc3152.cfg b/nuttx/configs/ea3152/tools/lpc3152.cfg
new file mode 100644
index 000000000..6a741b5dc
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/lpc3152.cfg
@@ -0,0 +1,78 @@
+######################################
+# Target: NXP lpc3152
+######################################
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME lpc3152
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+# ARM926EJS core
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ set _CPUTAPID 0x07926f0f
+}
+
+# Scan Tap
+# Wired to seperate STDO pin on the lpc3152, externally muxed to TDO on ea3152 module
+# JTAGSEL pin must be 0 to activate, which reassigns arm tdo to a pass through.
+if { [info exists SJCTAPID ] } {
+ set _SJCTAPID $SJCTAPID
+} else {
+ set _SJCTAPID 0x1392e02b
+}
+
+#jtag newtap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
+jtag newtap $_CHIPNAME sjc -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_SJCTAPID
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+##################################################################
+# various symbol definitions, to avoid hard-wiring addresses
+##################################################################
+
+global lpc315x
+set lpc315x [ dict create ]
+
+# Physical addresses for controllers and memory
+dict set lpc315x sram0 0x11028000
+dict set lpc315x sram1 0x11040000
+dict set lpc315x uart 0x15001000
+dict set lpc315x cgu 0x13004000
+dict set lpc315x ioconfig 0x13003000
+dict set lpc315x sysconfig 0x13002800
+dict set lpc315x wdt 0x13002400
+
+##################################################################
+# Target configuration
+##################################################################
+
+jtag_nsrst_delay 1000
+jtag_ntrst_delay 0
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME
+
+$_TARGETNAME invoke-event halted
+
+$_TARGETNAME configure -work-area-phys [dict get $lpc315x sram0] -work-area-size 0x30000 -work-area-backup 0
+
+$_TARGETNAME configure -event reset-init {
+ echo "\nRunning reset init script for LPC3152\n"
+ halt
+ wait_halt
+ reg cpsr 0xa00000d3 ;#Supervisor mode
+ reg pc 0x11029000
+ poll
+ sleep 500
+}
+
+arm7_9 fast_memory_access enable
+arm7_9 dcc_downloads enable
diff --git a/nuttx/configs/ea3152/tools/lpchdr.c b/nuttx/configs/ea3152/tools/lpchdr.c
new file mode 100644
index 000000000..522ceeedd
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/lpchdr.c
@@ -0,0 +1,297 @@
+/************************************************************************************
+ * configs/ea3152/tools/lpchdr.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "lpchdr.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#define IO_BUF_SIZE 1024
+#define HDR_SIZE 0x80
+#define HDR_CRC_SIZE 0x6c
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+static const char *g_infile;
+static const char *g_outfile;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+static void show_usage(const char *progname, int exitcode)
+{
+ fprintf(stderr, "%s -o <outfile> <infile>\n", progname);
+ exit(exitcode);
+}
+
+static void parse_args(int argc, char **argv)
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, ":o:")) >= 0)
+ {
+ switch (ch)
+ {
+ case 'o':
+ g_outfile = optarg;
+ break;
+
+ case ':':
+ fprintf(stderr, "Missing option argumen\n");
+ show_usage(argv[0], 1);
+
+ case '?':
+ default:
+ fprintf(stderr, "Unrecognized option\n");
+ show_usage(argv[0], 1);
+ }
+ }
+
+ if (optind >= argc)
+ {
+ fprintf(stderr, "Missing binary input file name\n");
+ show_usage(argv[0], 1);
+ }
+
+ g_infile = argv[optind];
+ optind++;
+
+ if (optind < argc)
+ {
+ fprintf(stderr, "Garbage at the end of the command line\n");
+ show_usage(argv[0], 1);
+ }
+}
+
+static inline uint32_t infilecrc32(int infd, size_t len, size_t padlen)
+{
+ off_t offset;
+ uint8_t buffer[IO_BUF_SIZE];
+ ssize_t nbytes;
+ size_t bytesread;
+ uint32_t crc;
+
+ offset = lseek(infd, 0, SEEK_SET);
+ if (offset == (off_t)-1)
+ {
+ fprintf(stderr, "lseek failed: %s\n", strerror(errno));
+ exit(4);
+ }
+
+ crc = 0;
+ for (bytesread = 0; bytesread < len; bytesread += nbytes)
+ {
+ nbytes = read(infd, buffer, IO_BUF_SIZE);
+ if (nbytes < 0)
+ {
+ fprintf(stderr, "read failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbytes == 0)
+ {
+ fprintf(stderr, "Unexpected end-of-file: %s\n", strerror(errno));
+ exit(4);
+ }
+ else
+ {
+ crc = crc32part(buffer, nbytes, crc);
+ }
+ }
+
+ /* Add the zero-padding at the end of the binary in the CRC */
+
+ memset(buffer, 0, IO_BUF_SIZE);
+ return crc32part(buffer, padlen, crc);
+}
+
+static inline void writefile(int infd, int outfd, size_t len, size_t padlen)
+{
+ off_t offset;
+ uint8_t buffer[IO_BUF_SIZE];
+ ssize_t nbytesread;
+ ssize_t nbyteswritten;
+ size_t totalread;
+
+ offset = lseek(infd, 0, SEEK_SET);
+ if (offset == (off_t)-1)
+ {
+ fprintf(stderr, "lseek failed: %s\n", strerror(errno));
+ exit(4);
+ }
+
+ for (totalread = 0; totalread < len; totalread += nbytesread)
+ {
+ nbytesread = read(infd, buffer, IO_BUF_SIZE);
+ if (nbytesread < 0)
+ {
+ fprintf(stderr, "read failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbytesread == 0)
+ {
+ fprintf(stderr, "Unexpected end-of-file: %s\n", strerror(errno));
+ exit(4);
+ }
+ else
+ {
+ nbyteswritten = write(outfd, buffer, nbytesread);
+ if (nbyteswritten < 0)
+ {
+ fprintf(stderr, "write failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbyteswritten != nbytesread)
+ {
+ fprintf(stderr, "Short writes not handled\n");
+ exit(4);
+ }
+ }
+ }
+
+ /* Write the zero-padding at the end of the binary */
+
+ memset(buffer, 0, IO_BUF_SIZE);
+ nbyteswritten = write(outfd, buffer, padlen);
+ if (nbyteswritten < 0)
+ {
+ fprintf(stderr, "write failed: %s\n", strerror(errno));
+ exit(4);
+ }
+ else if (nbyteswritten != padlen)
+ {
+ fprintf(stderr, "Short writes not handled\n");
+ exit(4);
+ }
+}
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+int main(int argc, char **argv, char **envp)
+{
+ struct lpc31_header_s g_hdr;
+ struct stat buf;
+ ssize_t nbytes;
+ size_t padlen;
+ int infd;
+ int outfd;
+ int ret;
+
+ /* Parse arguments */
+
+ parse_args(argc, argv);
+
+ /* Open files */
+
+ infd = open(g_infile, O_RDONLY);
+ if (infd < 0)
+ {
+ fprintf(stderr, "Failed to open %s for reading: %s\n", g_infile, strerror(errno));
+ exit(2);
+ }
+
+ outfd = open(g_outfile, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (outfd < 0)
+ {
+ fprintf(stderr, "Failed to open %s for writing: %s\n", g_outfile, strerror(errno));
+ exit(2);
+ }
+
+ /* Get the size of the binary file */
+
+ ret = fstat(infd, &buf);
+ if (ret < 0)
+ {
+ fprintf(stderr, "stat of %s failed: %s\n", g_infile, strerror(errno));
+ exit(3);
+ }
+
+ /* Initialize the header */
+
+ memset(&g_hdr, 0, sizeof(struct lpc31_header_s));
+ g_hdr.vector = 0xea00001e; /* b 0x11029080 */
+ g_hdr.magic = 0x41676d69;
+#if 1 /* CRC doesn't seem to be functional */
+ g_hdr.imageType = 0x0000000a;
+#else
+ g_hdr.imageType = 0x0000000b;
+#endif
+ g_hdr.imageLength = (buf.st_size + sizeof(struct lpc31_header_s) + 511) & ~0x1ff;
+
+ /* This is how much we must pad at the end of the binary image. */
+
+ padlen = g_hdr.imageLength - buf.st_size;
+
+ /* Calculate CRCs */
+
+ g_hdr.execution_crc32 = infilecrc32(infd, buf.st_size, padlen);
+ g_hdr.header_crc32 = crc32((const uint8_t*)&g_hdr, HDR_CRC_SIZE);
+
+ /* Write the header */
+
+ nbytes = write(outfd, &g_hdr, HDR_SIZE);
+ if (nbytes != 0x80)
+ {
+ fprintf(stderr, "write of header to of %s failed: %s\n", g_outfile, strerror(errno));
+ exit(4);
+ }
+
+ /* Copy the input file to the output */
+
+ writefile(infd, outfd, buf.st_size, padlen);
+ close(infd);
+ close(outfd);
+ return 0;
+}
+
+
diff --git a/nuttx/configs/ea3152/tools/lpchdr.h b/nuttx/configs/ea3152/tools/lpchdr.h
new file mode 100644
index 000000000..33aa4eae0
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/lpchdr.h
@@ -0,0 +1,105 @@
+/************************************************************************************
+ * configs/ea3152/tools/lpchdr.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EA3152_TOOLS_LPCHDR_H
+#define __CONFIGS_EA3152_TOOLS_LPCHDR_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+struct lpc31_header_s
+{
+ /* OFFS DESCRIPTION */
+ uint32_t vector; /* 0x00 Valid ARM instruction. Usually this will be
+ * a branch instruction to entry point of the
+ * image. */
+ uint32_t magic; /* 0x04 This field is used by boot ROM to detect a
+ * valid image header. This field should always
+ * be set to 0x41676d69. */
+ uint32_t execution_crc32; /* 0x08 CRC32 value of execution part of the image. If
+ * the ‘image_type’ is set to ‘0xA’, this field
+ * is ignored by boot ROM. */
+ uint32_t Reserved0[4]; /* 0x0c-0x18: Should be zero. */
+ uint32_t imageType; /* 0x1c Specifies whether CRC check should be done
+ * on the image or not:
+ * 0xA – No CRC check required.
+ * 0xB – Do CRC32 check on both header and
+ * execution part of the image. */
+ uint32_t imageLength; /* 0x20 Total image length including header rounded
+ * up to the nearest 512 byte boundary. In C
+ * language the field can be computed as:
+ * imageLength = (Actual length + 511) & ~0x1FF; */
+ uint32_t releaseID; /* 0x24 Release or version number of the image. Note,
+ * this field is not used by boot ROM but is
+ * provided to track the image versions. */
+ uint32_t buildTime; /* 0x28 Time (expressed in EPOC time format) at which
+ * image is built. Note, this field is not used
+ * by boot ROM but is provided to track the image
+ * versions. */
+ uint32_t sbzBootParameter; /* 0x2c hould be zero. */
+ uint32_t cust_reserved[15]; /* 0x30-0x68: Reserved for customer use (60 bytes) */
+ uint32_t header_crc32; /* 0x6c CRC32 value of the header (bytes 0x00 to 0x6C
+ * of the image). If the ‘image_type’ is set
+ * to ‘0xA’, this field is ignored by boot ROM. */
+ uint32_t Reserved1[4]; /* 0x70-0x7c: Should be zero. */
+ /* 0x80 Start of program code (128Kb max). The final
+ * image has to be padded to the nearest 512
+ * byte boundary */
+};
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+extern uint32_t crc32part(const uint8_t *src, size_t len, uint32_t crc32val);
+extern uint32_t crc32(const uint8_t *src, size_t len);
+
+#endif /* __CONFIGS_EA3152_TOOLS_LPCHDR_H */
+
diff --git a/nuttx/configs/ea3152/tools/mklpc.sh b/nuttx/configs/ea3152/tools/mklpc.sh
new file mode 100755
index 000000000..282c56f64
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/mklpc.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# This script lies in sub-directory configs/ea3152/tools but make be executed
+# from either that directory or TOPDIR
+
+MYNAME=`basename $0`
+if [ -x "$PWD/$MYNAME" ]; then
+ TOPDIR="$PWD/../../.."
+else
+ if [ -x "$PWD/configs/ea3152/tools/$MYNAME" ]; then
+ TOPDIR="$PWD"
+ else
+ echo "This script must be executed from a known director"
+ exit 1
+ fi
+fi
+echo "TOOLDIR: $TOOLDIR"
+
+# The lpchdr could be named lpchdr.exe if we are running under Cygwin or
+# just lpchdr under Linux
+
+TOOLDIR=$TOPDIR/configs/ea3152/tools
+
+if [ ! -d "$TOOLDIR" ]; then
+ echo "Tool directory $TOOLDIR does not exist"
+ exit 1
+fi
+
+if [ -x "$TOOLDIR/lpchdr.exe" ]; then
+ LPCHDR="$TOOLDIR/lpchdr.exe"
+else
+ if [ -x "$TOOLDIR/lpchdr" ]; then
+ LPCHDR="$TOOLDIR/lpchdr"
+ else
+ echo "lpchdr executable does not exist in $TOODIR"
+ echo " - cd $TOOLDIR"
+ echo " - make"
+ fi
+fi
+echo "LPCHDR: $LPCHDR"
+
+# Now get the path to the NuttX executable
+
+NUTTXPATH="$TOPDIR/nuttx.bin"
+
+if [ ! -f "$NUTTXPATH" ]; then
+ echo "NuttX binary does not exist at $NUTTXPATH"
+ echo " - cd $TOPDIR"
+ echo " - make"
+ exit 1
+fi
+echo "NUTTXPATH: $NUTTXPATH"
+
+# Create the binary
+
+echo "COMMAND: $LPCHDR -o $TOPDIR/nuttx.lpc $NUTTXPATH"
+"$LPCHDR" -o "$TOPDIR/nuttx.lpc" "$NUTTXPATH" || \
+ { echo "$LPCHDR failed" ; exit 1 ; }
+echo "Successfully created binary"
+
diff --git a/nuttx/configs/ea3152/tools/olimex-arm-usb-ocd.cfg b/nuttx/configs/ea3152/tools/olimex-arm-usb-ocd.cfg
new file mode 100644
index 000000000..ef2964708
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/olimex-arm-usb-ocd.cfg
@@ -0,0 +1,12 @@
+#
+# Olimex ARM-USB-OCD
+#
+# http://www.olimex.com/dev/arm-usb-ocd.html
+#
+
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG B"
+ft2232_layout olimex-jtag
+ft2232_vid_pid 0x15ba 0x0003
+
+#jtag_khz 600
diff --git a/nuttx/configs/ea3152/tools/oocd.sh b/nuttx/configs/ea3152/tools/oocd.sh
new file mode 100755
index 000000000..1a137b0fd
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/oocd.sh
@@ -0,0 +1,169 @@
+#!/bin/sh
+
+# Get command line parameters
+
+USAGE="USAGE: $0 [-dhjo14] <TOPDIR>"
+ADVICE="Try '$0 -h' for more information"
+
+INTERFACE=Olimex
+OPENOCD=0.1.0
+
+while [ ! -z "$1" ]; do
+ case $1 in
+ -d )
+ set -x
+ ;;
+ -j )
+ INTERFACE=Jlink
+ ;;
+ -o )
+ INTERFACE=Olimex
+ ;;
+ -1 )
+ OPENOCD=0.1.0
+ ;;
+ -4 )
+ OPENOCD=0.4.0
+ ;;
+ -h )
+ echo "$0 is a tool for generation of proper version files for the NuttX build"
+ echo ""
+ echo $USAGE
+ echo ""
+ echo "Where:"
+ echo " -d"
+ echo " Enable script debug"
+ echo " -h"
+ echo " show this help message and exit"
+ echo " -j"
+ echo " Use the Segger J-link interface"
+ echo " -o"
+ echo " Use the Olimex ARM USB OCD interface (Default)"
+ echo " -1"
+ echo " Use the Olimex GCCFD OpenOCD 0.1.0 (Default)"
+ echo " -4"
+ echo " Use the OpenOCD 0.4.0"
+ echo " <TOPDIR>"
+ echo " The full path to the top-level NuttX directory"
+ exit 0
+ ;;
+ * )
+ break;
+ ;;
+ esac
+ shift
+done
+
+TOPDIR=$1
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ echo $ADVICE
+ exit 1
+fi
+
+###############################################################################
+# OpenOCD 0.4.0 ###############################################################
+###############################################################################
+# This script *probably* only works with the following versions of OpenOCD:
+
+if [ "X${OPENOCD}" = "X0.4.0" ]; then
+
+ # Local search directory and configurations
+
+ OPENOCD_SEARCHDIR="${TOPDIR}/configs/ea3152/tools"
+ OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`"
+
+ if [ "X${INTERFACE}" = "XJlink" ]; then
+ OPENOCD_PATH="/cygdrive/c/Program Files (x86)/OpenOCD/0.4.0/bin"
+ OPENOCD_EXE=openocd.exe
+ OPENOCD_INTERFACE="jlink.cfg"
+ else
+ OPENOCD_PATH="/cygdrive/c/OpenOCD/openocd-0.4.0/src"
+ OPENOCD_EXE=openocd.exe
+ OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg"
+ fi
+
+ OPENOCD_TARGET="lpc3152.cfg"
+ OPENOCD_ARGS="-s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}"
+
+ echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+
+ # Verify that everything is what it claims it is and is located where it claims it is.
+
+ if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then
+ echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+ fi
+ if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}" ]; then
+ echo "OpenOCD target config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}"
+ exit 1
+ fi
+ if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}" ]; then
+ echo "OpenOCD interface config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}"
+ exit 1
+ fi
+
+###############################################################################
+
+###############################################################################
+# Older OpenOCD that Shipped with the ARM-OCD JTAG ############################
+###############################################################################
+
+else
+ if [ "X${OPENOCD}" = "X0.1.0" ]; then
+
+ OPENOCD_PATH="/cygdrive/c/gccfd/openocd/bin"
+ OPENOCD_EXE=openocd-ftd2xx.exe
+
+ echo "Trying GCCFD OpenOCD 0.1.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+
+ # Local search directory and configurations
+
+ if [ "X${INTERFACE}" = "XJlink" ]; then
+ echo "The Olimex OpenOCD doesn't support J-Link"
+ exit 1
+ fi
+
+ OPENOCD_CFG="${TOPDIR}/configs/ea3152/tools/armusbocd.cfg"
+ OPENOCD_ARGS="-f `cygpath -w ${OPENOCD_CFG}`"
+
+ # Verify that everything is what it claims it is and is located where it claims it is.
+
+ if [ ! -f ${OPENOCD_CFG} ]; then
+ echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
+ exit 1
+ fi
+ if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then
+ echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+ fi
+ if [ ! -d "${OPENOCD_PATH}" ]; then
+ echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
+ exit 1
+ fi
+ if [ ! -f ${OPENOCD_CFG} ]; then
+ echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
+ exit 1
+ fi
+ else
+ echo "Unsupported OpenOCD version"
+ echo $ADVICE
+ exit 1
+ fi
+fi
+
+# Enable debug if so requested
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+# Okay... do it!
+
+echo "Starting OpenOCD"
+"${OPENOCD_PATH}/${OPENOCD_EXE}" ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
diff --git a/nuttx/configs/ea3152/tools/usb-driver.txt b/nuttx/configs/ea3152/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/ea3152/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/eagle100/Kconfig b/nuttx/configs/eagle100/Kconfig
new file mode 100644
index 000000000..40b9f8294
--- /dev/null
+++ b/nuttx/configs/eagle100/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_EAGLE100
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/eagle100/README.txt b/nuttx/configs/eagle100/README.txt
new file mode 100644
index 000000000..28d51b518
--- /dev/null
+++ b/nuttx/configs/eagle100/README.txt
@@ -0,0 +1,373 @@
+README
+^^^^^^
+
+README file for the Microment Eagle100 NuttX port.
+
+References:
+^^^^^^^^^^
+
+ Micromint: http://www.micromint.com/
+ Luminary: http://www.luminarymicro.com/
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Luminary FLASH programming application was used for
+ writing to FLASH and this application works only under Windows.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain, or
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM GNU toolchain, you simply need to build the
+ system as follows:
+
+ make # Will build for the devkitARM toolchain
+ make CROSSDEV=arm-eabi- # Will build for the devkitARM toolchain
+ make CROSSDEV=arm-none-eabi- # Will build for the CodeSourcery toolchain
+ make CROSSDEV=arm-elf- # Will build for the NuttX buildroot toolchain
+
+ Of course, hard coding this CROSS_COMPILE value in Make.defs file will save
+ some repetitive typing.
+
+ NOTE: the CodeSourcery and devkitARM toolchains are Windows native toolchains.
+ The NuttX buildroot toolchain is a Cygwin toolchain. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context; make CROSSDEV=arm-none-eabi-
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the CodeSourcery toolchain.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make. It has been reported to me that the
+ devkitARM will require an lower optimization level of -O1. Currently all of the
+ Make.def files have -O2 for devkitARM -- if you are using this toolchain, you may
+ need to review these settings.
+
+CodeSourcery on Linux
+^^^^^^^^^^^^^^^^^^^^^
+
+ If you select the CodeSourcery toolchain, the make system will assume that you
+ are running a Windows version of the toolchain. If you are running under Linux,
+ the the make will probably fail. The fix is to edit your Make.defs file and
+ use something like:
+
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = n
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+ MAXOPTIMIZATION = -O2
+
+ The values for TOPDIR is provided by the make system; the value for CONFIG_ARCH_BOARD
+ is provided in your defconfig file. 'ostest' refers to the ostest/ configuration;
+ this would be different for other configurations.
+
+ For an example of a CodeSourcery-under-Linux Make.defs file, see
+ configs/stm3210e-eval/nsh/Make.defs.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh eagle100/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+Ethernet-Bootloader
+^^^^^^^^^^^^^^^^^^^
+
+ Here are some notes about using the Luminary Ethernet boot-loader built
+ into the Eagle-100 board.
+
+ Built-In Application:
+
+ - The board has no fixed IP address but uses DHCP to get an address.
+ I used a D-link router; I can use a web browser to surf to the D-link
+ web page to get the address assigned by
+
+ - Then you can use this IP address in your browser to surf to the Eagle-100
+ board. It presents several interesting pages -- the most important is
+ the page called "Firmware Update". That page includes instructions on
+ how to download code to the Eagle-100.
+
+ - After you burn the first program, you lose this application. Then you
+ will probably be better off connected directly to the Eagle-100 board
+ or through a switch (The router caused problems for me during downloads).
+
+ Using the Ethernet Bootloader:
+
+ - You will need the "LM Flash Programmer application". You can get that
+ program from the Luminary web site. There is a link on the LM3S6918 page.
+
+ - Is there any documentation for using the bootloader? Yes and No: There
+ is an application note covering the bootloader on the Luminary site, but
+ it is not very informative. The Eagle100 User's Manual has the best
+ information.
+
+ - Are there any special things I have to do in my code, other than setting
+ the origin to 0x0000:2000 (APP_START_ADDRESS)? No. The bootloader assumes
+ that you have a vector table at that address . The bootloader does the
+ following each time it boots (after you have downloaded the first valid
+ application):
+
+ o The bootloader sets the vector table register to the APP_START_ADDRESS,
+ o It sets the stack pointer to the address at APP_START_ADDRESS, and then
+ o Jumps to the address at APP_START_ADDRESS+4.
+
+ - You can force the bootloader to skip starting the application and stay
+ in the update mode. You will need to do this in order to download a new
+ application. You force the update mode by holding the user button on the
+ Eagle-100 board while resetting the board. The user button is GPIOA, pin 6
+ (call FORCED_UPDATE_PIN in the bootloader code).
+
+ - Note 1: I had to remove my D-Link router from the configuration in order
+ to use the LM Flash Programmer (the Bootloader issues BOOTP requests to
+ communicate with the LM Flash Programmer, my router was responding to
+ these BOOTP requests and hosing the download). It is safer to connect
+ via a switch or via an Ethernet switch.
+
+ - Note 2: You don't need the router's DHCPD server in the download
+ configuration; the Luminary Flash Programmer has the capability of
+ temporarily assigning the IP address to the Eagle-100 via BOOTP.
+
+Eagle100-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lm3s
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LM3S6918
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=eagle100 (for the MicroMint Eagle-100 development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_EAGLE100
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_BOOTLOADER - Configure to use the MicroMint Eagle-100
+ Ethernet bootloader.
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ There are configurations for disabling support for interrupts GPIO ports.
+ GPIOH and GPIOJ must be disabled because they do not exist on the LM3S6918.
+ Additional interrupt support can be disabled if desired to reduce memory
+ footprint.
+
+ CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+ LM3S6818 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ CONFIG_SSI0_DISABLE - Select to disable support for SSI0
+ CONFIG_SSI1_DISABLE - Select to disable support for SSI1
+ CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support.
+ Poll-waiting is recommended if the interrupt rate would be to
+ high in the interrupt driven case.
+ CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before
+ emptying the Rx FIFO. If the SPI frequency is high and this
+ value is large, then larger values of this setting may cause
+ Rx FIFO overrun errors. Default: half of the Tx FIFO size (4).
+
+ CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
+ to build the LM3S Ethernet driver
+ CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
+ CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide
+ a MAC address (via lm3s_ethernetmac()), then this should be selected.
+ CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation
+ CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation
+ CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding
+ CONFIG_LM3S_MULTICAST - Set to enable multicast frames
+ CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode
+ CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection.
+ CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Eagle-100 configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh eagle100/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nettest:
+ This configuration directory may be used to enable networking using the
+ LM3S6918's Ethernet controller. It uses examples/nettest to excercise the
+ TCP/IP network.
+
+ httpd:
+ This builds the uIP web server example using the examples/uip application
+ (for execution from FLASH). See examples/README.txt for information
+ about ostest.
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interfaces (the telnet
+ interface should also be functional, but is not enabled in this
+ configuration).
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+ thttpd:
+ This builds the THTTPD web server example using the THTTPD and
+ the examples/thttpd application.
+
+By default, all of these examples are built to be used with the Luminary
+Ethernet Bootloader (you can change the ld.script file in any of these
+sub-directories to change that configuration).
+
+
diff --git a/nuttx/configs/eagle100/httpd/Make.defs b/nuttx/configs/eagle100/httpd/Make.defs
new file mode 100644
index 000000000..6d9f86db5
--- /dev/null
+++ b/nuttx/configs/eagle100/httpd/Make.defs
@@ -0,0 +1,149 @@
+############################################################################
+# configs/eagle100/httpd/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/httpd/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/httpd/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/httpd/appconfig b/nuttx/configs/eagle100/httpd/appconfig
new file mode 100644
index 000000000..fbb81805d
--- /dev/null
+++ b/nuttx/configs/eagle100/httpd/appconfig
@@ -0,0 +1,46 @@
+############################################################################
+# configs/eagle100/httpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/uip
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webserver
diff --git a/nuttx/configs/eagle100/httpd/defconfig b/nuttx/configs/eagle100/httpd/defconfig
new file mode 100644
index 000000000..3ad922097
--- /dev/null
+++ b/nuttx/configs/eagle100/httpd/defconfig
@@ -0,0 +1,343 @@
+############################################################################
+# configs/eagle100/httpd/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD="eagle100"
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Disable support for interrupts on GPIOJ which does not
+# exist on the LM3S6918. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="uip_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=20
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for netutils/httpd
+#
+CONFIG_NETUTILS_HTTPDSTACKSIZE=2048
+CONFIG_NETUTILS_HTTPDFILESTATS=y
+CONFIG_NETUTILS_HTTPDNETSTATS=y
+CONFIG_NETUTILS_HTTPD_DUMPBUFFER=n
+CONFIG_NETUTILS_HTTPD_DUMPPSTATE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/dhcpd
+#
+CONFIG_EXAMPLE_DHCPD_NOMAC=y
+CONFIG_EXAMPLE_DHCPD_IPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/httpd/ld.script b/nuttx/configs/eagle100/httpd/ld.script
new file mode 100644
index 000000000..24e9c90b7
--- /dev/null
+++ b/nuttx/configs/eagle100/httpd/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/eagle100/httpd/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/httpd/setenv.sh b/nuttx/configs/eagle100/httpd/setenv.sh
new file mode 100755
index 000000000..e17655b0a
--- /dev/null
+++ b/nuttx/configs/eagle100/httpd/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/httpd/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/eagle100/include/README.txt b/nuttx/configs/eagle100/include/README.txt
new file mode 100644
index 000000000..eb6438a9e
--- /dev/null
+++ b/nuttx/configs/eagle100/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the MicroMint Eagle-100 development board.
diff --git a/nuttx/configs/eagle100/include/board.h b/nuttx/configs/eagle100/include/board.h
new file mode 100644
index 000000000..40a12327f
--- /dev/null
+++ b/nuttx/configs/eagle100/include/board.h
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/eagle100/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* RCC settings */
+
+#define SYSCON_RCC_XTAL SYSCON_RCC_XTAL8000KHZ /* Eagle100 on-board crystall is 8.00 MHz */
+#define XTAL_FREQUENCY 8000000
+
+/* Oscillator source is the main oscillator (not internal, internal/4, 30KHz or
+ * 30KHz from hibernate module) */
+
+#define SYSCON_RCC_OSCSRC SYSCON_RCC_OSCSRC_MOSC
+#define SYSCON_RCC2_OSCSRC SYSCON_RCC2_OSCSRC2_MOSC
+#define OSCSRC_FREQUENCY XTAL_FREQUENCY
+
+/* Use system divider = 4; this corresponds to a system clock frequency
+ * of (400 / 2) / 4 = 50MHz
+ */
+
+#define LM3S_SYSDIV 4
+#define SYSCLK_FREQUENCY 50000000 /* 50MHz */
+
+/* Other RCC settings:
+ *
+ * - Main and internal oscillators enabled.
+ * - PLL and sys dividers not bypassed
+ * - PLL not powered down
+ * - No auto-clock gating reset
+ */
+
+#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV))
+
+/* RCC2 settings -- RCC2 not used. Other RCC2 settings
+ *
+ * - PLL and sys dividers not bypassed.
+ * - PLL not powered down
+ * - Not using RCC2
+ */
+
+#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV))
+
+/* LED definitions ******************************************************************/
+
+/* The Eagle-100 has only one user LED: Port E, Bit 1. Below is the mapping of this
+ * single LED. From this single LED, we can get the following information:
+ *
+ * OFF Steady: The system has failed to boot to the point of enabling interrupts
+ * ON Steady: The systems has enabled interrupts, but none have been received
+ * Dull glow: The system is taking interrupts
+ * Slow blinking: The system has panicked
+ */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* OFF OFF */
+#define LED_IRQSENABLED 2 /* ON ON */
+#define LED_STACKCREATED 3 /* ON ON */
+#define LED_INIRQ 4 /* ON OFF */
+#define LED_SIGNAL 5 /* ON OFF */
+#define LED_ASSERTION 6 /* ON OFF */
+#define LED_PANIC 7 /* ON OFF */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+extern void lm3s_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+struct ether_addr;
+extern void lm3s_ethernetmac(struct ether_addr *ethaddr);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/eagle100/nettest/Make.defs b/nuttx/configs/eagle100/nettest/Make.defs
new file mode 100644
index 000000000..2bfabeade
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/Make.defs
@@ -0,0 +1,149 @@
+############################################################################
+# configs/eagle100/nettest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/nettest/appconfig b/nuttx/configs/eagle100/nettest/appconfig
new file mode 100644
index 000000000..e5ff507b8
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/eagle100/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/eagle100/nettest/defconfig b/nuttx/configs/eagle100/nettest/defconfig
new file mode 100644
index 000000000..78994b11e
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/defconfig
@@ -0,0 +1,326 @@
+############################################################################
+# configs/eagle100/nettest/defconfig
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD="eagle100"
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Disable support for interrupts on GPIOJ which does not
+# exist on the LM3S6918. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=20
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/nettest/ld.script b/nuttx/configs/eagle100/nettest/ld.script
new file mode 100644
index 000000000..4997200af
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/eagle100/nettest/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/nettest/setenv.sh b/nuttx/configs/eagle100/nettest/setenv.sh
new file mode 100755
index 000000000..ce89c68aa
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/nettest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/eagle100/nsh/Make.defs b/nuttx/configs/eagle100/nsh/Make.defs
new file mode 100644
index 000000000..066b00cee
--- /dev/null
+++ b/nuttx/configs/eagle100/nsh/Make.defs
@@ -0,0 +1,149 @@
+############################################################################
+# configs/eagle100/nsh/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/nsh/appconfig b/nuttx/configs/eagle100/nsh/appconfig
new file mode 100644
index 000000000..dafc33b8a
--- /dev/null
+++ b/nuttx/configs/eagle100/nsh/appconfig
@@ -0,0 +1,57 @@
+############################################################################
+# configs/eagle100/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
diff --git a/nuttx/configs/eagle100/nsh/defconfig b/nuttx/configs/eagle100/nsh/defconfig
new file mode 100644
index 000000000..fb2fcf5ff
--- /dev/null
+++ b/nuttx/configs/eagle100/nsh/defconfig
@@ -0,0 +1,328 @@
+############################################################################
+# configs/eagle100/nsh/defconfig
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD="eagle100"
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Disable support for interrupts on GPIOJ which does not
+# exist on the LM3S6918. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_FS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/nsh/ld.script b/nuttx/configs/eagle100/nsh/ld.script
new file mode 100644
index 000000000..cdf1a4110
--- /dev/null
+++ b/nuttx/configs/eagle100/nsh/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/eagle100/nsh/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/nsh/setenv.sh b/nuttx/configs/eagle100/nsh/setenv.sh
new file mode 100755
index 000000000..93396cb73
--- /dev/null
+++ b/nuttx/configs/eagle100/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/nsh/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/eagle100/nxflat/Make.defs b/nuttx/configs/eagle100/nxflat/Make.defs
new file mode 100644
index 000000000..2cd0a3b6c
--- /dev/null
+++ b/nuttx/configs/eagle100/nxflat/Make.defs
@@ -0,0 +1,152 @@
+############################################################################
+# configs/eagle100/nxflat/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxflat/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxflat/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/nxflat/appconfig b/nuttx/configs/eagle100/nxflat/appconfig
new file mode 100644
index 000000000..44dc4bf96
--- /dev/null
+++ b/nuttx/configs/eagle100/nxflat/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/eagle100/nxflat/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxflat
+
diff --git a/nuttx/configs/eagle100/nxflat/defconfig b/nuttx/configs/eagle100/nxflat/defconfig
new file mode 100644
index 000000000..7befde172
--- /dev/null
+++ b/nuttx/configs/eagle100/nxflat/defconfig
@@ -0,0 +1,329 @@
+############################################################################
+# configs/eagle100/nxflat/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD="eagle100"
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Disable support for interrupts on GPIOJ which does not
+# exist on the LM3S6918. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxflat_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_BINFMT=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# Settings for examples/nxflat
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/nxflat/ld.script b/nuttx/configs/eagle100/nxflat/ld.script
new file mode 100644
index 000000000..153e777b5
--- /dev/null
+++ b/nuttx/configs/eagle100/nxflat/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/eagle100/nxflat/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/nxflat/setenv.sh b/nuttx/configs/eagle100/nxflat/setenv.sh
new file mode 100755
index 000000000..39afe386f
--- /dev/null
+++ b/nuttx/configs/eagle100/nxflat/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/nxflat/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/eagle100/ostest/Make.defs b/nuttx/configs/eagle100/ostest/Make.defs
new file mode 100644
index 000000000..1694942a8
--- /dev/null
+++ b/nuttx/configs/eagle100/ostest/Make.defs
@@ -0,0 +1,149 @@
+############################################################################
+# configs/eagle100/ostest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/ostest/appconfig b/nuttx/configs/eagle100/ostest/appconfig
new file mode 100644
index 000000000..1be133dec
--- /dev/null
+++ b/nuttx/configs/eagle100/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/eagle100/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/eagle100/ostest/defconfig b/nuttx/configs/eagle100/ostest/defconfig
new file mode 100644
index 000000000..6bcde74b9
--- /dev/null
+++ b/nuttx/configs/eagle100/ostest/defconfig
@@ -0,0 +1,323 @@
+############################################################################
+# configs/eagle100/ostest/defconfig
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD="eagle100"
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Disable support for interrupts on GPIOJ which does not
+# exist on the LM3S6918. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/ostest/ld.script b/nuttx/configs/eagle100/ostest/ld.script
new file mode 100644
index 000000000..10c2f0cfa
--- /dev/null
+++ b/nuttx/configs/eagle100/ostest/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/eagle100/ostest/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/ostest/setenv.sh b/nuttx/configs/eagle100/ostest/setenv.sh
new file mode 100755
index 000000000..c3c1f581d
--- /dev/null
+++ b/nuttx/configs/eagle100/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/eagle100/ostest/test-result.txt b/nuttx/configs/eagle100/ostest/test-result.txt
new file mode 100644
index 000000000..74b3bc80d
--- /dev/null
+++ b/nuttx/configs/eagle100/ostest/test-result.txt
@@ -0,0 +1,427 @@
+May 19, 2009. Console output from running examples/ostest on the Eagle-100
+===========================================================================
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve1 finished
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 2, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1a0 b1a0
+ordblks 2 2
+mxordblk 8660 8660
+uordblks 1d10 1d10
+fordblks 9490 9490
+user_main: Exitting
diff --git a/nuttx/configs/eagle100/src/Makefile b/nuttx/configs/eagle100/src/Makefile
new file mode 100644
index 000000000..123aa8139
--- /dev/null
+++ b/nuttx/configs/eagle100/src/Makefile
@@ -0,0 +1,86 @@
+############################################################################
+# configs/eagle100/src/Makefile
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_ethernet.c up_ssi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/eagle100/src/README.txt b/nuttx/configs/eagle100/src/README.txt
new file mode 100644
index 000000000..6e3fe1506
--- /dev/null
+++ b/nuttx/configs/eagle100/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the MicroMint Eagle-100 development board.
diff --git a/nuttx/configs/eagle100/src/eagle100_internal.h b/nuttx/configs/eagle100/src/eagle100_internal.h
new file mode 100644
index 000000000..88d2bf3b0
--- /dev/null
+++ b/nuttx/configs/eagle100/src/eagle100_internal.h
@@ -0,0 +1,106 @@
+/************************************************************************************
+ * configs/eagle100/src/eagle100_internal.h
+ * arch/arm/src/board/eagle100_internal.n
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EAGLE100_SRC_EAGLE100_INTERNAL_H
+#define __CONFIGS_EAGLE100_SRC_EAGLE100_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S6918 supports 2 SSI
+ * modules (others may support more -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#elif LM3S_NSSI == 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#endif
+
+/* Eagle-100 GPIOs ******************************************************************/
+
+/* GPIO for microSD card chip select */
+
+#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTG | 1)
+#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | 1)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Eagle100 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+/****************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Initialize on-board LEDs.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void up_ledinit(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_EAGLE100_SRC_EAGLE100_INTERNAL_H */
+
diff --git a/nuttx/configs/eagle100/src/up_boot.c b/nuttx/configs/eagle100/src/up_boot.c
new file mode 100644
index 000000000..44f003e0b
--- /dev/null
+++ b/nuttx/configs/eagle100/src/up_boot.c
@@ -0,0 +1,91 @@
+/************************************************************************************
+ * configs/eagle100/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "eagle100_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void lm3s_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
+
+/* The Eagle100 microSD CS is on SSI0 */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/eagle100/src/up_ethernet.c b/nuttx/configs/eagle100/src/up_ethernet.c
new file mode 100644
index 000000000..a071fcca9
--- /dev/null
+++ b/nuttx/configs/eagle100/src/up_ethernet.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/eagle100/src/up_ethernet.c
+ * arch/arm/src/board/up_ethernet.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <arch/board/board.h>
+#include <net/ethernet.h>
+
+#include "up_arch.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+void lm3s_ethernetmac(struct ether_addr *ethaddr)
+{
+ uint32_t user0;
+ uint32_t user1;
+
+ /* Get the current value of the user registers */
+
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
+
+ nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff);
+ DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff);
+
+ /* Re-format that MAC address the way that uIP expects to see it */
+
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
+}
+#endif
diff --git a/nuttx/configs/eagle100/src/up_leds.c b/nuttx/configs/eagle100/src/up_leds.c
new file mode 100644
index 000000000..59b489c11
--- /dev/null
+++ b/nuttx/configs/eagle100/src/up_leds.c
@@ -0,0 +1,171 @@
+/****************************************************************************
+ * configs/eagle100/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "eagle100_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_DEBUG
+# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+static uint8_t g_nest;
+
+/****************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Initialize on-board LEDs.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ leddbg("Initializing\n");
+
+ /* Configure Port E, Bit 1 as an output, initial value=OFF */
+
+ led_dumpgpio("up_ledinit before lm3s_configgpio()");
+ lm3s_configgpio(LED_GPIO);
+ led_dumpgpio("up_ledinit after lm3s_configgpio()");
+ g_nest = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, false);
+ led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ if (--g_nest <= 0)
+ {
+ led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, true);
+ led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
+ }
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/eagle100/src/up_nsh.c b/nuttx/configs/eagle100/src/up_nsh.c
new file mode 100644
index 000000000..65fd30023
--- /dev/null
+++ b/nuttx/configs/eagle100/src/up_nsh.c
@@ -0,0 +1,159 @@
+/****************************************************************************
+ * config/eagle100/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_EAGLE100
+# undef NSH_HAVEUSBDEV
+# define NSH_HAVEMMCSD 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 0
+# error "The Eagle100 MMC/SD is on SSI0"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 0
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The Eagle100 MMC/SD is on SSI0 slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LM3s boards here */
+# error "Unrecognized lm3s board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("nsh_archinitialize: Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/eagle100/src/up_ssi.c b/nuttx/configs/eagle100/src/up_ssi.c
new file mode 100644
index 000000000..fb5f99df3
--- /dev/null
+++ b/nuttx/configs/eagle100/src/up_ssi.c
@@ -0,0 +1,152 @@
+/************************************************************************************
+ * configs/eagle100/src/up_ssi.c
+ * arch/arm/src/board/up_ssi.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lm3s_internal.h"
+#include "eagle100_internal.h"
+
+/* The Eagle100 microSD CS is on SSI0 */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSI_DEBUG /* Define to enable debug */
+#undef SSI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# ifdef SSI_VERBOSE
+# define ssivdbg lldbg
+# else
+# define ssivdbg(x...)
+# endif
+#else
+# undef SSI_VERBOSE
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_VERBOSE
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssi_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Eagle100 board.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssi_dumpgpio("lm3s_ssiinitialize() before lm3s_configgpio()");
+ lm3s_configgpio(SDCCS_GPIO);
+ ssi_dumpgpio("lm3s_ssiinitialize() after lm3s_configgpio()");
+}
+
+/****************************************************************************
+ * The external functions, lm3s_spiselect and lm3s_spistatus must be provided
+ * by board-specific logic. The are implementations of the select and status
+ * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ * All othermethods (including up_spiinitialize()) are provided by common
+ * logic. To use this common SPI logic on your board:
+ *
+ * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your
+ * board-specific logic. This function will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 2. Add a call to up_spiinitialize() in your low level initialization
+ * logic
+ * 3. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ ssi_dumpgpio("lm3s_spiselect() before lm3s_gpiowrite()");
+ lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ ssi_dumpgpio("lm3s_spiselect() after lm3s_gpiowrite()");
+ }
+}
+
+uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */
diff --git a/nuttx/configs/eagle100/thttpd/Make.defs b/nuttx/configs/eagle100/thttpd/Make.defs
new file mode 100644
index 000000000..cbc3b4a92
--- /dev/null
+++ b/nuttx/configs/eagle100/thttpd/Make.defs
@@ -0,0 +1,152 @@
+############################################################################
+# configs/eagle100/thttpd/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/thttpd/appconfig b/nuttx/configs/eagle100/thttpd/appconfig
new file mode 100644
index 000000000..45c2605ba
--- /dev/null
+++ b/nuttx/configs/eagle100/thttpd/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/eagle100/thttpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/thttpd
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/thttpd
diff --git a/nuttx/configs/eagle100/thttpd/defconfig b/nuttx/configs/eagle100/thttpd/defconfig
new file mode 100644
index 000000000..b32960945
--- /dev/null
+++ b/nuttx/configs/eagle100/thttpd/defconfig
@@ -0,0 +1,367 @@
+############################################################################
+# configs/eagle100/thttpd/defconfig
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD="eagle100"
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Disable support for interrupts on GPIOJ which does not
+# exist on the LM3S6918. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6918 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="thttp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=12
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=n
+
+#
+# Settings for examples/nxflat
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# THTTPD settings
+#
+CONFIG_THTTPD_PORT=80
+CONFIG_THTTPD_IPADDR=0x0a000002
+CONFIG_THTTPD_SERVER_ADDRESS="http://www.nuttx.org"
+CONFIG_THTTPD_SERVER_SOFTWARE="thttpd/2.25b 29dec2003-NuttX"
+CONFIG_THTTPD_PATH="/mnt/www"
+CONFIG_THTTPD_CGI_PATH="/mnt/www/cgi-bin"
+CONFIG_THTTPD_CGI_PATTERN="/mnt/www/cgi-bin/*"
+CONFIG_THTTPD_CGI_PRIORITY=50
+CONFIG_THTTPD_CGI_STACKSIZE=1024
+CONFIG_THTTPD_CGI_BYTECOUNT=20000
+CONFIG_THTTPD_CGI_TIMELIMIT=0
+CONFIG_THTTPD_CHARSET="iso-8859-1"
+CONFIG_THTTPD_IOBUFFERSIZE=1024
+#CONFIG_THTTPD_INDEX_NAMES
+CONFIG_AUTH_FILE=n
+CONFIG_THTTPD_LISTEN_BACKLOG=8
+CONFIG_THTTPD_LINGER_MSEC=500
+CONFIG_THTTPD_OCCASIONAL_MSEC=120
+CONFIG_THTTPD_IDLE_READ_LIMIT_SEC=300
+CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC=300
+CONFIG_THTTPD_TILDE_MAP1=n
+CONFIG_THTTPD_TILDE_MAP2=n
+CONFIG_THTTPD_GENERATE_INDICES=n
+CONFIG_THTTPD_URLPATTERN=n
+
+#
+# Additional settings for examples/thttpd
+#
+CONFIG_EXAMPLE_THTTPD_NOMAC=n
+CONFIG_EXAMPLE_THTTPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_THTTPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=8192
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/thttpd/ld.script b/nuttx/configs/eagle100/thttpd/ld.script
new file mode 100644
index 000000000..7a1d7c75d
--- /dev/null
+++ b/nuttx/configs/eagle100/thttpd/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/eagle100/thttpd/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/thttpd/setenv.sh b/nuttx/configs/eagle100/thttpd/setenv.sh
new file mode 100755
index 000000000..4dc148e65
--- /dev/null
+++ b/nuttx/configs/eagle100/thttpd/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/thttpd/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ekk-lm3s9b96/Kconfig b/nuttx/configs/ekk-lm3s9b96/Kconfig
new file mode 100644
index 000000000..25af26f3c
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_EKKLM3S9B96
+endif
diff --git a/nuttx/configs/ekk-lm3s9b96/README.txt b/nuttx/configs/ekk-lm3s9b96/README.txt
new file mode 100644
index 000000000..a6dcab87d
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/README.txt
@@ -0,0 +1,377 @@
+README
+^^^^^^
+
+README for NuttX port to the Stellaris EKK-LM3S9B96 Evaluation Kit
+
+Contents
+^^^^^^^^
+
+ Stellaris EKK-LM3S9B96 Evaluation Kit
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options
+ Configurations
+
+Stellaris EKK-LM3S9B96 Evaluation Kit
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The EKK-LM3S9B96 evaluation kit provides the following features:
+
+ o LM3S9B96 high-performance Stellaris microcontroller and large memory
+ – 32-bit ARM® Cortex™-M3 core
+ – 256 KB single-cycle Flash memory, 96 KB single-cycle SRAM, 23.7 KB single-cycle ROM
+ o Ethernet 10/100 port with two LED indicators
+ o USB 2.0 Full-Speed OTG port
+ o SAFERTOS™ operating system in microcontroller ROM
+ o Virtual serial communications port capability
+ o Oversized board pads for GPIO access
+ o User pushbutton and LED
+ o Detachable ICDI board can be used for debugging other Luminary Micro boards
+ o Easy to customize
+
+Features of the LM3S9B96 Microcontroller
+
+ o ARM® Cortex™-M3 architecture
+ – 80-MHz operation
+ – ARM Cortex SysTick Timer
+ – Integrated Nested Vectored Interrupt Controller (NVIC)
+ o External Peripheral Interface (EPI)
+ o 256 KB single-cycle flash
+ o 96 KB single-cycle SRAM
+ o Four general-purpose 32-bit timers
+ o Integrated Ethernet MAC and PHY
+ o Three fully programmable 16C550-type UARTs
+ o Two 10-bit channels (inputs) when used as single-ended inputs
+ o Three independent integrated analog comparators
+ o Two CAN modules
+ o Two I2C modules
+ o Two SSI modules
+ o Two Watchdog Timers (32-bit)
+ o Three PWM generator blocks
+ – One 16-bit counter
+ – Two comparators
+ – Produces eight independent PWM signals
+ – One dead-band generator
+ o Two QEI modules with position integrator for tracking encoder position
+ o Up to 65 GPIOs, depending on user configuration
+ o On-chip low drop-out (LDO) voltage regulator
+
+GPIO Usage
+
+PIN SIGNAL EVB Function
+--- ----------- ---------------------------------------
+ 26 PA0/U0RX Virtual COM port receive
+ 27 PA1/U0TX Virtual COM port transmit
+ 66 PB0/USB0ID USBID signal from the USB-On-the-Go
+ 67 PB1/USB0VBUS USB VBUS input signal from USB-OTG
+ 92 PB4/GPIO User pushbutton SW2.
+ 80 PC0/TCK/SWCLK JTAG or SWD clock input
+ 79 PC1/TMS/SWDIO JTAG TMS input or SWD bidirectional signal SWDIO
+ 78 PC2/TDI JTAG TDI signal input
+ 77 PC3/TDO/SWO JTAG TDO output or SWD trace signal SWO output.
+ 10 PD0/GPIO User LED
+ 60 PF2/LED1 Ethernet LED1 (yellow)
+ 59 PF3/LED0 Ethernet LED0 (green)
+ 83 PH3/USB0EPEN USB-OTG power switch
+ 76 PH4/USB0PFLT Overcurrent input status from USB-OTG power switch
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM, you simply need to add one of the following
+ configuration options to your .config (or defconfig) file:
+
+ CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or Linux
+ native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+ NOTE 3: I recently (i.e., late 2011) tried building with the CodeSourcery Windows
+ toolchain. The code worked but required 40 seconds to boot (or even until the
+ status LED illuminates)!! Know idea why. With the buildroot tools, boot time is
+ a couple of seconds.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lm3s,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lm3s/lm3s_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh ekk-lm3s9b96/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+
+Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lm3s
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LM3S9B96
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=ekk-lm3s9b96 (for the Stellaris EKK-LM3S9b96 Evaluation Kit)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_EKKLM3S9B96
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00018000 (96Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ There are configurations for disabling support for interrupts GPIO ports.
+ GPIOJ must be disabled because it does not exist on the LM3S6918.
+ Additional interrupt support can be disabled if desired to reduce memory
+ footprint.
+
+ CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+ LM3S6818 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ CONFIG_SSI0_DISABLE - Select to disable support for SSI0
+ CONFIG_SSI1_DISABLE - Select to disable support for SSI1
+ CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support.
+ Poll-waiting is recommended if the interrupt rate would be to
+ high in the interrupt driven case.
+ CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before
+ emptying the Rx FIFO. If the SPI frequency is high and this
+ value is large, then larger values of this setting may cause
+ Rx FIFO overrun errors. Default: half of the Tx FIFO size (4).
+
+ CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
+ to build the LM3S Ethernet driver
+ CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
+ CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide
+ a MAC address (via lm3s_ethernetmac()), then this should be selected.
+ CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation
+ CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation
+ CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding
+ CONFIG_LM3S_MULTICAST - Set to enable multicast frames
+ CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode
+ CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection.
+ CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Stellaris EKK-LM3S9b96 Evaluation Kit configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh ekk-lm3s9b96/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+ NOTE: As it is configured now, you MUST have a network connected.
+ Otherwise, the NSH prompt will not come up because the Ethernet
+ driver is waiting for the network to come up. That is probably
+ a bug in the Ethernet driver behavior!
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+
diff --git a/nuttx/configs/ekk-lm3s9b96/include/board.h b/nuttx/configs/ekk-lm3s9b96/include/board.h
new file mode 100644
index 000000000..2e6cd93f1
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/include/board.h
@@ -0,0 +1,143 @@
+/************************************************************************************
+ * configs/ekk-lm3s9b96/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* RCC settings */
+
+#define SYSCON_RCC_XTAL SYSCON_RCC_XTAL16000KHZ /* 16.000 MHz crystal */
+#define XTAL_FREQUENCY 16000000
+
+/* Oscillator source is the main oscillator (not internal, internal/4, 30KHz or
+ * 30KHz from hibernate module) */
+
+#define SYSCON_RCC_OSCSRC SYSCON_RCC_OSCSRC_MOSC
+#define SYSCON_RCC2_OSCSRC SYSCON_RCC2_OSCSRC2_MOSC
+#define OSCSRC_FREQUENCY XTAL_FREQUENCY
+
+/* Use system divider = 4; this corresponds to a system clock frequency
+ * of (400 / 2) / 4 = 50MHz
+ */
+
+#define LM3S_SYSDIV 4
+#define SYSCLK_FREQUENCY 50000000 /* 50MHz */
+
+/* Other RCC settings:
+ *
+ * - Main and internal oscillators enabled.
+ * - PLL and sys dividers not bypassed
+ * - PLL not powered down
+ * - No auto-clock gating reset
+ */
+
+#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV))
+
+/* RCC2 settings -- RCC2 not used. Other RCC2 settings
+ *
+ * - PLL and sys dividers not bypassed.
+ * - PLL not powered down
+ * - Not using RCC2
+ */
+
+#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV))
+
+/* LED definitions ******************************************************************/
+
+/* The EKK-LMS39B96 Eval Kit has only one user LED: Port D, Bit 0. Below is the mapping of this
+ * single LED. From this single LED, we can get the following information:
+ *
+ * OFF Steady: The system has failed to boot to the point of enabling interrupts
+ * ON Steady: The systems has enabled interrupts, but none have been received
+ * Dull glow: The system is taking interrupts
+ * Slow blinking: The system has panicked
+ */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* OFF OFF */
+#define LED_IRQSENABLED 2 /* ON ON */
+#define LED_STACKCREATED 3 /* ON ON */
+#define LED_INIRQ 4 /* ON OFF */
+#define LED_SIGNAL 5 /* ON OFF */
+#define LED_ASSERTION 6 /* ON OFF */
+#define LED_PANIC 7 /* ON OFF */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+extern void lm3s_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+struct ether_addr;
+extern void lm3s_ethernetmac(struct ether_addr *ethaddr);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/Make.defs b/nuttx/configs/ekk-lm3s9b96/nsh/Make.defs
new file mode 100644
index 000000000..50b414289
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/nsh/Make.defs
@@ -0,0 +1,164 @@
+############################################################################
+# configs/ekk-lm3s9b96/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/appconfig b/nuttx/configs/ekk-lm3s9b96/nsh/appconfig
new file mode 100644
index 000000000..3edc979ba
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/nsh/appconfig
@@ -0,0 +1,59 @@
+############################################################################
+# configs/ekk-lm3s9b96/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig
new file mode 100644
index 000000000..e1422da7f
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig
@@ -0,0 +1,342 @@
+############################################################################
+# configs/ekk-lm3s9b96/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S9B96=y
+CONFIG_ARCH_BOARD="ekk-lm3s9b96"
+CONFIG_ARCH_BOARD_EKKLM3S9B96=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=98304
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6B96 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6B96 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=y
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6B96 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=n
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+CONFIG_NFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=40
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh b/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh
new file mode 100755
index 000000000..568615fa3
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/ekk-lm3s9b96/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# TOOLCHAIN_BIN must be defined to the full path to the location where you
+# have installed the toolchain of your choice. Modify the following:
+
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Andd add the toolchain path to the PATH variable
+
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/Make.defs b/nuttx/configs/ekk-lm3s9b96/ostest/Make.defs
new file mode 100644
index 000000000..ac45c9bab
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/ostest/Make.defs
@@ -0,0 +1,164 @@
+############################################################################
+# configs/ekk-lm3s9b96/ostest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/appconfig b/nuttx/configs/ekk-lm3s9b96/ostest/appconfig
new file mode 100644
index 000000000..25e012211
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/ostest/appconfig
@@ -0,0 +1,40 @@
+############################################################################
+# configs/ekk-lm3s9b96/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig
new file mode 100644
index 000000000..4eebaca3a
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig
@@ -0,0 +1,339 @@
+############################################################################
+# configs/ekk-lm3s9b96/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S9B96=y
+CONFIG_ARCH_BOARD="ekk-lm3s9b96"
+CONFIG_ARCH_BOARD_EKKLM3S9B96=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=98304
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6B96 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6B96 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=y
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6B96 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+CONFIG_NFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=n
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh b/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh
new file mode 100755
index 000000000..a5e320cf6
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/ekk-lm3s9b96/otest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# TOOLCHAIN_BIN must be defined to the full path to the location where you
+# have installed the toolchain of your choice. Modify the following:
+
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Andd add the toolchain path to the PATH variable
+
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ekk-lm3s9b96/scripts/ld.script b/nuttx/configs/ekk-lm3s9b96/scripts/ld.script
new file mode 100644
index 000000000..22d2edfdb
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/scripts/ld.script
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/ekk-lm3s9b96/ostest/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S9B96 has 256Kb of FLASH beginning at address 0x0000:0000 and 96Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ekk-lm3s9b96/src/Makefile b/nuttx/configs/ekk-lm3s9b96/src/Makefile
new file mode 100644
index 000000000..3a364cd26
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/Makefile
@@ -0,0 +1,88 @@
+############################################################################
+# configs/ekk-lm3s9b96/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_ethernet.c up_ssi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h
new file mode 100644
index 000000000..fd8ff3adb
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h
+ * arch/arm/src/board/lm3s6965ek_internal.n
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EKK_LM3S9B96_SRC_EKKLM3S9B96_INTERNAL_H
+#define __CONFIGS_EKK_LM3S9B96_SRC_EKKLM3S9B96_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S9B96 supports 2 SSI
+ * modules (others may support more than 2 -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#elif LM3S_NSSI == 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#endif
+
+/* EKK-LM3S9B96 Eval Kit ************************************************************/
+
+/* GPIO Usage
+ *
+ * PIN SIGNAL EVB Function
+ * --- ----------- ---------------------------------------
+ * 26 PA0/U0RX Virtual COM port receive
+ * 27 PA1/U0TX Virtual COM port transmit
+ * 66 PB0/USB0ID USBID signal from the USB-On-the-Go
+ * 67 PB1/USB0VBUS USB VBUS input signal from USB-OTG
+ * 92 PB4/GPIO User pushbutton SW2.
+ * 80 PC0/TCK/SWCLK JTAG or SWD clock input
+ * 79 PC1/TMS/SWDIO JTAG TMS input or SWD bidirectional signal SWDIO
+ * 78 PC2/TDI JTAG TDI signal input
+ * 77 PC3/TDO/SWO JTAG TDO output or SWD trace signal SWO output.
+ * 10 PD0/GPIO User LED
+ * 60 PF2/LED1 Ethernet LED1 (yellow)
+ * 59 PF3/LED0 Ethernet LED0 (green)
+ * 83 PH3/USB0EPEN USB-OTG power switch
+ * 76 PH4/USB0PFLT Overcurrent input status from USB-OTG power switch
+ */
+
+/* GPIO for LED's:
+ * - PD0: User LED
+ */
+
+#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTD | 0)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_EKK_LM3S9B96_SRC_EKKLM3S9B96_INTERNAL_H */
+
diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_boot.c b/nuttx/configs/ekk-lm3s9b96/src/up_boot.c
new file mode 100644
index 000000000..528d150e1
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/up_boot.c
@@ -0,0 +1,91 @@
+/************************************************************************************
+ * configs/ekk-lm3s9b96/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "ekklm3s9b96_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void lm3s_boardinitialize(void)
+{
+ /* Configure chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
+
+#if !defined(CONFIG_SSI0_DISABLE) || !defined(CONFIG_SSI1_DISABLE)
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c b/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c
new file mode 100644
index 000000000..a1963f0d5
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c
@@ -0,0 +1,99 @@
+/************************************************************************************
+ * configs/lm3s6965-ek/src/up_ethernet.c
+ * arch/arm/src/board/up_ethernet.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <arch/board/board.h>
+#include <net/ethernet.h>
+
+#include "up_arch.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+void lm3s_ethernetmac(struct ether_addr *ethaddr)
+{
+ uint32_t user0;
+ uint32_t user1;
+
+ /* Get the current value of the user registers */
+
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
+
+ nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff);
+ DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff);
+
+ /* Re-format that MAC address the way that uIP expects to see it */
+
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
+}
+#endif
diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_leds.c b/nuttx/configs/ekk-lm3s9b96/src/up_leds.c
new file mode 100644
index 000000000..5ed84c2d2
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/up_leds.c
@@ -0,0 +1,168 @@
+/****************************************************************************
+ * configs/lm3s6965-ek/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "ekklm3s9b96_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_DEBUG
+# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+static uint8_t g_nest;
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ leddbg("Initializing\n");
+
+ /* Configure Port D, Bit 0 as an output, initial value=OFF */
+
+ led_dumpgpio("up_ledinit before lm3s_configgpio()");
+ lm3s_configgpio(LED_GPIO);
+ led_dumpgpio("up_ledinit after lm3s_configgpio()");
+ g_nest = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, false);
+ led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ if (--g_nest <= 0)
+ {
+ led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, true);
+ led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
+ }
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_nsh.c b/nuttx/configs/ekk-lm3s9b96/src/up_nsh.c
new file mode 100644
index 000000000..6f9aac6b1
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/up_nsh.c
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * config/ekk-lm3s9b96/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ return OK;
+}
diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c b/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c
new file mode 100644
index 000000000..2fe3b81c8
--- /dev/null
+++ b/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c
@@ -0,0 +1,162 @@
+/************************************************************************************
+ * configs/ekk-lm3s9b96/src/up_ssi.c
+ * arch/arm/src/board/up_ssi.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Jose Pablo Rojas V. <jrojas@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lm3s_internal.h"
+#include "ekklm3s9b96_internal.h"
+
+#if !defined(CONFIG_SSI0_DISABLE) || !defined(CONFIG_SSI1_DISABLE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSI_DEBUG /* Define to enable debug */
+#undef SSI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# ifdef SSI_VERBOSE
+# define ssivdbg lldbg
+# else
+# define ssivdbg(x...)
+# endif
+#else
+# undef SSI_VERBOSE
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_VERBOSE
+#if 0
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#endif
+#else
+# define ssi_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure chip select GPIO pins for the LM3S9B96 Eval board.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the CS GPIO */
+#if 0
+ ssi_dumpgpio("lm3s_ssiinitialize() Entry");
+ ssi_dumpgpio("lm3s_ssiinitialize() Exit");
+#endif
+}
+
+#if 0
+/****************************************************************************
+ * The external functions, lm3s_spiselect and lm3s_spistatus must be provided
+ * by board-specific logic. The are implementations of the select and status
+ * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ * All othermethods (including up_spiinitialize()) are provided by common
+ * logic. To use this common SPI logic on your board:
+ *
+ * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your
+ * board-specific logic. This function will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 2. Add a call to up_spiinitialize() in your low level initialization
+ * logic
+ * 3. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssi_dumpgpio("lm3s_spiselect() Entry");
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ }
+#ifdef CONFIG_NX_LCDDRIVER
+ else if (devid == SPIDEV_DISPLAY)
+ {
+ /* Assert the CS pin to the display */
+
+ lm3s_gpiowrite(OLEDCS_GPIO, !selected);
+ }
+#endif
+ ssi_dumpgpio("lm3s_spiselect() Exit");
+}
+
+uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+#endif
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */
diff --git a/nuttx/configs/ez80f910200kitg/Kconfig b/nuttx/configs/ez80f910200kitg/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/ez80f910200kitg/README.txt b/nuttx/configs/ez80f910200kitg/README.txt
new file mode 100644
index 000000000..05f767c79
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/README.txt
@@ -0,0 +1,80 @@
+README.txt
+^^^^^^^^^^
+
+ZDS-II Compiler Versions
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Different configurations have been build for this board using ZDS-11
+Versions 4.11.0 and 4.11.1. You have to check the files */Make.defs
+to see how the build is configured: Check the definitions of
+ZDSVERSION (if present) and ZDSINSTALLDIR.
+
+NOTE: Different versions of the ZDS-II compiler may also require
+different versions of .linkcmd and .zdsproj files as well.
+
+Version 4.11.0
+
+ Although it compiles without error, the 4.11.0 compiler generates
+ This is the only version that this code has been built against.
+
+ Although it compiles without error, the 4.11.0 compiler generates
+ bad code on one of the files, mm/mm_initialize.c. Below is a simple work-
+ around.
+
+ --- mm/mm_initialize.c.SAVE 2008-02-13 08:06:46.833857700 -0600
+ +++ mm/mm_initialize.c 2008-02-13 08:07:26.367608900 -0600
+ @@ -94,8 +94,11 @@
+ {
+ int i;
+
+ +#if 0 /* DO NOT CHECK IN */
+ CHECK_ALLOCNODE_SIZE;
+ CHECK_FREENODE_SIZE;
+ +#endif
+
+ /* Set up global variables */
+
+Version 5.1.1
+
+ On June 22, 2011 I verified that these configurations build successfully
+ with the 5.1.1 ZDS-II version. All that is required to used ZDS-II is
+ to modify the Make.defs file so that the correct version is used. That
+ version should also be changed in the (optional) setenv.sh file.
+
+ The above kludge for 4.11.0 is not required.
+
+ I had to make additional changes to the ZDS path in Make.defs (and also
+ in setenv.sh) when the 32-bit ZDS-II tools are installed on my 64-bit
+ Windows 7 system.
+
+Other Versions
+ If you use any version of ZDS-II other than 4.11.0 or if you install ZDS-II
+ at any location other than the default location, you will have to modify
+ two files: (1) configs/ez80f910200kitg/*/setenv.sh and (2)
+ configs/ez80f910200kitg/*/Make.defs.
+
+Configuration Subdirectories
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- src/ and include/
+ These directories contain common logic for all ez80f910200kitg
+ configurations.
+
+Variations on the basic ez80f910200kitg configuration are maintained
+in subdirectories. To configure any specific configuration, do the
+following steps:
+
+ cd <nuttx-top-directory>/tools
+ ./configure.sh ez80f910200kitg/<sub-directory>
+ cd <nuttx-top-directgory>
+ make
+
+Where <sub-directory> is the specific board configuration that you
+wish to build. The following board-specific configurations are
+available:
+
+- ostest
+ This builds the examples/ostest application for execution from FLASH.
+ See examples/README.txt for information about ostest.
+
+Check out any README.txt files in these <sub-directory>s.
diff --git a/nuttx/configs/ez80f910200kitg/include/board.h b/nuttx/configs/ez80f910200kitg/include/board.h
new file mode 100644
index 000000000..80a8afb23
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/include/board.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * arch/ez80f910200kitg/include/board.h
+ *
+ * Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking */
+
+#define EZ80_SYS_CLK_FREQ 50000000
+
+/* LED pattern definitions */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_IDLE 4
+#define LED_INIRQ 5
+#define LED_ASSERTION 6
+#define LED_SIGNAL 6
+#define LED_PANIC 7
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ez80f910200kitg/ostest/Make.defs b/nuttx/configs/ez80f910200kitg/ostest/Make.defs
new file mode 100644
index 000000000..2ec06aadd
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200kitg/ostest/Make.defs
+#
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200kitg/ostest/ostest.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200kitg/ostest/README.txt b/nuttx/configs/ez80f910200kitg/ostest/README.txt
new file mode 100644
index 000000000..9714fb3ac
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/README.txt
@@ -0,0 +1,12 @@
+README.txt
+^^^^^^^^^^
+
+ostest.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger. Before using, copy the following
+ files from the toplevel directory:
+
+ nuttx.hex, nuttx.map, nuttx.lod
+
+ to this directory as:
+
+ ostest.hex, ostest.map, ostest.lod
diff --git a/nuttx/configs/ez80f910200kitg/ostest/appconfig b/nuttx/configs/ez80f910200kitg/ostest/appconfig
new file mode 100644
index 000000000..64d83b55e
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ez80f910200kitg/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig
new file mode 100644
index 000000000..adc92f879
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig
@@ -0,0 +1,406 @@
+############################################################################
+# configs/ez80f910200kitg/ostest/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200kitg"
+CONFIG_ARCH_BOARD_EZ80F910200KITG=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=n
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=n
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=25
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200kitg/ostest/ostest.linkcmd b/nuttx/configs/ez80f910200kitg/ostest/ostest.linkcmd
new file mode 100755
index 000000000..3ddee5f85
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/ostest.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200kitg/ostest/ostest.linkcmd */
+/* */
+/* Copyright (C) 2008 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort NAME=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B7E000 : $B7FFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT = ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $b8
+DEFINE __CS1_UBR_INIT_PARAM = $b9
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $02
+DEFINE __CS3_LBR_INIT_PARAM = $60
+DEFINE __CS3_UBR_INIT_PARAM = $7f
+DEFINE __CS3_CTL_INIT_PARAM = $a8
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 5000000
+define _SYS_CLK_SRC = 1
+define _OSC_FREQ_MULT = 10
+define __PLL_CTL0_INIT_PARAM = $41
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200kitg/ostest/ostest.zdsproj b/nuttx/configs/ez80f910200kitg/ostest/ostest.zdsproj
new file mode 100755
index 000000000..08247148b
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/ostest.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:07071801">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\ostest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">NAME</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\ostest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\ostest</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200kitg/ostest/setenv.sh b/nuttx/configs/ez80f910200kitg/ostest/setenv.sh
new file mode 100755
index 000000000..e692029ae
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200kitg/ostest/setenv.sh
+#
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200kitg/ostest/test-result.txt b/nuttx/configs/ez80f910200kitg/ostest/test-result.txt
new file mode 100644
index 000000000..ebf178439
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/ostest/test-result.txt
@@ -0,0 +1,529 @@
+This is the output from the z16f target from January 31, 2008
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+While all tests pass per this output, my impression is that some
+of the timed delays in during execution of the test were not
+correct and I suspect some system timing issues.
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: putenv(Variable1=BadValue3)
+user_start: setenv(Variable1, GoodValue1, TRUE)
+user_start: setenv(Variable2, BadValue1, FALSE)
+user_start: setenv(Variable2, GoodValue2, TRUE)
+user_start: setenv(Variable3, Variable3, FALSE)
+user_start: setenv(Variable3, Variable3, FALSE)
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+user_start: Started user_main at PID=2
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 2
+mxordblk 76b20 76b20
+uordblks 33d0 33d0
+fordblks 78180 78180
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 3
+mxordblk 76b20 76b20
+uordblks 33d0 33c0
+fordblks 78180 78190
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has no value
+show_variable: Variable=Variable3 has no value
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 33c0 3380
+fordblks 78190 781d0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning ntcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+errors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=804b10
+Resuming
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 4
+mxordblk 76b20 76b20
+uordblks 3380 35c0
+fordblks 781d0 77f90
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b23
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b36
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b49
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf76
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b5c
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf66
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b6f
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve1 finished
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 3 started
+barrier_test: Thread 3 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 4 started
+barrier_test: Thread 4 created
+barrier_func: Thread 3 calling pthread_barrier_wait()
+barrier_func: Thread 4 calling pthread_barrier_wait()
+barrier_func: Thread 5 started
+barrier_test: Thread 5 created
+barrier_func: Thread 6 started
+barrier_test: Thread 6 created
+barrier_func: Thread 7 started
+barrier_test: Thread 7 created
+barrier_func: Thread 5 calling pthread_barrier_wait()
+barrier_func: Thread 6 calling pthread_barrier_wait()
+barrier_func: Thread 7 calling pthread_barrier_wait()
+barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2, back with status=0 (I am not special)
+barrier_func: Thread 3, back with status=0 (I am not special)
+barrier_func: Thread 4, back with status=0 (I am not special)
+barrier_func: Thread 5, back with status=0 (I am not special)
+barrier_func: Thread 6, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 7 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_func: Thread 6 done
+barrier_func: Thread 3 done
+barrier_func: Thread 4 done
+barrier_func: Thread 5 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+barrier_test: Thread 3 completed with result=0
+barrier_test: Thread 4 completed with result=0
+barrier_test: Thread 5 completed with result=0
+barrier_test: Thread 6 completed with result=0
+barrier_test: Thread 7 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 4
+mxordblk 76b20 76b20
+uordblks 33d0 35c0
+fordblks 78180 77f90
+user_main: Exitting
+
diff --git a/nuttx/configs/ez80f910200kitg/src/Makefile b/nuttx/configs/ez80f910200kitg/src/Makefile
new file mode 100644
index 000000000..a1f0f6035
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/src/Makefile
@@ -0,0 +1,84 @@
+############################################################################
+# configs/ez80f910200kitg/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
+USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
+INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = ez80_lowinit.c ez80_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+
+all: libboard$(LIBEXT)
+
+$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
+ @$(CPP) $(CPPFLAGS) `cygpath -w $<` -o $@.tmp
+ @cat $@.tmp | sed -e "s/^#/;/g" > $@
+ @rm $@.tmp
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ez80f910200kitg/src/ez80_leds.c b/nuttx/configs/ez80f910200kitg/src/ez80_leds.c
new file mode 100644
index 000000000..588410c8e
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/src/ez80_leds.c
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * configs/ez80f910200kitg/src/ez80_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/board/board.h>
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ez80f910200kitg/src/ez80_lowinit.c b/nuttx/configs/ez80f910200kitg/src/ez80_lowinit.c
new file mode 100644
index 000000000..e96a1ec07
--- /dev/null
+++ b/nuttx/configs/ez80f910200kitg/src/ez80_lowinit.c
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * configs/ez80f910200kitg/src/ez80_lowinit.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Based upon sample code included with the Zilog ZDS-II toolchain.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ * Included Files
+ ***************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip/chip.h"
+
+/***************************************************************************
+ * Pre-processor Definitions
+ ***************************************************************************/
+
+/***************************************************************************
+ * Private Functions
+ ***************************************************************************/
+
+static void ez80_gpioinit(void)
+{
+}
+
+/***************************************************************************
+ * Public Functions
+ ***************************************************************************/
+
+void ez80_lowinit(void)
+{
+ ez80_gpioinit();
+}
+
diff --git a/nuttx/configs/ez80f910200zco/Kconfig b/nuttx/configs/ez80f910200zco/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/ez80f910200zco/README.txt b/nuttx/configs/ez80f910200zco/README.txt
new file mode 100644
index 000000000..51b219493
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/README.txt
@@ -0,0 +1,107 @@
+README.txt
+^^^^^^^^^^
+
+ZDS-II Compiler Versions
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Different configurations have been build for this board using ZDS-11
+Versions 4.11.0 and 4.11.1. You have to check the files */Make.defs
+to see how the build is configured: Check the definitions of
+ZDSVERSION (if present) and ZDSINSTALLDIR.
+
+NOTE: Different versions of the ZDS-II compiler may also require
+different versions of .linkcmd and .zdsproj files as well.
+
+Version 4.11.0
+
+ Although it compiles without error, the 4.11.0 compiler generates
+ bad code on one of the files, mm/mm_initialize.c. Below is a simple work-
+ around.
+
+ --- mm/mm_initialize.c.SAVE 2008-02-13 08:06:46.833857700 -0600
+ +++ mm/mm_initialize.c 2008-02-13 08:07:26.367608900 -0600
+ @@ -94,8 +94,11 @@
+ {
+ int i;
+
+ +#if 0 /* DO NOT CHECK IN */
+ CHECK_ALLOCNODE_SIZE;
+ CHECK_FREENODE_SIZE;
+ +#endif
+
+ /* Set up global variables */
+
+ UPDATE: I don't know if 4.11.1 has this same problem (I bet not since
+ I submitted the bug to ZiLOG), but I have permanently worked around the
+ above problem for all ZiLOG compiler.
+
+Version 5.1.1
+
+ On June 22, 2011 I verified that these configurations build successfully
+ with the 5.1.1 ZDS-II version. All that is required to used ZDS-II is
+ to modify the Make.defs file so that the correct version is used. That
+ version should also be changed in the (optional) setenv.sh file.
+
+ The above kludge for 4.11.0 is not required.
+
+ I had to make additional changes to the ZDS path in Make.defs (and also
+ in setenv.sh) when the 32-bit ZDS-II tools are installed on my 64-bit
+ Windows 7 system.
+
+Other Versions
+
+ If you use any version of ZDS-II other than 4.11.0 or if you install ZDS-II
+ at any location other than the default location, you will have to modify
+ two files: (1) configs/ez80f910200zco/*/setenv.sh and (2)
+ configs/ez80f910200zco/*/Make.defs.
+
+Configuration Subdirectories
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+src/ and include/
+ These directories contain common logic for all ez80f910200zco
+ configurations.
+
+Variations on the basic ez80f910200zco configuration are maintained
+in subdirectories. To configure any specific configuration, do the
+following steps:
+
+ cd <nuttx-top-directory>/tools
+ ./configure.sh ez80f910200zco/<sub-directory>
+ cd <nuttx-top-directgory>
+ make
+
+Where <sub-directory> is the specific board configuration that you
+wish to build. The following board-specific configurations are
+available:
+
+dhcpd:
+ This builds the DCHP server using the examples/dhcpd application
+ (for execution from FLASH.) See examples/README.txt for information
+ about the dhcpd example.
+
+httpd:
+ This builds the uIP web server example using the examples/uip application
+ (for execution from FLASH). See examples/README.txt for information
+ about ostest.
+
+ostest
+ This builds the examples/ostest application for execution from FLASH.
+ See examples/README.txt for information about ostest.
+
+nsh
+ This configuratino builds the NuttShell (NSH). That code can be
+ found in examples/nsh. For more information see: examples/nsh/README.txt
+ and Documentation/NuttShell.html.
+
+nettest
+ This configuration is used for testing the eZ80F91 EMAC driver. It
+ builds examples/nettest. See examples/README.txt for more information
+ about nettest.
+
+poll
+ This configuration is also used for testing the eZ80F91 EMAC driver. It
+ builds examples/poll. See examples/README.txt for more information
+ about the poll test.
+
+Check out any README.txt files in these <sub-directory>s.
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/Make.defs b/nuttx/configs/ez80f910200zco/dhcpd/Make.defs
new file mode 100644
index 000000000..367f60ca7
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200zco/dhcpd/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200zco/dhcpd/dhcpd.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/README.txt b/nuttx/configs/ez80f910200zco/dhcpd/README.txt
new file mode 100644
index 000000000..36fcb101a
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/README.txt
@@ -0,0 +1,5 @@
+README.txt
+^^^^^^^^^^
+
+dhcpd.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/appconfig b/nuttx/configs/ez80f910200zco/dhcpd/appconfig
new file mode 100644
index 000000000..97b756521
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/ez80f910200zco/dhcpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/dhcpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/dhcpd
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/defconfig b/nuttx/configs/ez80f910200zco/dhcpd/defconfig
new file mode 100644
index 000000000..8f7b6479f
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/defconfig
@@ -0,0 +1,427 @@
+############################################################################
+# configs/ez80f910200zco/dhcpd/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200zco"
+CONFIG_ARCH_BOARD_EZ80F910200ZCO=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=y
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_BITS=0
+CONFIG_UART1_BITS=0
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=y
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="dhcpd_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=14
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=y
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=y
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/dhcpd
+CONFIG_EXAMPLE_DHCPD_NOMAC=y
+CONFIG_EXAMPLE_DHCPD_IPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/dhcpd.linkcmd b/nuttx/configs/ez80f910200zco/dhcpd/dhcpd.linkcmd
new file mode 100755
index 000000000..9a4ae3a77
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/dhcpd.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200zco/dhcpd/dhcpd.linkcmd */
+/* */
+/* Copyright (C) 2009 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort ADDRESS=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B80000 : $BFFFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT is ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $c0
+DEFINE __CS1_UBR_INIT_PARAM = $c7
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $81
+DEFINE __CS3_LBR_INIT_PARAM = $00
+DEFINE __CS3_UBR_INIT_PARAM = $00
+DEFINE __CS3_CTL_INIT_PARAM = $00
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 50000000
+define _SYS_CLK_SRC = 0
+define _OSC_FREQ_MULT = 1
+define __PLL_CTL0_INIT_PARAM = $40
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/dhcpd.zdsproj b/nuttx/configs/ez80f910200zco/dhcpd/dhcpd.zdsproj
new file mode 100755
index 000000000..731826088
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/dhcpd.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:08011102">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">true</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000000</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\dhcpd.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">ADDRESS</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B80000-BfFFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\dhcpd.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\dhcpd</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200zco/dhcpd/setenv.sh b/nuttx/configs/ez80f910200zco/dhcpd/setenv.sh
new file mode 100755
index 000000000..3d1c4aecb
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/dhcpd/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200zco/dhcpd/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200zco/httpd/Make.defs b/nuttx/configs/ez80f910200zco/httpd/Make.defs
new file mode 100644
index 000000000..ec5a70ca6
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200zco/httpd/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200zco/httpd/httpd.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200zco/httpd/README.txt b/nuttx/configs/ez80f910200zco/httpd/README.txt
new file mode 100644
index 000000000..5bcdc7000
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/README.txt
@@ -0,0 +1,5 @@
+README.txt
+^^^^^^^^^^
+
+httpd.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
diff --git a/nuttx/configs/ez80f910200zco/httpd/appconfig b/nuttx/configs/ez80f910200zco/httpd/appconfig
new file mode 100644
index 000000000..c37580834
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/appconfig
@@ -0,0 +1,47 @@
+############################################################################
+# configs/ez80f910200zco/httpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/uip
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webserver
+
diff --git a/nuttx/configs/ez80f910200zco/httpd/defconfig b/nuttx/configs/ez80f910200zco/httpd/defconfig
new file mode 100644
index 000000000..296521a9e
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/defconfig
@@ -0,0 +1,435 @@
+############################################################################
+# configs/ez80f910200zco/httpd/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200zco"
+CONFIG_ARCH_BOARD_EZ80F910200ZCO=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=y
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_BITS=0
+CONFIG_UART1_BITS=0
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=y
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="uip_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=14
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for netutils/httpd
+CONFIG_NETUTILS_HTTPDSTACKSIZE=2048
+CONFIG_NETUTILS_HTTPDFILESTATS=y
+CONFIG_NETUTILS_HTTPDNETSTATS=y
+CONFIG_NETUTILS_HTTPD_DUMPBUFFER=n
+CONFIG_NETUTILS_HTTPD_DUMPPSTATE=n
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=y
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/dhcpd
+CONFIG_EXAMPLE_DHCPD_NOMAC=y
+CONFIG_EXAMPLE_DHCPD_IPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200zco/httpd/httpd.linkcmd b/nuttx/configs/ez80f910200zco/httpd/httpd.linkcmd
new file mode 100755
index 000000000..4ecc8f1ca
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/httpd.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200zco/httpd/httpd.linkcmd */
+/* */
+/* Copyright (C) 2009 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort ADDRESS=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B80000 : $BFFFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT is ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $c0
+DEFINE __CS1_UBR_INIT_PARAM = $c7
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $81
+DEFINE __CS3_LBR_INIT_PARAM = $00
+DEFINE __CS3_UBR_INIT_PARAM = $00
+DEFINE __CS3_CTL_INIT_PARAM = $00
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 50000000
+define _SYS_CLK_SRC = 0
+define _OSC_FREQ_MULT = 1
+define __PLL_CTL0_INIT_PARAM = $40
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200zco/httpd/httpd.zdsproj b/nuttx/configs/ez80f910200zco/httpd/httpd.zdsproj
new file mode 100755
index 000000000..8b15962b3
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/httpd.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:08011102">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">true</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000000</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\httpd.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">ADDRESS</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B80000-BfFFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\httpd.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\httpd</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200zco/httpd/setenv.sh b/nuttx/configs/ez80f910200zco/httpd/setenv.sh
new file mode 100755
index 000000000..3d1c4aecb
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/httpd/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200zco/dhcpd/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200zco/include/board.h b/nuttx/configs/ez80f910200zco/include/board.h
new file mode 100644
index 000000000..84767437f
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/include/board.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+ * arch/ez80f910200zco/include/board.h
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdint.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking */
+
+#define EZ80_SYS_CLK_FREQ 50000000
+
+/* LED pattern definitions ON OFF */
+
+#define LED_STARTED 0 /* '0' N/A */
+#define LED_HEAPALLOCATE 1 /* 'H' N/A */
+#define LED_IRQSENABLED 2 /* 'E' N/A */
+#define LED_STACKCREATED 3 /* 'C' N/A */
+#define LED_IDLE 4 /* 'R' N/A */
+#define LED_INIRQ 5 /* (ignored) (ignored) */
+#define LED_ASSERTION 6 /* 'A' (previous) */
+#define LED_SIGNAL 7 /* 'S' (previous) */
+#define LED_PANIC 8 /* '*' (previous) */
+
+/* Button definitions */
+
+#define BUTTON_PB0 0x01 /* PB0: SW1 Bit 0 of GPIO Port B */
+#define BUTTON_PB1 0x02 /* PB1: SW2 Bit 1 of GPIO Port B */
+#define BUTTON_PB2 0x04 /* PB2: SW3 Bit 2 of GPIO Port B */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ez80f910200zco/nettest/Make.defs b/nuttx/configs/ez80f910200zco/nettest/Make.defs
new file mode 100644
index 000000000..04074c1bf
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200zco/nettest/Make.defs
+#
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200zco/nettest/nettest.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200zco/nettest/README.txt b/nuttx/configs/ez80f910200zco/nettest/README.txt
new file mode 100644
index 000000000..8ac03bc4a
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/README.txt
@@ -0,0 +1,5 @@
+README.txt
+^^^^^^^^^^
+
+nettest.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
diff --git a/nuttx/configs/ez80f910200zco/nettest/appconfig b/nuttx/configs/ez80f910200zco/nettest/appconfig
new file mode 100644
index 000000000..b3d97d6e9
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/ez80f910200zco/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/ez80f910200zco/nettest/defconfig b/nuttx/configs/ez80f910200zco/nettest/defconfig
new file mode 100644
index 000000000..fb424a766
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/defconfig
@@ -0,0 +1,420 @@
+############################################################################
+# configs/ez80f910200zco/nettest/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200zco"
+CONFIG_ARCH_BOARD_EZ80F910200ZCO=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=y
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_BITS=0
+CONFIG_UART1_BITS=0
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=y
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=14
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=y
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200zco/nettest/nettest.linkcmd b/nuttx/configs/ez80f910200zco/nettest/nettest.linkcmd
new file mode 100755
index 000000000..a2338024a
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/nettest.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200zco/nettest/nettest.linkcmd */
+/* */
+/* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort ADDRESS=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B80000 : $BFFFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT is ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $c0
+DEFINE __CS1_UBR_INIT_PARAM = $c7
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $81
+DEFINE __CS3_LBR_INIT_PARAM = $00
+DEFINE __CS3_UBR_INIT_PARAM = $00
+DEFINE __CS3_CTL_INIT_PARAM = $00
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 50000000
+define _SYS_CLK_SRC = 0
+define _OSC_FREQ_MULT = 1
+define __PLL_CTL0_INIT_PARAM = $40
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200zco/nettest/nettest.zdsproj b/nuttx/configs/ez80f910200zco/nettest/nettest.zdsproj
new file mode 100755
index 000000000..3758b7aad
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/nettest.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:08011102">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">true</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000000</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\nettest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">ADDRESS</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B80000-BfFFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\nettest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\nettest</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200zco/nettest/setenv.sh b/nuttx/configs/ez80f910200zco/nettest/setenv.sh
new file mode 100755
index 000000000..86823697c
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nettest/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200zco/nettest/setenv.sh
+#
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200zco/nsh/Make.defs b/nuttx/configs/ez80f910200zco/nsh/Make.defs
new file mode 100644
index 000000000..3f740ac34
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200zco/nst/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200zco/nsh/nsh.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200zco/nsh/README.txt b/nuttx/configs/ez80f910200zco/nsh/README.txt
new file mode 100644
index 000000000..72e48fc2b
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/README.txt
@@ -0,0 +1,5 @@
+README.txt
+^^^^^^^^^^
+
+nsh.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
diff --git a/nuttx/configs/ez80f910200zco/nsh/appconfig b/nuttx/configs/ez80f910200zco/nsh/appconfig
new file mode 100644
index 000000000..1a6972c05
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/appconfig
@@ -0,0 +1,55 @@
+############################################################################
+# configs/ez80f910200zco/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+endif
+
+
diff --git a/nuttx/configs/ez80f910200zco/nsh/defconfig b/nuttx/configs/ez80f910200zco/nsh/defconfig
new file mode 100644
index 000000000..9c4b5aaee
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/defconfig
@@ -0,0 +1,420 @@
+############################################################################
+# configs/ez80f910200zco/nsh/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200zco"
+CONFIG_ARCH_BOARD_EZ80F910200ZCO=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=y
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=64
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=192
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_BITS=0
+CONFIG_UART1_BITS=0
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=y
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=14
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=y
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200zco/nsh/nsh.linkcmd b/nuttx/configs/ez80f910200zco/nsh/nsh.linkcmd
new file mode 100755
index 000000000..c9e730615
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/nsh.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200zco/nsh/nsh.linkcmd */
+/* */
+/* Copyright (C) 2009 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort ADDRESS=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B80000 : $BFFFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT is ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $c0
+DEFINE __CS1_UBR_INIT_PARAM = $c7
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $81
+DEFINE __CS3_LBR_INIT_PARAM = $00
+DEFINE __CS3_UBR_INIT_PARAM = $00
+DEFINE __CS3_CTL_INIT_PARAM = $00
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 50000000
+define _SYS_CLK_SRC = 0
+define _OSC_FREQ_MULT = 1
+define __PLL_CTL0_INIT_PARAM = $40
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200zco/nsh/nsh.zdsproj b/nuttx/configs/ez80f910200zco/nsh/nsh.zdsproj
new file mode 100755
index 000000000..605c8a0fc
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/nsh.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:08011102">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">true</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000000</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\nsh.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">ADDRESS</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B80000-BfFFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\nsh.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\nsh</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200zco/nsh/sample-run.txt b/nuttx/configs/ez80f910200zco/nsh/sample-run.txt
new file mode 100644
index 000000000..d5516040e
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/sample-run.txt
@@ -0,0 +1,57 @@
+
+NuttShell (NSH)
+nsh> ls -lR /
+/:
+ d---------0 dev/
+/dev:
+ crw-rw-rw-0 console
+ crw-rw-rw-0 null
+ crw-rw-rw-0 ttyS0
+nsh> help
+NSH command forms:
+ [nice [-d <niceness>>]] <cmd> [> <file>|>> <file>] [&]
+OR
+ if <cmd>
+ then
+ [sequence of <cmd>]
+ else
+ [sequence of <cmd>]
+ fi
+Where <cmd> is one of:
+ [ <expression> ]
+ cat <path> [<path> [<path> ...]]
+ cd [<dir-path>|-|~|..]
+ cp <source-path> <dest-path>
+ dd if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]
+ echo [<string|$name> [<string|$name>...]]
+ exec <hex-address>
+ exit
+ get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path>
+ help
+ ifconfig
+ losetup [-d <dev-path>] | [[-o <offset>] [-r] <dev-path> <file-path>]
+ ls [-lRs] <dir-path>
+ mb <hex-address>[=<hex-value>][ <hex-byte-count>]
+ mem
+ mkdir <path>
+ mkfatfs <path>
+ mkfifo <path>
+ mkrd [-m <minor>] [-s <sector-size>] <nsectors>
+ mh <hex-address>[=<hex-value>][ <hex-byte-count>]
+ mount -t <fstype> <block-device> <dir-path>
+ mw <hex-address>[=<hex-value>][ <hex-byte-count>]
+ ping [-c <count>] [-i <interval>] <ip-address>
+ ps
+ put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
+ pwd
+ rm <file-path>
+ rmdir <dir-path>
+ set <name> <value>
+ sh <script-path>
+ sleep <sec>
+ test <expression>
+ umount <dir-path>
+ unset <name>
+ usleep <usec>
+ xd <hex-address> <byte-count>
+nsh> \ No newline at end of file
diff --git a/nuttx/configs/ez80f910200zco/nsh/setenv.sh b/nuttx/configs/ez80f910200zco/nsh/setenv.sh
new file mode 100755
index 000000000..37bc6e3aa
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/nsh/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200zco/nst/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200zco/ostest/Make.defs b/nuttx/configs/ez80f910200zco/ostest/Make.defs
new file mode 100644
index 000000000..7c738c4b3
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200zco/ostest/Make.defs
+#
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200zco/ostest/ostest.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200zco/ostest/README.txt b/nuttx/configs/ez80f910200zco/ostest/README.txt
new file mode 100644
index 000000000..e7bcf03cf
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/README.txt
@@ -0,0 +1,5 @@
+README.txt
+^^^^^^^^^^
+
+ostest.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
diff --git a/nuttx/configs/ez80f910200zco/ostest/appconfig b/nuttx/configs/ez80f910200zco/ostest/appconfig
new file mode 100644
index 000000000..987de079e
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ez80f910200zco/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ez80f910200zco/ostest/defconfig b/nuttx/configs/ez80f910200zco/ostest/defconfig
new file mode 100644
index 000000000..548ce3376
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/defconfig
@@ -0,0 +1,415 @@
+############################################################################
+# configs/ez80f910200zco/ostest/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200zco"
+CONFIG_ARCH_BOARD_EZ80F910200ZCO=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=y
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=64
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=192
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_BITS=0
+CONFIG_UART1_BITS=0
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=n
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=28
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=y
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200zco/ostest/ostest.linkcmd b/nuttx/configs/ez80f910200zco/ostest/ostest.linkcmd
new file mode 100755
index 000000000..808d79f35
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/ostest.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200zco/ostest/ostest.linkcmd */
+/* */
+/* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort ADDRESS=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B80000 : $BFFFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT is ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $c0
+DEFINE __CS1_UBR_INIT_PARAM = $c7
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $81
+DEFINE __CS3_LBR_INIT_PARAM = $00
+DEFINE __CS3_UBR_INIT_PARAM = $00
+DEFINE __CS3_CTL_INIT_PARAM = $00
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 50000000
+define _SYS_CLK_SRC = 0
+define _OSC_FREQ_MULT = 1
+define __PLL_CTL0_INIT_PARAM = $40
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200zco/ostest/ostest.zdsproj b/nuttx/configs/ez80f910200zco/ostest/ostest.zdsproj
new file mode 100755
index 000000000..71da9ab7a
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/ostest.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:08011102">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">true</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000000</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\ostest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">ADDRESS</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B80000-BfFFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\ostest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\ostest</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200zco/ostest/setenv.sh b/nuttx/configs/ez80f910200zco/ostest/setenv.sh
new file mode 100755
index 000000000..028eb6ad4
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200zco/ostest/setenv.sh
+#
+# Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200zco/ostest/test-result.txt b/nuttx/configs/ez80f910200zco/ostest/test-result.txt
new file mode 100644
index 000000000..500af325d
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/ostest/test-result.txt
@@ -0,0 +1,731 @@
+This is the output from the ez80f910200zcog-d target from February 27, 2009
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+All features are enabled and all test pass *except* for the round-robin
+test. However, it appears that some kept the interrupts disabled through-out
+the conduct of that test (I can tell because of the interrupt driven LED
+array on the board does not update when interrupts are disabled). So I
+suspect that there is something else going on in that test case.
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: putenv(Variable1=BadValue3)
+user_start: setenv(Variable1, GoodValue1, TRUE)
+user_start: setenv(Variable2, BadValue1, FALSE)
+user_start: setenv(Variable2, GoodValue2, TRUE)
+user_start: setenv(Variable3, Variable3, FALSE)
+user_start: setenv(Variable3, Variable3, FALSE)
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has no value
+show_variable: Variable=Variable3 has no value
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+receiver_thread: returning nerrors=0
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+sieve1 finished
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve2 finished
+rr_test: Done
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 2, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 2 done
+barrier_test: Thread 2 created
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 0 done
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 1 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+user_main: Exitting
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: putenv(Variable1=BadValue3)
+user_start: setenv(Variable1, GoodValue1, TRUE)
+user_start: setenv(Variable2, BadValue1, FALSE)
+user_start: setenv(Variable2, GoodValue2, TRUE)
+user_start: setenv(Variable3, Variable3, FALSE)
+user_start: setenv(Variable3, Variable3, FALSE)
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 2 2
+mxordblk 79e70 79e70
+uordblks 19d0 19d0
+fordblks 7a830 7a830
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 2 3
+mxordblk 79e70 79e70
+uordblks 19d0 19c0
+fordblks 7a830 7a840
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has no value
+show_variable: Variable=Variable3 has no value
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 19c0 1980
+fordblks 7a840 7a880
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+tcb=0xb845d0 sigdeliver=0xa899
+rtcb=b845d0 sigdeliver=a899 sigpendactionq.head=0
+Resuming
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nertcb=0xb845d0 sigdeliver=0xa899
+rtcb=b845d0 sigdeliver=a899 sigpendactionq.head=0
+Resuming
+rors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+tcb=0xb845d0 sigdeliver=0xa899
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+rtcb=b845d0 sigdeliver=a899 sigpendactionq.head=b83a70
+Resuming
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+tcb=0xb84f90 sigdeliver=0xa899
+rtcb=b84f90 sigdeliver=a899 sigpendactionq.head=b83a80
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+tcb=0xb84f90 sigdeliver=0xa899
+rtcb=b84f90 sigdeliver=a899 sigpendactionq.head=b83a90
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+tcb=0xb84f90 sigdeliver=0xa899
+rtcb=b84f90 sigdeliver=a899 sigpendactionq.head=b83aa0
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+tcb=0xb84f90 sigdeliver=0xa899
+rtcb=b84f90 sigdeliver=a899 sigpendactionq.head=b83ab0
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+tcb=0xb84f90 sigdeliver=0xa899
+rtcb=b84f90 sigdeliver=a899 sigpendactionq.head=b83ac0
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+sieve1 finished
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 2, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 3 3
+mxordblk 79e70 79e70
+uordblks 1980 1980
+fordblks 7a880 7a880
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7c200 7c200
+ordblks 2 3
+mxordblk 79e70 79e70
+uordblks 19d0 1980
+fordblks 7a830 7a880
+user_main: Exitting
diff --git a/nuttx/configs/ez80f910200zco/poll/Make.defs b/nuttx/configs/ez80f910200zco/poll/Make.defs
new file mode 100644
index 000000000..65d3ca2f7
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/ez80f910200zco/poll/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSVERSION := 4.11.1
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_$(ZDSVERSION)
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
+ARCHCPU = eZ80F91
+ARCHCPUDEF = _EZ80F91
+ARCHFAMILY = _EZ80ACCLAIM!
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -NOsdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -NOsdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHFAMILYDEF)=1 -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -optsize
+endif
+
+ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHCPUDEF) -define:$(ARCHFAMILYDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/ez80f910200zco/poll/poll.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez80cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez80link.exe
+AS = $(ZDSBINDIR)/ez80asm.exe
+AR = $(ZDSBINDIR)/ez80lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .lod
+HEXEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lod *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/ez80f910200zco/poll/README.txt b/nuttx/configs/ez80f910200zco/poll/README.txt
new file mode 100644
index 000000000..00d6550c1
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/README.txt
@@ -0,0 +1,5 @@
+README.txt
+^^^^^^^^^^
+
+poll.zdsproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger.
diff --git a/nuttx/configs/ez80f910200zco/poll/appconfig b/nuttx/configs/ez80f910200zco/poll/appconfig
new file mode 100644
index 000000000..8377851cc
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/ez80f910200zco/poll/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/poll
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/ez80f910200zco/poll/defconfig b/nuttx/configs/ez80f910200zco/poll/defconfig
new file mode 100644
index 000000000..0334ebc26
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/defconfig
@@ -0,0 +1,420 @@
+############################################################################
+# configs/ez80f910200zco/poll/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="ez80"
+CONFIG_ARCH_CHIP_EZ80=y
+CONFIG_ARCH_CHIP_EZ80F91=y
+CONFIG_ARCH_CHIP_EZ80F92=n
+CONFIG_ARCH_CHIP_EZ80F93=n
+CONFIG_ARCH_BOARD="ez80f910200zco"
+CONFIG_ARCH_BOARD_EZ80F910200ZCO=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=n
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_TIMERHOOK=y
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# eZ80 specific device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_BITS=0
+CONFIG_UART1_BITS=0
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# ez80 EMAC
+#
+CONFIG_EZ80_EMAC=y
+CONFIG_EZ80_FIAD=0x1f
+CONFIG_EZ80_PHYAM79C874=y
+CONFIG_EZ80_PHYCONFIG=1
+CONFIG_EZ80_RAMADDR=0xf7c000
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_NTXPKTBUFS=64
+CONFIG_EZ80_NRXPKTBUFS=64
+CONFIG_EZ80_PKTBUFSIZE=64
+CONFIG_EZ80_MDCDIV=0
+CONFIG_EZ80_TXPOLLTIMERMS=10
+CONFIG_ARCH_MCFILTER=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="poll_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=14
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=y
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/wget
+#
+CONFIG_EXAMPLE_WGET_URL="http://www.nuttx.org/index.html"
+CONFIG_EXAMPLE_WGET_NOMAC=y
+CONFIG_EXAMPLE_WGET_IPADDR=0x0a000002
+CONFIG_EXAMPLE_WGET_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_WGET_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ez80f910200zco/poll/poll.linkcmd b/nuttx/configs/ez80f910200zco/poll/poll.linkcmd
new file mode 100755
index 000000000..ecfa93e6e
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/poll.linkcmd
@@ -0,0 +1,94 @@
+/****************************************************************************/
+/* configs/ez80f910200zco/poll/poll.linkcmd */
+/* */
+/* Copyright (C) 2009 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -NOwarnoverlap -xref -unresolved=fatal
+-sort ADDRESS=ascending -warn -NOdebug -NOigcase
+
+RANGE ROM $000000 : $03FFFF
+RANGE RAM $B80000 : $BFFFFF
+RANGE EXTIO $000000 : $00FFFF
+RANGE INTIO $000000 : $0000FF
+
+CHANGE STRSECT is ROM
+
+ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA
+COPY DATA ROM
+
+DEFINE __low_romdata = copy base of DATA
+DEFINE __low_data = base of DATA
+DEFINE __len_data = length of DATA
+DEFINE __low_bss = base of BSS
+DEFINE __len_bss = length of BSS
+DEFINE __stack = highaddr of RAM + 1
+DEFINE __heaptop = highaddr of RAM
+DEFINE __heapbot = top of RAM + 1
+DEFINE __low_romcode = copy base of CODE
+DEFINE __low_code = base of CODE
+DEFINE __len_code = length of CODE
+DEFINE __copy_code_to_ram = 0
+DEFINE __crtl = 1
+DEFINE __CS0_LBR_INIT_PARAM = $10
+DEFINE __CS0_UBR_INIT_PARAM = $1f
+DEFINE __CS0_CTL_INIT_PARAM = $a8
+DEFINE __CS0_BMC_INIT_PARAM = $02
+DEFINE __CS1_LBR_INIT_PARAM = $c0
+DEFINE __CS1_UBR_INIT_PARAM = $c7
+DEFINE __CS1_CTL_INIT_PARAM = $28
+DEFINE __CS1_BMC_INIT_PARAM = $02
+DEFINE __CS2_LBR_INIT_PARAM = $80
+DEFINE __CS2_UBR_INIT_PARAM = $bf
+DEFINE __CS2_CTL_INIT_PARAM = $28
+DEFINE __CS2_BMC_INIT_PARAM = $81
+DEFINE __CS3_LBR_INIT_PARAM = $00
+DEFINE __CS3_UBR_INIT_PARAM = $00
+DEFINE __CS3_CTL_INIT_PARAM = $00
+DEFINE __CS3_BMC_INIT_PARAM = $02
+DEFINE __RAM_CTL_INIT_PARAM = $C0
+DEFINE __RAM_ADDR_U_INIT_PARAM = $B7
+DEFINE __FLASH_CTL_INIT_PARAM = $68
+DEFINE __FLASH_ADDR_U_INIT_PARAM = $00
+
+define _SYS_CLK_FREQ = 50000000
+
+define _OSC_FREQ = 50000000
+define _SYS_CLK_SRC = 0
+define _OSC_FREQ_MULT = 1
+define __PLL_CTL0_INIT_PARAM = $40
+
+define _zsl_g_clock_xdefine = 50000000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/ez80f910200zco/poll/poll.zdsproj b/nuttx/configs/ez80f910200zco/poll/poll.zdsproj
new file mode 100755
index 000000000..1e73bb9aa
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/poll.zdsproj
@@ -0,0 +1,247 @@
+<project type="Executable" project-type="Standard" configuration="Debug" created-by="c:4.11:07071801" modified-by="c:4.11:08011102">
+<cpu>eZ80F91</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">_DEBUG,_EZ80F91,_EZ80ACCLAIM!</option>
+<option name="genprintf" type="boolean" change-action="compile">false</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">true</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000000</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">Debug\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Debug\poll.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">..\..\..\nuttx</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">ADDRESS</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B80000-BfFFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_EZ80ACCLAIM!=1,_SIMULATE=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="sdiopt" type="boolean" change-action="compile">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="define" type="string" change-action="compile">NDEBUG,_EZ80F91,_EZ80ACCLAIM!,_SIMULATE</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="optspeed" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">eZ80DevPlatform_F91_Flash</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">0</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">false</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.\Release\</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\Release\poll.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">true</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\Release\poll</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="startuptype" type="string" change-action="build">Included</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="fplib" type="string" change-action="build">Real</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="linkconfig" type="string" change-action="build">Standard</option>
+<option name="flashinfo" type="string" change-action="build">000000-0001FF</option>
+<option name="ram" type="string" change-action="build">B7E000-B7FFFF</option>
+<option name="rom" type="string" change-action="build">000000-03FFFF</option>
+<option name="extio" type="string" change-action="build">000000-00FFFF</option>
+<option name="intio" type="string" change-action="build">000000-0000FF</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">false</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/ez80f910200zco/poll/setenv.sh b/nuttx/configs/ez80f910200zco/poll/setenv.sh
new file mode 100755
index 000000000..38252f8f6
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/poll/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/ez80f910200zco/poll/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_eZ80Acclaim!_4.11.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/ez80f910200zco/src/Makefile b/nuttx/configs/ez80f910200zco/src/Makefile
new file mode 100644
index 000000000..994bb68a6
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/src/Makefile
@@ -0,0 +1,91 @@
+############################################################################
+# configs/ez80f910200zco/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
+USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
+INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = ez80_lowinit.c
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += ez80_leds.c
+endif
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += ez80_buttons.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+
+all: libboard$(LIBEXT)
+
+$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
+ @$(CPP) $(CPPFLAGS) `cygpath -w $<` -o $@.tmp
+ @cat $@.tmp | sed -e "s/^#/;/g" > $@
+ @rm $@.tmp
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ez80f910200zco/src/ez80_buttons.c b/nuttx/configs/ez80f910200zco/src/ez80_buttons.c
new file mode 100644
index 000000000..babf13b7e
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/src/ez80_buttons.c
@@ -0,0 +1,174 @@
+/****************************************************************************
+ * configs/ez80f910200zco/src/ez80_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <nuttx/irq.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_PB/1/2interrupt
+ *
+ * Description:
+ * These could be exteneded to provide interrupt driven button input
+ *
+ ****************************************************************************/
+
+#if 0
+void up_PBinterrupt(void)
+{
+ uint8_t regval;
+
+ regval = inp(EZ80_PB_DR); /* Clear interrupt flag for eZ80F91 date codes before 0611 */
+ regval |= 7;
+ outp(EZ80_PB_DR, regval);
+
+ regval = inp(EZ80_PB_ALT0); /* Clear interrupt flag for eZ80F91 date codes 0611 and after */
+ regval |= 1;
+ outp(EZ80_PB_ALT0, regval);
+}
+
+void up_pb1interrupt(void)
+{
+ uint8_t regval;
+
+ regval = inp(EZ80_PB_DR); /* Clear interrupt flag for eZ80F91 date codes before 0611 */
+ regval |= 7;
+ outp(EZ80_PB_DR, regval);
+
+ regval = inp(EZ80_PB_ALT0); /* Clear interrupt flag for eZ80F91 date codes 0611 and after */
+ regval |= 2;
+ outp(EZ80_PB_ALT0, regval);
+}
+
+void up_pb2interrupt(void)
+{
+ uint8_t regval;
+
+ regval = inp(EZ80_PB_DR); /* Clear interrupt flag for eZ80F91 date codes before 0611 */
+ regval |= 7;
+ outp(EZ80_PB_DR, regval);
+
+ regval = inp(EZ80_PB_ALT0);
+ regval |= 4;
+ outp(EZ80_PB_ALT0, regval); /* Clear interrupt flag for eZ80F91 date codes 0611 and after */
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+void up_buttoninit(void)
+{
+ uint8_t regval;
+
+#if 0 /* Interrupts are not used */
+
+ /* Attach GIO interrupts */
+
+ irq_attach(EZ80_PB_IRQ, up_PBinterrupt);
+ irq_attach(EZ80_PB1_IRQ, up_pb1interrupt);
+ irq_attach(EZ80_PB2_IRQ, up_pb2interrupt);
+
+ /* Configure PB0,1,2 as interrupt, rising edge */
+
+ regval = inp(EZ80_PB_DR);
+ regval |= 7;
+ outp(EZ80_PB_DR, regval);
+
+ regval = inp(EZ80_PB_DDR);
+ regval |= 7;
+ outp(EZ80_PB_DDR, regval);
+
+ regval = inp(EZ80_PB_ALT1);
+ regval |= 7;
+ outp(EZ80_PB_ALT1, regval);
+
+ regval = inp(EZ80_PB_ALT2);
+ regval |= 7;
+ outp(EZ80_PB_ALT2, regval);
+#else
+ /* Configure PB0,1,2 as inputs */
+
+ regval = inp(EZ80_PB_DDR);
+ regval |= 7;
+ outp(EZ80_PB_DDR, regval);
+
+ regval = inp(EZ80_PB_ALT1);
+ regval &= ~7;
+ outp(EZ80_PB_ALT1, regval);
+
+ regval = inp(EZ80_PB_ALT2);
+ regval &= ~7;
+ outp(EZ80_PB_ALT2, regval);
+#endif
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ return inp(EZ80_PB_DDR) & 7;
+}
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/ez80f910200zco/src/ez80_leds.c b/nuttx/configs/ez80f910200zco/src/ez80_leds.c
new file mode 100644
index 000000000..7f5af2075
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/src/ez80_leds.c
@@ -0,0 +1,318 @@
+/****************************************************************************
+ * configs/ez80f910200zco/src/ez80_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "ez80f910200zco.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* 5x7 LED matrix character glyphs. Each glyph consists of 7 bytes, one
+ * each row and each containing 5 bits of data, one for each column
+ */
+
+#if 0 /* Not used */
+static const uint8_t g_chblock[7] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /* block */
+#endif
+
+static const uint8_t g_chspace[7] = {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}; /* space */
+
+#if 0 /* Not used */
+static const uint8_t g_chexclam[7] = {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1f, 0x1b}; /* ! */
+static const uint8_t g_chquote[7] = {0x15, 0x15, 0x15, 0x1f, 0x1f, 0x1f, 0x1f}; /* " */
+static const uint8_t g_chnum[7] = {0x1f, 0x15, 0x00, 0x15, 0x00, 0x15, 0x1f}; /* # */
+static const uint8_t g_chdollar[7] = {0x1b, 0x11, 0x0a, 0x11, 0x0a, 0x11, 0x1b}; /* $ */
+static const uint8_t g_chpct[7] = {0x1f, 0x1e, 0x15, 0x1b, 0x15, 0x0f, 0x1f}; /* % */
+static const uint8_t g_champ[7] = {0x11, 0x0e, 0x0e, 0x11, 0x15, 0x0e, 0x10}; /* & */
+static const uint8_t g_chsquote[7] = {0x1b, 0x1b, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f}; /* ' */
+static const uint8_t g_chlparen[7] = {0x1d, 0x1b, 0x17, 0x17, 0x17, 0x1b, 0x1d}; /* ( */
+static const uint8_t g_chrparen[7] = {0x17, 0x1b, 0x1d, 0x1d, 0x1d, 0x1b, 0x17}; /* ) */
+#endif
+
+static const uint8_t g_chast[7] = {0x1f, 0x0a, 0x11, 0x00, 0x11, 0x0a, 0x1f}; /* * */
+
+#if 0 /* Not used */
+static const uint8_t g_chplus[7] = {0x1f, 0x1b, 0x1b, 0x00, 0x1b, 0x1b, 0x1f}; /* + */
+static const uint8_t g_chcomma[7] = {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1b, 0x17}; /* , */
+static const uint8_t g_chhyphen[7] = {0x1f, 0x1f, 0x1f, 0x00, 0x1f, 0x1f, 0x1f}; /* - */
+static const uint8_t g_chperiod[7] = {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1b}; /* . */
+static const uint8_t g_chslash[7] = {0x1f, 0x1e, 0x1d, 0x1b, 0x17, 0x0f, 0x1f}; /* / */
+#endif
+
+static const uint8_t g_ch0[7] = {0x11, 0x0e, 0x0c, 0x0a, 0x06, 0x0e, 0x11}; /* 0 */
+
+#if 0 /* Not used */
+static const uint8_t g_ch1[7] = {0x1b, 0x13, 0x1b, 0x1b, 0x1b, 0x1b, 0x11}; /* 1 */
+static const uint8_t g_ch2[7] = {0x11, 0x0e, 0x1d, 0x1b, 0x17, 0x0f, 0x00}; /* 2 */
+static const uint8_t g_ch3[7] = {0x11, 0x0e, 0x1e, 0x19, 0x1e, 0x0e, 0x11}; /* 3 */
+static const uint8_t g_ch4[7] = {0x0e, 0x0e, 0x0e, 0x10, 0x1e, 0x1e, 0x1e}; /* 4 */
+static const uint8_t g_ch5[7] = {0x00, 0x0f, 0x0f, 0x01, 0x1e, 0x0e, 0x11}; /* 5 */
+static const uint8_t g_ch6[7] = {0x11, 0x0f, 0x0f, 0x01, 0x0e, 0x0e, 0x11}; /* 6 */
+static const uint8_t g_ch7[7] = {0x00, 0x1e, 0x1e, 0x1d, 0x1b, 0x1b, 0x1b}; /* 7 */
+static const uint8_t g_ch8[7] = {0x11, 0x0e, 0x0e, 0x11, 0x0e, 0x0e, 0x11}; /* 8 */
+static const uint8_t g_ch9[7] = {0x11, 0x0e, 0x0e, 0x10, 0x1e, 0x1d, 0x1b}; /* 9 */
+static const uint8_t g_chcolon[7] = {0x1f, 0x1f, 0x1b, 0x1f, 0x1b, 0x1f, 0x1f}; /* : */
+static const uint8_t g_shsemi[7] = {0x1f, 0x1f, 0x1b, 0x1f, 0x1b, 0x17, 0x1f}; /* ; */
+static const uint8_t g_chlt[7] = {0x1d, 0x1b, 0x17, 0x0f, 0x17, 0x1b, 0x1d}; /* < */
+static const uint8_t g_cheq[7] = {0x1f, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x1f}; /* = */
+static const uint8_t g_chgt[7] = {0x17, 0x1b, 0x1d, 0x1e, 0x1d, 0x1b, 0x17}; /* > */
+static const uint8_t g_chquest[7] = {0x11, 0x0e, 0x0d, 0x1b, 0x1b, 0x1f, 0x1b}; /* ? */
+static const uint8_t g_chat[7] = {0x11, 0x0a, 0x04, 0x04, 0x05, 0x0a, 0x11}; /* @ */
+#endif
+
+static const uint8_t g_chA[7] = {0x11, 0x0e, 0x0e, 0x0e, 0x00, 0x0e, 0x0e}; /* A */
+
+#if 0 /* Not used */
+static const uint8_t g_chB[7] = {0x01, 0x0e, 0x0e, 0x01, 0x0e, 0x0e, 0x01}; /* B */
+#endif
+
+static const uint8_t g_chC[7] = {0x11, 0x0e, 0x0f, 0x0f, 0x0f, 0x0e, 0x11}; /* C */
+
+#if 0 /* Not used */
+static const uint8_t g_chD[7] = {0x01, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x01}; /* D */
+#endif
+
+static const uint8_t g_chE[7] = {0x00, 0x0f, 0x0f, 0x01, 0x0f, 0x0f, 0x00}; /* E */
+
+#if 0 /* Not used */
+static const uint8_t g_chF[7] = {0x00, 0x0f, 0x0f, 0x01, 0x0f, 0x0f, 0x0f}; /* F */
+static const uint8_t g_chG[7] = {0x11, 0x0e, 0x0f, 0x08, 0x0e, 0x0e, 0x11}; /* G */
+#endif
+
+static const uint8_t g_chH[7] = {0x0e, 0x0e, 0x0e, 0x00, 0x0e, 0x0e, 0x0e}; /* H */
+static const uint8_t g_chI[7] = {0x00, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00}; /* I */
+
+#if 0 /* Not used */
+static const uint8_t g_chJ[7] = {0x00, 0x1d, 0x1d, 0x1d, 0x0d, 0x0d, 0x13}; /* J */
+static const uint8_t g_chK[7] = {0x0e, 0x0d, 0x0b, 0x07, 0x0b, 0x0d, 0x0e}; /* K */
+static const uint8_t g_chL[7] = {0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00}; /* L */
+static const uint8_t g_chM[7] = {0x0e, 0x04, 0x0a, 0x0a, 0x0e, 0x0e, 0x0e}; /* M */
+static const uint8_t g_chN[7] = {0x0e, 0x0e, 0x06, 0x0a, 0x0c, 0x0e, 0x0e}; /* N */
+static const uint8_t g_chO[7] = {0x11, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x11}; /* O */
+static const uint8_t g_chP[7] = {0x01, 0x0e, 0x0e, 0x01, 0x0f, 0x0f, 0x0f}; /* P */
+static const uint8_t g_chQ[7] = {0x11, 0x0e, 0x0e, 0x0e, 0x0a, 0x0c, 0x10}; /* Q */
+#endif
+
+static const uint8_t g_chR[7] = {0x01, 0x0e, 0x0e, 0x01, 0x0b, 0x0d, 0x0e}; /* R */
+static const uint8_t g_chS[7] = {0x11, 0x0e, 0x0f, 0x11, 0x1e, 0x0e, 0x11}; /* S */
+
+#if 0 /* Not used */
+static const uint8_t g_chT[7] = {0x00, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b}; /* T */
+static const uint8_t g_chU[7] = {0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x11}; /* U */
+static const uint8_t g_chV[7] = {0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x15, 0x1b}; /* V */
+static const uint8_t g_chW[7] = {0x0e, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x15}; /* W */
+static const uint8_t g_chX[7] = {0x0e, 0x0e, 0x15, 0x1b, 0x15, 0x0e, 0x0e}; /* X */
+static const uint8_t g_chY[7] = {0x0e, 0x0e, 0x15, 0x1b, 0x1b, 0x1b, 0x1b}; /* Y */
+static const uint8_t g_chZ[7] = {0x00, 0x1e, 0x1d, 0x1b, 0x17, 0x0f, 0x00}; /* Z */
+static const uint8_t g_chlbrack[7] = {0x03, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x03}; /* [ */
+static const uint8_t g_chbslash[7] = {0x1f, 0x0f, 0x17, 0x1b, 0x1d, 0x1e, 0x1f}; /* backslash */
+static const uint8_t g_chrbrack[7] = {0x1c, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1c}; /* ] */
+static const uint8_t g_chcaret[7] = {0x1b, 0x15, 0x0e, 0x1f, 0x1f, 0x1f, 0x1f}; /* ^ */
+static const uint8_t g_chunder[7] = {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00}; /* _ */
+static const uint8_t g_chgrave[7] = {0x1b, 0x1b, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f}; /* ' */
+static const uint8_t g_cha[7] = {0x1f, 0x1f, 0x19, 0x16, 0x16, 0x16, 0x18}; /* a */
+static const uint8_t g_chb[7] = {0x17, 0x17, 0x11, 0x16, 0x16, 0x16, 0x11}; /* b */
+static const uint8_t g_chc[7] = {0x1f, 0x1f, 0x19, 0x16, 0x17, 0x16, 0x19}; /* c */
+static const uint8_t g_chd[7] = {0x1e, 0x1e, 0x18, 0x16, 0x16, 0x16, 0x18}; /* d */
+static const uint8_t g_che[7] = {0x1f, 0x1f, 0x19, 0x10, 0x17, 0x16, 0x19}; /* e */
+static const uint8_t g_chf[7] = {0x1d, 0x1a, 0x1b, 0x11, 0x1b, 0x1b, 0x1b}; /* f */
+static const uint8_t g_chg[7] = {0x1f, 0x19, 0x16, 0x16, 0x18, 0x16, 0x19}; /* g */
+static const uint8_t g_chh[7] = {0x17, 0x17, 0x11, 0x16, 0x16, 0x16, 0x16}; /* h */
+static const uint8_t g_chi[7] = {0x1f, 0x1f, 0x1b, 0x1f, 0x1b, 0x1b, 0x1b}; /* i */
+static const uint8_t g_chj[7] = {0x1f, 0x1d, 0x1f, 0x1d, 0x1d, 0x1d, 0x13}; /* j */
+static const uint8_t g_chk[7] = {0x17, 0x17, 0x15, 0x13, 0x13, 0x15, 0x16}; /* k */
+static const uint8_t g_chl[7] = {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b}; /* l */
+static const uint8_t g_chm[7] = {0x1f, 0x1f, 0x05, 0x0a, 0x0a, 0x0a, 0x0a}; /* m */
+static const uint8_t g_chn[7] = {0x1f, 0x1f, 0x11, 0x16, 0x16, 0x16, 0x16}; /* n */
+static const uint8_t g_cho[7] = {0x1f, 0x1f, 0x19, 0x16, 0x16, 0x16, 0x19}; /* o */
+static const uint8_t g_chp[7] = {0x1f, 0x11, 0x16, 0x16, 0x11, 0x17, 0x17}; /* p */
+static const uint8_t g_chq[7] = {0x1f, 0x18, 0x16, 0x16, 0x18, 0x1e, 0x1e}; /* q */
+static const uint8_t g_chr[7] = {0x1f, 0x1f, 0x11, 0x16, 0x17, 0x17, 0x17}; /* r */
+static const uint8_t g_chs[7] = {0x1f, 0x1f, 0x18, 0x17, 0x19, 0x1e, 0x11}; /* s */
+static const uint8_t g_cht[7] = {0x1f, 0x1f, 0x1b, 0x11, 0x1b, 0x1b, 0x1b}; /* t */
+static const uint8_t g_chu[7] = {0x1f, 0x1f, 0x16, 0x16, 0x16, 0x16, 0x18}; /* u */
+static const uint8_t g_chv[7] = {0x1f, 0x1f, 0x16, 0x16, 0x16, 0x16, 0x19}; /* v */
+static const uint8_t g_chw[7] = {0x1f, 0x1f, 0x0a, 0x0a, 0x0a, 0x0a, 0x15}; /* w */
+static const uint8_t g_chx[7] = {0x1f, 0x1f, 0x0e, 0x15, 0x1b, 0x15, 0x0e}; /* x */
+static const uint8_t g_chy[7] = {0x1f, 0x1a, 0x1a, 0x1a, 0x1d, 0x1b, 0x17}; /* y */
+static const uint8_t g_cha[7] = {0x1f, 0x1f, 0x10, 0x1d, 0x1b, 0x17, 0x10}; /* z */
+static const uint8_t g_chlbrace[7] = {0x1d, 0x1b, 0x1b, 0x17, 0x1b, 0x1b, 0x1d}; /* { */
+static const uint8_t g_chvbar[7] = {0x1b, 0x1b, 0x1b, 0x1f, 0x1b, 0x1b, 0x1b}; /* | */
+static const uint8_t g_chrbrace[7] = {0x17, 0x1b, 0x1b, 0x1d, 0x1b, 0x1b, 0x17}; /* } */
+static const uint8_t g_chtilde[7] = {0x1f, 0x1a, 0x15, 0x1f, 0x1f, 0x1f, 0x1f}; /* ~ */
+#endif
+
+/* The current and previously selected glyph */
+
+static const uint8_t *g_currglyph = g_chspace;
+static const uint8_t *g_prevglyph = g_chspace;
+
+/* Current row and column */
+
+static uint8_t g_anodecol = 1;
+static uint8_t g_cathoderow = 0;
+static int8_t g_intcount = 0;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ g_currglyph = g_chspace;
+ g_prevglyph = g_chspace;
+ g_anodecol = 1;
+ g_cathoderow = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ FAR const uint8_t *tmp = g_currglyph;
+ switch (led)
+ {
+ case LED_STARTED:
+ g_currglyph = g_ch0;
+ break;
+
+ case LED_HEAPALLOCATE:
+ g_currglyph = g_chH;
+ break;
+
+ case LED_IRQSENABLED:
+ g_currglyph = g_chE;
+ break;
+
+ case LED_STACKCREATED:
+ g_currglyph = g_chC;
+ break;
+
+ case LED_IDLE:
+ g_currglyph = g_chR;
+ break;
+
+ case LED_INIRQ:
+ g_intcount++;
+ return;
+
+ case LED_ASSERTION:
+ g_currglyph = g_chA;
+ break;
+
+ case LED_SIGNAL:
+ g_currglyph = g_chS;
+ break;
+
+ case LED_PANIC:
+ g_currglyph = g_chast;
+ break;
+
+ default:
+ return;
+ }
+
+ g_prevglyph = tmp;
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ if (led == LED_INIRQ)
+ {
+ g_intcount--;
+ }
+ else if (led == LED_PANIC && g_intcount > 0)
+ {
+ g_currglyph = g_chI;
+ }
+ else
+ {
+ g_currglyph = g_prevglyph;
+ }
+}
+
+/****************************************************************************
+ * Name: up_timerhook
+ ****************************************************************************/
+
+ void up_timerhook(void)
+{
+ if (g_cathoderow > 6)
+ {
+ g_anodecol = 1;
+ g_cathoderow = 0;
+ }
+
+ ez80_putmmreg8(g_anodecol, EZ80_LEDANODE);
+ ez80_putmmreg8(g_currglyph[g_cathoderow], EZ80_LEDCATHODE);
+
+ g_cathoderow++;
+ g_anodecol = g_anodecol << 1;
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ez80f910200zco/src/ez80_lowinit.c b/nuttx/configs/ez80f910200zco/src/ez80_lowinit.c
new file mode 100644
index 000000000..cd52ae158
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/src/ez80_lowinit.c
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * configs/ez80f910200zco/src/ez80_lowinit.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Based upon sample code included with the Zilog ZDS-II toolchain.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ * Included Files
+ ***************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip/chip.h"
+
+/***************************************************************************
+ * Definitions
+ ***************************************************************************/
+
+/***************************************************************************
+ * Private Functions
+ ***************************************************************************/
+
+static void ez80_gpioinit(void)
+{
+}
+
+/***************************************************************************
+ * Public Functions
+ ***************************************************************************/
+
+void ez80_lowinit(void)
+{
+ ez80_gpioinit();
+}
+
diff --git a/nuttx/configs/ez80f910200zco/src/ez80f910200zco.h b/nuttx/configs/ez80f910200zco/src/ez80f910200zco.h
new file mode 100644
index 000000000..b26a0dd3c
--- /dev/null
+++ b/nuttx/configs/ez80f910200zco/src/ez80f910200zco.h
@@ -0,0 +1,151 @@
+/****************************************************************************
+ * arch/ez80f910200zco/src/ez80f910200zco.h
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef _CONFIGS_EZ80F910200ZCO_SRC_EZ80F910200ZCO_H
+#define _CONFIGS_EZ80F910200ZCO_SRC_EZ80F910200ZCO_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Memory map. Board-specific extensions to the basic ez80f91 memory map
+ * (see arch/z80/src/ez80/ez80f91.h
+ */
+ /* CS0: 0x000000 256Kb of on-chip flash */
+#define EZ80_OFFCHIPFLASH 0x400000 /* CS0: Off chip flash (Up to 4Mb-256Kb) */
+#define EZ80_LEDGPIOCNTRL 0x800000 /* CS2: (See below) */
+#define EZ80_PLTFMSRAM 0xb80000 /* CS2: Platform SRAM (512Kb) */
+#define EZ80_MODULESRAM 0xc00000 /* CS1: Module SRAM (up to 2Mb) */
+ /* 0xffc000 On-chip EMAC SRAM (8Kb) */
+ /* 0xffe000 On-chip SRAM (8Kb) */
+
+/* LED and port emulation memory register addresses */
+
+#define EZ80_LEDANODE 0x800000 /* WR: LED anode/GPIO port output control */
+#define EZ80_GPIOCNTRL EZ80_LEDANODE
+#define EZ80_LEDCATHODE 0x800001 /* WR: LED cathode/Modem/Trig */
+#define EZ80_MODEM EZ80_LEDCATHODE
+#define EZ80_TRIGGERS EZ80_LEDCATHODE
+#define EZ80_GPIODATA 0x800002 /* RD/WR: GPIO data */
+
+#define ez80_getmmreg8(a) (*(uint8_t*)(a))
+#define ez80_putmmreg8(v,a) (*(uint8_t*)(a) = (v))
+
+/* LED anode/GPIO port output control bit definitions */
+
+#define EZ80_ANODECOL1 0x01
+#define EZ80_ANODECOL2 0x02
+#define EZ80_ANODECOL3 0x04
+#define EZ80_ANODECOL4 0x08
+#define EZ80_ANODECOL5 0x10
+#define EZ80_ANODECOL6 0x20
+#define EZ80_ANODECOL7 0x40
+#define EZ80_GPIOOUTPUT 0x80
+
+/* LED cathode/Modem/Trig bit definitions */
+
+#define EZ80_CATHODEROW5 0x01
+#define EZ80_CATHODEROW4 0x02
+#define EZ80_CATHODEROW3 0x04
+#define EZ80_CATHODEROW2 0x08
+#define EZ80_CATHODEROW1 0x10
+#define EZ80_MODEMRESET 0x20
+#define EZ80_TRIG1 0x40
+#define EZ80_TRIG2 0x80
+
+/* GPIO data bit definitions */
+
+#define EZ80_GPIOD0 0x01
+#define EZ80_GPIOD1 0x02
+#define EZ80_GPIOD2 0x04
+#define EZ80_GPIOD3 0x08
+#define EZ80_GPIOD4 0x10
+#define EZ80_GPIOD5 0x20
+#define EZ80_GPIOD6 0x40
+#define EZ80_GPIOD7 0x80
+
+/* Modem Signals:
+ *
+ * DCD:
+ * The Data Carrier Detect (DCD) signal at D1 indicates that a good carrier
+ * signal is being received from the remove mode.
+ * RX:
+ * The RX signal at D2 indicates that data is received from the modem.
+ * DTR:
+ * The Data Terminal Ready (DTR) signal at D3 informs the modem that the PC
+ * is ready.
+ * TX:
+ * The TX signal at D4 indicates that data is tranmitted to the modem.
+ */
+
+ /* Push buttons:
+ *
+ * PB0 SW1 Bit 0 of GPIO Port B
+ * PB1 SW2 Bit 1 of GPIO Port B
+ * PB2 SW3 Bit 2 of GPIO Port B
+ * RESET SW4
+ */
+
+#define EZ80_PB0_IRQ EZ80_PORTB0_IRQ /* Vector Oxa0 */
+#define EZ80_PB1_IRQ EZ80_PORTB1_IRQ /* Vector Oxa4 */
+#define EZ80_PB2_IRQ EZ80_PORTB2_IRQ /* Vector Oxa8 */
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* _CONFIGS_EZ80F910200ZCO_SRC_EZ80F910200ZCO_H */
diff --git a/nuttx/configs/fire-stm32v2/Kconfig b/nuttx/configs/fire-stm32v2/Kconfig
new file mode 100644
index 000000000..3f4b857da
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/Kconfig
@@ -0,0 +1,6 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+comment "M3 Wildfire Configuration"
diff --git a/nuttx/configs/fire-stm32v2/README.txt b/nuttx/configs/fire-stm32v2/README.txt
new file mode 100644
index 000000000..d01ba3219
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/README.txt
@@ -0,0 +1,786 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the M3
+Wildfire development board (STM32F103VET6). See http://firestm32.taobao.com
+
+Contents
+========
+
+ - Pin Configuration
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - DFU and JTAG
+ - OpenOCD
+ - LEDs
+ - RTC
+ - M3 Wildfire-specific Configuration Options
+ - Configurations
+
+Pin Configuration
+=================
+--- ------ -------------- -------------------------------------------------------------------
+PIN NAME SIGNAL NOTES
+--- ------ -------------- -------------------------------------------------------------------
+
+1 PE2 PE2-C-RCLK Camera (P9)
+2 PE3 PE3-USB-M USB2.0
+3 PE4 PE4-BEEP LS1 Bell
+4 PE5 (no name) 10Mbps ENC28J60 Interrupt
+5 PE6
+6 VBAT BT1 Battery (BT1)
+7 PC13 Header 7X2
+8 PC14 PC14/OSC32-IN Y2 32.768KHz
+9 PC15 PC15/OSC32-OUT Y2 32.768KHz
+10 VSS_5 DGND
+11 VDD_5 3V3
+12 OSC_IN Y1 8MHz
+13 OSC_OUT Y1 8MHz
+14 NRST REST1 Reset switch
+15 PC0
+16 PC1 PC1/ADC123-IN11 Potentiometer (R16)
+17 PC2
+18 PC3 PC3-LED1 LED1, Active low (pulled high)
+19 VSSA DGND
+20 VREF- DGND
+21 VREF+ 3V3
+22 VDDA 3V3
+23 PA0 PA0-C-VSYNC Camera (P9)
+24 PA1 PC1/ADC123-IN1
+25 PA2 PA2-US2-TX MAX3232, DB9 D7
+
+--- ------ -------------- -------------------------------------------------------------------
+PIN NAME SIGNAL NOTES
+--- ------ -------------- -------------------------------------------------------------------
+
+26 PA3 PA3-US2-RX MAX3232, DB9 D7
+27 VSS_4 DGND
+28 VDD_4 3V3
+29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+33 PC4 PC4-LED2 LED2, Active low (pulled high)
+34 PC5 PC5-LED3 LED3, Active low (pulled high)
+35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open)
+36 PB1 PB1-KEY2 KEY2, Low when closed (pulled high if open)
+37 PB2 BOOT1/DGND
+38 PE7 PE7-FSMC_D4 2.4" TFT + Touchscreen
+39 PE8 PE8-FSMC_D5 2.4" TFT + Touchscreen
+40 PE9 PE9-FSMC_D6 2.4" TFT + Touchscreen
+41 PE10 PE10-FSMC_D7 2.4" TFT + Touchscreen
+42 PE11 PE11-FSMC_D8 2.4" TFT + Touchscreen
+43 PE12 PE12-FSMC_D9 2.4" TFT + Touchscreen
+44 PE13 PE13-FSMC_D10 2.4" TFT + Touchscreen
+45 PE14 PE14-FSMC_D11 2.4" TFT + Touchscreen
+46 PE15 PE15-FSMC_D12 2.4" TFT + Touchscreen
+47 PB10 PB10-C-DO_2 Camera (P9)
+48 PB11 PB11-MP3-RST MP3
+ PB11-C-DO_3 Camera (P9)
+49 VSS_1 DGND
+50 VDD_1 3V3
+
+--- ------ -------------- -------------------------------------------------------------------
+PIN NAME SIGNAL NOTES
+--- ------ -------------- -------------------------------------------------------------------
+
+51 PB12 PB12-SPI2-NSS MP3
+ PB12-C-DO_4 Camera (P9)
+52 PB13 PB13-SPI2-SCK MP3
+ PB13-C-DO_5 Camera (P9)
+53 PB14 PB14-SPI2-MISO MP3
+ PB14-C-DO_6 Camera (P9)
+54 PB15 PB15-SPI2-MOSI MP3
+ PB15-C-DO_7 Camera (P9)
+55 PD8 PD8-FSMC_D13 2.4" TFT + Touchscreen
+56 PD9 PD9-FSMC_D14 2.4" TFT + Touchscreen
+57 PD10 PD10-FSMC_D15 2.4" TFT + Touchscreen
+58 PD11 PD11-FSMC_A16 2.4" TFT + Touchscreen
+59 PD12 C-LED_EN Camera (P9)
+60 PD13 PD13-LCD/LIGHT 2.4" TFT + Touchscreen
+61 PD14 PD14-FSMC_D0 2.4" TFT + Touchscreen
+62 PD15 PD15-FSMC_D1 2.4" TFT + Touchscreen
+63 PC6 PC6-MP3-XDCS MP3
+ PC6-C-SIO_C Camera (P9)
+64 PC7 PC7-MP3-DREQ MP3
+ PC7-C-SIO_D Camera (P9)
+65 PC8 PC8-SDIO-D0 SD card, pulled high
+66 PC9 PC9-SDIO-D1 SD card, pulled high
+67 PA8 PA8-C-XCLK Camera (P9)
+68 PA9 PA9-US1-TX MAX3232, DB9 D8
+69 PA10 PA10-US1-RX MAX3232, DB9 D8
+70 PA11 PA11-USBDM USB2.0
+71 PA12 PA12-USBDP USB2.0
+72 PA13 PA13-JTMS JTAG
+73 N/C
+74 VSS_2 DGND
+75 VDD_2 3V3
+
+--- ------ -------------- -------------------------------------------------------------------
+PIN NAME SIGNAL NOTES
+--- ------ -------------- -------------------------------------------------------------------
+
+76 PA14 PA14-JTCK JTAG
+77 PA15 PA15-JTDI JTAG
+78 PC10 PC10-SDIO-D2 SD card, pulled high
+79 PC11 PC10-SDIO-D3 SD card, pulled high
+80 PC12 PC12-SDIO-CLK SD card
+81 PD0 PD0-FSMC_D2 2.4" TFT + Touchscreen
+82 PD1 PD1-FSMC_D3 2.4" TFT + Touchscreen
+83 PD2 PD2-SDIO-CMD SD card, pulled high
+84 PD3 PD3-C-WEN Camera (P9)
+85 PD4 PD4-FSMC_NOE 2.4" TFT + Touchscreen
+86 PD5 PD5-FSMC_NWE 2.4" TFT + Touchscreen
+87 PD6 PD6-C-OE Camera (P9)
+88 PD7 PD7-FSMC_NE1 2.4" TFT + Touchscreen
+89 PB3 PB3-JTDO JTAG
+90 PB4 PB4-NJTRST JTAG
+91 PB5 PB5-C-WRST Camera (P9)
+92 PB6 PB6-I2C1-SCL 2.4" TFT + Touchscreen, AT24C02
+93 PB7 PB7-I2C1-SDA 2.4" TFT + Touchscreen, AT24C02
+94 BOOT0 SW3 3V3 or DGND
+95 PB8 PB8-CAN-RX CAN tranceiver, Header 2H
+ PB8-C-DO_0 Camera (P9)
+96 PB9 PB9-CAN-TX CAN tranceiver, Header 2H
+ PB9-C-DO_1 Camera (P9)
+97 PE0 PE0-C-RRST Camera (P9)
+98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen
+99 VSS_3 DGND
+100 VDD_3 3V3
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the CodeSourcery Toolchain. The Raisonance R-Link
+ emulatator and some RIDE7 development tools were used and those tools works
+ only under Windows.
+
+GNU Toolchain Options
+=====================
+
+ Toolchain Configurations
+ ------------------------
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The Atollic Toolchain,
+ 3. The devkitARM GNU toolchain,
+ 4. Raisonance GNU toolchain, or
+ 5. The NuttX buildroot Toolchain (see below).
+
+ Most testing has been conducted using the CodeSourcery toolchain for Windows and
+ that is the default toolchain in most configurations. To use the Atollic,
+ devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_ATOLLIC_LITE=y : The free, "Lite" version of Atollic toolchain under Windows
+ CONFIG_STM32_ATOLLIC_PRO=y : The paid, "Pro" version of Atollic toolchain under Windows
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you change the default toolchain, then you may also have to modify the PATH in
+ the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), Atollic, devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcery (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ The CodeSourcery Toolchain (2009q1)
+ -----------------------------------
+ The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ The Atollic "Pro" and "Lite" Toolchain
+ --------------------------------------
+ One problem that I had with the Atollic toolchains is that the provide a gcc.exe
+ and g++.exe in the same bin/ file as their ARM binaries. If the Atollic bin/ path
+ appears in your PATH variable before /usr/bin, then you will get the wrong gcc
+ when you try to build host executables. This will cause to strange, uninterpretable
+ errors build some host binaries in tools/ when you first make.
+
+ The Atollic "Lite" Toolchain
+ ----------------------------
+ The free, "Lite" version of the Atollic toolchain does not support C++ nor
+ does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
+ toolchain, you will have to set:
+
+ CONFIG_HAVE_CXX=n
+
+ In order to compile successfully. Otherwise, you will get errors like:
+
+ "C++ Compiler only available in TrueSTUDIO Professional"
+
+ The make may then fail in some of the post link processing because of some of
+ the other missing tools. The Make.defs file replaces the ar and nm with
+ the default system x86 tool versions and these seem to work okay. Disable all
+ of the following to avoid using objcopy:
+
+ CONFIG_RRLOAD_BINARY=n
+ CONFIG_INTELHEX_BINARY=n
+ CONFIG_MOTOROLA_SREC=n
+ CONFIG_RAW_BINARY=n
+
+ devkitARM
+ ---------
+ The devkitARM toolchain includes a version of MSYS make. Make sure that the
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh fire-stm32v2/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+DFU and JTAG
+============
+
+ Enbling Support for the DFU Bootloader
+ --------------------------------------
+ The linker files in these projects can be configured to indicate that you
+ will be loading code using STMicro built-in USB Device Firmware Upgrade (DFU)
+ loader or via some JTAG emulator. You can specify the DFU bootloader by
+ adding the following line:
+
+ CONFIG_STM32_DFU=y
+
+ to your .config file. Most of the configurations in this directory are set
+ up to use the DFU loader.
+
+ If CONFIG_STM32_DFU is defined, the code will not be positioned at the beginning
+ of FLASH (0x08000000) but will be offset to 0x08003000. This offset is needed
+ to make space for the DFU loader and 0x08003000 is where the DFU loader expects
+ to find new applications at boot time. If you need to change that origin for some
+ other bootloader, you will need to edit the file(s) ld.script.dfu for the
+ configuration.
+
+ The DFU SE PC-based software is available from the STMicro website,
+ http://www.st.com. General usage instructions:
+
+ 1. Convert the NuttX Intel Hex file (nuttx.hex) into a special DFU
+ file (nuttx.dfu)... see below for details.
+ 2. Connect the M3 Wildfire board to your computer using a USB
+ cable.
+ 3. Start the DFU loader on the M3 Wildfire board. You do this by
+ resetting the board while holding the "Key" button. Windows should
+ recognize that the DFU loader has been installed.
+ 3. Run the DFU SE program to load nuttx.dfu into FLASH.
+
+ What if the DFU loader is not in FLASH? The loader code is available
+ inside of the Demo dirctory of the USBLib ZIP file that can be downloaded
+ from the STMicro Website. You can build it using RIDE (or other toolchains);
+ you will need a JTAG emulator to burn it into FLASH the first time.
+
+ In order to use STMicro's built-in DFU loader, you will have to get
+ the NuttX binary into a special format with a .dfu extension. The
+ DFU SE PC_based software installation includes a file "DFU File Manager"
+ conversion program that a file in Intel Hex format to the special DFU
+ format. When you successfully build NuttX, you will find a file called
+ nutt.hex in the top-level directory. That is the file that you should
+ provide to the DFU File Manager. You will end up with a file called
+ nuttx.dfu that you can use with the STMicro DFU SE program.
+
+ Enabling JTAG
+ -------------
+ If you are not using the DFU, then you will probably also need to enable
+ JTAG support. By default, all JTAG support is disabled but there NuttX
+ configuration options to enable JTAG in various different ways.
+
+ These configurations effect the setting of the SWJ_CFG[2:0] bits in the AFIO
+ MAPR register. These bits are used to configure the SWJ and trace alternate function I/Os. The SWJ (SerialWire JTAG) supports JTAG or SWD access to the
+ Cortex debug port. The default state in this port is for all JTAG support
+ to be disable.
+
+ CONFIG_STM32_JTAG_FULL_ENABLE - sets SWJ_CFG[2:0] to 000 which enables full
+ SWJ (JTAG-DP + SW-DP)
+
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - sets SWJ_CFG[2:0] to 001 which enable
+ full SWJ (JTAG-DP + SW-DP) but without JNTRST.
+
+ CONFIG_STM32_JTAG_SW_ENABLE - sets SWJ_CFG[2:0] to 010 which would set JTAG-DP
+ disabled and SW-DP enabled
+
+ The default setting (none of the above defined) is SWJ_CFG[2:0] set to 100
+ which disable JTAG-DP and SW-DP.
+
+OpenOCD
+=======
+
+I have also used OpenOCD with the M3 Wildfire. In this case, I used
+the Olimex USB ARM OCD. See the script in configs/fire-stm32v2/tools/oocd.sh
+for more information. Using the script:
+
+1) Start the OpenOCD GDB server
+
+ cd <nuttx-build-directory>
+ configs/fire-stm32v2/tools/oocd.sh $PWD
+
+2) Load Nuttx
+
+ cd <nuttx-built-directory>
+ arm-none-eabi-gdb nuttx
+ gdb> target remote localhost:3333
+ gdb> mon reset
+ gdb> mon halt
+ gdb> load nuttx
+
+3) Running NuttX
+
+ gdb> mon reset
+ gdb> c
+
+LEDs
+====
+
+The M3 Wildfire has 3 LEDs labeled LED1, LED2 and LED3. These LEDs are not
+used by the NuttX port unless CONFIG_ARCH_LEDS is defined. In that case, the
+usage by the board port is defined in include/board.h and src/up_autoleds.c.
+The LEDs are used to encode OS-related events as follows:
+
+ /* LED1 LED2 LED3 */
+ #define LED_STARTED 0 /* OFF OFF OFF */
+ #define LED_HEAPALLOCATE 1 /* ON OFF OFF */
+ #define LED_IRQSENABLED 2 /* OFF ON OFF */
+ #define LED_STACKCREATED 3 /* OFF OFF OFF */
+
+ #define LED_INIRQ 4 /* NC NC ON (momentary) */
+ #define LED_SIGNAL 5 /* NC NC ON (momentary) */
+ #define LED_ASSERTION 6 /* NC NC ON (momentary) */
+ #define LED_PANIC 7 /* NC NC ON (2Hz flashing) */
+ #undef LED_IDLE /* Sleep mode indication not supported */
+
+RTC
+===
+
+ The STM32 RTC may configured using the following settings.
+
+ CONFIG_RTC - Enables general support for a hardware RTC. Specific
+ architectures may require other specific settings.
+ CONFIG_RTC_HIRES - The typical RTC keeps time to resolution of 1
+ second, usually supporting a 32-bit time_t value. In this case,
+ the RTC is used to &quot;seed&quot; the normal NuttX timer and the
+ NuttX timer provides for higher resoution time. If CONFIG_RTC_HIRES
+ is enabled in the NuttX configuration, then the RTC provides higher
+ resolution time and completely replaces the system timer for purpose of
+ date and time.
+ CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the
+ frequency of the high resolution RTC must be provided. If CONFIG_RTC_HIRES
+ is not defined, CONFIG_RTC_FREQUENCY is assumed to be one.
+ CONFIG_RTC_ALARM - Enable if the RTC hardware supports setting of an alarm.
+ A callback function will be executed when the alarm goes off
+
+ In hi-res mode, the STM32 RTC operates only at 16384Hz. Overflow interrupts
+ are handled when the 32-bit RTC counter overflows every 3 days and 43 minutes.
+ A BKP register is incremented on each overflow interrupt creating, effectively,
+ a 48-bit RTC counter.
+
+ In the lo-res mode, the RTC operates at 1Hz. Overflow interrupts are not handled
+ (because the next overflow is not expected until the year 2106.
+
+ WARNING: Overflow interrupts are lost whenever the STM32 is powered down. The
+ overflow interrupt may be lost even if the STM32 is powered down only momentarily.
+ Therefore hi-res solution is only useful in systems where the power is always on.
+
+M3 Wildfire-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32
+ CONFIG_ARCH_CHIP_STM32F103VET6
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=fire-stm32v2 (for the M3 Wildfire development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_FIRE_STM32V2=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The STM32F103Z supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ AHB
+ ---
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_CRC
+ CONFIG_STM32_FSMC
+ CONFIG_STM32_SDIO
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI4
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_USB
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_BKP
+ CONFIG_STM32_PWR
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_USB
+
+ APB2
+ ----
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_ADC3
+
+ Timer and I2C devices may need to the following to force power to be applied
+ unconditionally at power up. (Otherwise, the device is powered when it is
+ initialized).
+
+ CONFIG_STM32_FORCEPOWER
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,8
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,8
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,8, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,8
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,8, m=1,..,2
+
+ For each timer that is enabled for PWM usage, we need the following additional
+ configuration settings:
+
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+
+ NOTE: The STM32 timers are each capable of generating different signals on
+ each of the four channels with different duty cycles. That capability is
+ not supported by this driver: Only one output channel per timer.
+
+ Alternate pin mappings. The M3 Wildfire board requires only CAN1 remapping
+ On the M3 Wildfire board pin PB9 is wired as TX and pin PB8 is wired as RX.
+ Which then makes the proper connection through the CAN transiver SN65HVD230
+ out to the CAN D-type 9-pn male connector where pin 2 is CANL and pin 7 is CANH.
+
+ CONFIG_STM32_TIM1_FULL_REMAP
+ CONFIG_STM32_TIM1_PARTIAL_REMAP
+ CONFIG_STM32_TIM2_FULL_REMAP
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_1
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_2
+ CONFIG_STM32_TIM3_FULL_REMAP
+ CONFIG_STM32_TIM3_PARTIAL_REMAP
+ CONFIG_STM32_TIM4_REMAP
+ CONFIG_STM32_USART1_REMAP
+ CONFIG_STM32_USART2_REMAP
+ CONFIG_STM32_USART3_FULL_REMAP
+ CONFIG_STM32_USART3_PARTIAL_REMAP
+ CONFIG_STM32_SPI1_REMAP
+ CONFIG_STM32_SPI3_REMAP
+ CONFIG_STM32_I2C1_REMAP
+ CONFIG_STM32_CAN1_REMAP1
+ CONFIG_STM32_CAN1_REMAP2
+ CONFIG_STM32_CAN2_REMAP
+
+ JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+
+ STM32F103Z specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+
+ M3 Wildfire CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ M3 Wildfire LCD Hardware Configuration
+
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. Default is this 320x240 "landscape" orientation
+ (this setting is informative only... not used).
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support. In this orientation, the M3 Wildfire's
+ LCD ribbon cable is at the bottom of the display. Default is
+ 320x240 "landscape" orientation.
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support. In this orientation, the
+ M3 Wildfire's LCD ribbon cable is at the top of the display.
+ Default is 320x240 "landscape" orientation.
+ CONFIG_LCD_BACKLIGHT - Define to support a backlight.
+ CONFIG_LCD_PWM - If CONFIG_STM32_TIM1 is also defined, then an
+ adjustable backlight will be provided using timer 1 to generate
+ various pulse widthes. The granularity of the settings is
+ determined by CONFIG_LCD_MAXPOWER. If CONFIG_LCD_PWM (or
+ CONFIG_STM32_TIM1) is not defined, then a simple on/off backlight
+ is provided.
+ CONFIG_LCD_RDSHIFT - When reading 16-bit gram data, there appears
+ to be a shift in the returned data. This value fixes the offset.
+ Default 5.
+
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using:
+
+ CONFIG_STM32_AM240320_DISABLE
+ CONFIG_STM32_SPFD5408B_DISABLE
+ CONFIG_STM32_R61580_DISABLE
+
+Configurations
+==============
+
+Each M3 Wildfire configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh fire-stm32v2/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh
+ ---
+ Configure the NuttShell (nsh) located at examples/nsh. The nsh configuration
+ contains support for some built-in applications that can be enabled by making
+ some additional minor change to the configuration file.
+
+ NOTE: This configuration uses to the mconf configuration tool to control
+ the configuration. See the section entitled "NuttX Configuration Tool"
+ in the top-level README.txt file.
+
+ STATUS: The board port is basically functional. Not all features have been
+ verified. The ENC28J60 network is not yet functional. Networking is
+ enabled by default in this configuration for testing purposes. To use this
+ configuration, the network must currently be disabled. To do this using
+ the mconf configuration tool:
+
+ > make menuconfig
+
+ Then de-select "Networking Support" -> "Networking Support"
+
+ UPDATE: The primary problem with the ENC29J60 is a v2 board issue: The
+ SPI FLASH and the ENC28J60 shared the same SPI chip select signal (PA4-SPI1-NSS).
+ In order to finish the debug of the ENC28J60, it may be necessary to lift
+ the SPI FLASH chip select pin from the board.
+
diff --git a/nuttx/configs/fire-stm32v2/include/board.h b/nuttx/configs/fire-stm32v2/include/board.h
new file mode 100644
index 000000000..9a5d309ab
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/include/board.h
@@ -0,0 +1,442 @@
+/************************************************************************************
+ * configs/fire-stm32v2/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_FIRE_STM32V2_INCLUDE_BOARD_H
+#define __CONFIGS_FIRE_STM32V2_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* On-board crystal frequency is 8MHz (HSE) */
+
+#define STM32_BOARD_XTAL 8000000ul
+
+/* PLL source is HSE/1, PLL multipler is 9: PLL frequency is 8MHz (XTAL) x 9 = 72MHz */
+
+#define STM32_CFGR_PLLSRC RCC_CFGR_PLLSRC
+#define STM32_CFGR_PLLXTPRE 0
+#define STM32_CFGR_PLLMUL RCC_CFGR_PLLMUL_CLKx9
+#define STM32_PLL_FREQUENCY (9*STM32_BOARD_XTAL)
+
+/* Use the PLL and set the SYSCLK source to be the PLL */
+
+#define STM32_SYSCLK_SW RCC_CFGR_SW_PLL
+#define STM32_SYSCLK_SWS RCC_CFGR_SWS_PLL
+#define STM32_SYSCLK_FREQUENCY STM32_PLL_FREQUENCY
+
+/* AHB clock (HCLK) is SYSCLK (72MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
+#define STM32_HCLK_FREQUENCY STM32_PLL_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB2 clock (PCLK2) is HCLK (72MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
+#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_APB2_CLKIN (STM32_PCLK2_FREQUENCY) /* Timers 2-7, 12-14 */
+
+/* APB2 timers 1 and 8 will receive PCLK2. */
+
+#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
+
+/* APB1 clock (PCLK1) is HCLK/2 (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd2
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB1 timers 2-4 will be twice PCLK1 (I presume the remaining will receive PCLK1) */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
+
+/* USB divider -- Divide PLL clock by 1.5 */
+
+#define STM32_CFGR_USBPRE 0
+
+/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
+ * otherwise frequency is 2xAPBx.
+ * Note: TIM1,8 are on APB2, others on APB1 */
+
+#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode. These values have not been
+ * tuned!!!
+ *
+ * HCLK=72MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(178+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (178 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_MMCXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_SDXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* LED definitions ******************************************************************/
+/* The M3 Wildfire has 3 LEDs labeled LED1, LED2 and LED3. These LEDs are not
+ * used by the NuttX port unless CONFIG_ARCH_LEDS is defined. In that case, the
+ * usage by the board port is defined in include/board.h and src/up_autoleds.c.
+ * The LEDs are used to encode OS-related events as follows:
+ */
+ /* LED1 LED2 LED3 */
+#define LED_STARTED 0 /* OFF OFF OFF */
+#define LED_HEAPALLOCATE 1 /* ON OFF OFF */
+#define LED_IRQSENABLED 2 /* OFF ON OFF */
+#define LED_STACKCREATED 3 /* OFF OFF OFF */
+
+#define LED_INIRQ 4 /* NC NC ON (momentary) */
+#define LED_SIGNAL 4 /* NC NC ON (momentary) */
+#define LED_ASSERTION 4 /* NC NC ON (momentary) */
+#define LED_PANIC 4 /* NC NC ON (2Hz flashing) */
+#undef LED_IDLE /* Sleep mode indication not supported */
+
+/* The M3 Wildfire supports several two user buttons: KEY1 and KEY2 */
+
+#define BUTTON_KEY1 0
+#define BUTTON_KEY2 1
+#define NUM_BUTTONS 2
+
+#define BUTTON_KEY1_BIT (1 << BUTTON_KEY1)
+#define BUTTON_KEY2_BIT (1 << BUTTON_KEY2)
+
+/* Pin Remapping ********************************************************************/
+/* USB 2.0
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 70 PA11 PA11-USBDM USB2.0
+ * 71 PA12 PA12-USBDP USB2.0
+ * 2 PE3 PE3-USB-M USB2.0
+ */
+
+/* 2.4" TFT + Touchscreen
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 92 PB6 PB6-I2C1-SCL 2.4" TFT + Touchscreen, AT24C02
+ * 93 PB7 PB7-I2C1-SDA 2.4" TFT + Touchscreen, AT24C02
+ * 81 PD0 PD0-FSMC_D2 2.4" TFT + Touchscreen
+ * 82 PD1 PD1-FSMC_D3 2.4" TFT + Touchscreen
+ * 85 PD4 PD4-FSMC_NOE 2.4" TFT + Touchscreen
+ * 86 PD5 PD5-FSMC_NWE 2.4" TFT + Touchscreen
+ * 88 PD7 PD7-FSMC_NE1 2.4" TFT + Touchscreen
+ * 55 PD8 PD8-FSMC_D13 2.4" TFT + Touchscreen
+ * 56 PD9 PD9-FSMC_D14 2.4" TFT + Touchscreen
+ * 57 PD10 PD10-FSMC_D15 2.4" TFT + Touchscreen
+ * 58 PD11 PD11-FSMC_A16 2.4" TFT + Touchscreen
+ * 60 PD13 PD13-LCD/LIGHT 2.4" TFT + Touchscreen
+ * 61 PD14 PD14-FSMC_D0 2.4" TFT + Touchscreen
+ * 62 PD15 PD15-FSMC_D1 2.4" TFT + Touchscreen
+ * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen, 10Mbit EN28J60 Reset
+ * 38 PE7 PE7-FSMC_D4 2.4" TFT + Touchscreen
+ * 39 PE8 PE8-FSMC_D5 2.4" TFT + Touchscreen
+ * 40 PE9 PE9-FSMC_D6 2.4" TFT + Touchscreen
+ * 41 PE10 PE10-FSMC_D7 2.4" TFT + Touchscreen
+ * 42 PE11 PE11-FSMC_D8 2.4" TFT + Touchscreen
+ * 43 PE12 PE12-FSMC_D9 2.4" TFT + Touchscreen
+ * 44 PE13 PE13-FSMC_D10 2.4" TFT + Touchscreen
+ * 45 PE14 PE14-FSMC_D11 2.4" TFT + Touchscreen
+ * 46 PE15 PE15-FSMC_D12 2.4" TFT + Touchscreen
+ */
+
+#if defined(CONFIG_STM32_SPI1) && defined(CONFIG_STM32_SPI1_REMAP)
+# error "SPI1 requires CONFIG_STM32_SPI1_REMAP=n"
+#endif
+
+#if defined(CONFIG_STM32_I2C1) && defined(CONFIG_STM32_I2C1_REMAP)
+# error "SPI1 requires CONFIG_STM32_I2C1_REMAP=n"
+#endif
+
+/* AT24C02
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 92 PB6 PB6-I2C1-SCL 2.4" TFT + Touchscreen, AT24C02
+ * 93 PB7 PB7-I2C1-SDA 2.4" TFT + Touchscreen, AT24C02
+ */
+
+#if defined(CONFIG_STM32_I2C1) && defined(CONFIG_STM32_I2C1_REMAP)
+# error "SPI1 requires CONFIG_STM32_I2C1_REMAP=n"
+#endif
+
+/* Potentiometer/ADC
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 16 PC1 PC1/ADC123-IN11 Potentiometer (R16)
+ * 24 PA1 PC1/ADC123-IN1
+ */
+
+/* USARTs
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 68 PA9 PA9-US1-TX MAX3232, DB9 D8, Requires !CONFIG_STM32_USART1_REMAP
+ * 69 PA10 PA10-US1-RX MAX3232, DB9 D8, Requires !CONFIG_STM32_USART1_REMAP
+ * 25 PA2 PA2-US2-TX MAX3232, DB9 D7, Requires !CONFIG_STM32_USART2_REMAP
+ * 26 PA3 PA3-US2-RX MAX3232, DB9 D7, Requires !CONFIG_STM32_USART2_REMAP
+ */
+
+#if defined(CONFIG_STM32_USART1) && defined(CONFIG_STM32_USART1_REMAP)
+# errror "USART1 requires CONFIG_STM32_USART1_REMAP=n"
+#endif
+
+#if defined(CONFIG_STM32_USART2) && defined(CONFIG_STM32_USART2_REMAP)
+# errror "USART2 requires CONFIG_STM32_USART2_REMAP=n"
+#endif
+
+/* 2MBit SPI FLASH
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ */
+
+#if defined(CONFIG_STM32_SPI1) && defined(CONFIG_STM32_SPI1_REMAP)
+# error "SPI1 requires CONFIG_STM32_SPI1_REMAP=n"
+#endif
+
+/* ENC28J60
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen, 10Mbit EN28J60 Reset
+ * 4 PE5 (no name) 10Mbps ENC28J60 Interrupt
+ */
+
+#if defined(CONFIG_STM32_SPI1) && defined(CONFIG_STM32_SPI1_REMAP)
+# error "SPI1 requires CONFIG_STM32_SPI1_REMAP=n"
+#endif
+
+/* MP3
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 48 PB11 PB11-MP3-RST MP3
+ * 51 PB12 PB12-SPI2-NSS MP3
+ * 52 PB13 PB13-SPI2-SCK MP3
+ * 53 PB14 PB14-SPI2-MISO MP3
+ * 54 PB15 PB15-SPI2-MOSI MP3
+ * 63 PC6 PC6-MP3-XDCS MP3
+ * 64 PC7 PC7-MP3-DREQ MP3
+ */
+
+/* SD Card
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 65 PC8 PC8-SDIO-D0 SD card, pulled high
+ * 66 PC9 PC9-SDIO-D1 SD card, pulled high
+ * 78 PC10 PC10-SDIO-D2 SD card, pulled high
+ * 79 PC11 PC10-SDIO-D3 SD card, pulled high
+ * 80 PC12 PC12-SDIO-CLK SD card
+ * 83 PD2 PD2-SDIO-CMD SD card, pulled high
+ */
+
+/* CAN
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 95 PB8 PB8-CAN-RX CAN tranceiver, Header 2H
+ * 96 PB9 PB9-CAN-TX CAN tranceiver, Header 2H
+ */
+
+#if defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN1_REMAP1)
+# error "SPI1 requires CONFIG_STM32_CAN1_REMAP1=y"
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+/************************************************************************************
+ * Name: stm32_ledinit, stm32_setled, and stm32_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
+ * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * control the LEDs from user applications.
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void stm32_ledinit(void);
+EXTERN void stm32_setled(int led, bool ledon);
+EXTERN void stm32_setleds(uint8_t ledset);
+#endif
+
+/************************************************************************************
+ * Name: fire_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the M3 Wildfire board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * dispaly is cleared by simply setting all GRAM memory to the specified color.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+EXTERN void fire_lcdclear(uint16_t color);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_FIRE_STM32V2_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/fire-stm32v2/nsh/Make.defs b/nuttx/configs/fire-stm32v2/nsh/Make.defs
new file mode 100644
index 000000000..cbe3b08c8
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/nsh/Make.defs
@@ -0,0 +1,196 @@
+############################################################################
+# configs/fire-stm32v2/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+# Pick the linker script
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/fire-stm32v2/nsh/defconfig b/nuttx/configs/fire-stm32v2/nsh/defconfig
new file mode 100644
index 000000000..1a849ad36
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/nsh/defconfig
@@ -0,0 +1,980 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+CONFIG_INTELHEX_BINARY=y
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+CONFIG_ARCH_ARM=y
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="arm"
+# CONFIG_ARCH_CHIP_C5471 is not set
+# CONFIG_ARCH_CHIP_CALYPSO is not set
+# CONFIG_ARCH_CHIP_DM320 is not set
+# CONFIG_ARCH_CHIP_IMX is not set
+# CONFIG_ARCH_CHIP_KINETIS is not set
+# CONFIG_ARCH_CHIP_LM3S is not set
+# CONFIG_ARCH_CHIP_LPC17XX is not set
+# CONFIG_ARCH_CHIP_LPC214X is not set
+# CONFIG_ARCH_CHIP_LPC2378 is not set
+# CONFIG_ARCH_CHIP_LPC31XX is not set
+# CONFIG_ARCH_CHIP_LPC43XX is not set
+# CONFIG_ARCH_CHIP_SAM3U is not set
+CONFIG_ARCH_CHIP_STM32=y
+# CONFIG_ARCH_CHIP_STR71X is not set
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_FAMILY="armv7-m"
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_HAVE_MPU=y
+# CONFIG_ARMV7M_MPU is not set
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+# CONFIG_ARCH_CALIBRATION is not set
+# CONFIG_SERIAL_TERMIOS is not set
+# CONFIG_NET_MULTICAST is not set
+
+#
+# STM32 Configuration Options
+#
+# CONFIG_ARCH_CHIP_STM32F100C8 is not set
+# CONFIG_ARCH_CHIP_STM32F100CB is not set
+# CONFIG_ARCH_CHIP_STM32F100R8 is not set
+# CONFIG_ARCH_CHIP_STM32F100RB is not set
+# CONFIG_ARCH_CHIP_STM32F100V8 is not set
+# CONFIG_ARCH_CHIP_STM32F100VB is not set
+# CONFIG_ARCH_CHIP_STM32F103RET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set
+CONFIG_ARCH_CHIP_STM32F103VET6=y
+# CONFIG_ARCH_CHIP_STM32F103ZET6 is not set
+# CONFIG_ARCH_CHIP_STM32F105VBT7 is not set
+# CONFIG_ARCH_CHIP_STM32F107VC is not set
+# CONFIG_ARCH_CHIP_STM32F207IG is not set
+# CONFIG_ARCH_CHIP_STM32F405RG is not set
+# CONFIG_ARCH_CHIP_STM32F405VG is not set
+# CONFIG_ARCH_CHIP_STM32F405ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407VE is not set
+# CONFIG_ARCH_CHIP_STM32F407VG is not set
+# CONFIG_ARCH_CHIP_STM32F407ZE is not set
+# CONFIG_ARCH_CHIP_STM32F407ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407IE is not set
+# CONFIG_ARCH_CHIP_STM32F407IG is not set
+CONFIG_STM32_STM32F10XX=y
+CONFIG_STM32_HIGHDENSITY=y
+CONFIG_STM32_CODESOURCERYW=y
+# CONFIG_STM32_CODESOURCERYL is not set
+# CONFIG_STM32_ATOLLIC_LITE is not set
+# CONFIG_STM32_ATOLLIC_PRO is not set
+# CONFIG_STM32_DEVKITARM is not set
+# CONFIG_STM32_RAISONANCE is not set
+# CONFIG_STM32_BUILDROOT is not set
+# CONFIG_STM32_DFU is not set
+
+#
+# STM32 Peripheral Support
+#
+# CONFIG_STM32_ADC1 is not set
+# CONFIG_STM32_ADC2 is not set
+# CONFIG_STM32_ADC3 is not set
+# CONFIG_STM32_CRC is not set
+# CONFIG_STM32_DMA1 is not set
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_BKP=y
+# CONFIG_STM32_CAN1 is not set
+# CONFIG_STM32_DAC1 is not set
+# CONFIG_STM32_DAC2 is not set
+# CONFIG_STM32_FSMC is not set
+CONFIG_STM32_I2C1=y
+# CONFIG_STM32_I2C2 is not set
+# CONFIG_STM32_IWDG is not set
+CONFIG_STM32_PWR=y
+CONFIG_STM32_SDIO=y
+CONFIG_STM32_SPI1=y
+# CONFIG_STM32_SPI2 is not set
+# CONFIG_STM32_SPI4 is not set
+# CONFIG_STM32_TIM1 is not set
+# CONFIG_STM32_TIM2 is not set
+# CONFIG_STM32_TIM3 is not set
+# CONFIG_STM32_TIM4 is not set
+# CONFIG_STM32_TIM5 is not set
+# CONFIG_STM32_TIM6 is not set
+# CONFIG_STM32_TIM7 is not set
+# CONFIG_STM32_TIM8 is not set
+CONFIG_STM32_USART1=y
+CONFIG_STM32_USART2=y
+# CONFIG_STM32_USART3 is not set
+# CONFIG_STM32_UART4 is not set
+# CONFIG_STM32_UART5 is not set
+CONFIG_STM32_USB=y
+# CONFIG_STM32_WWDG is not set
+CONFIG_STM32_SPI=y
+
+#
+# Alternate Pin Mapping
+#
+# CONFIG_STM32_USART1_REMAP is not set
+# CONFIG_STM32_USART2_REMAP is not set
+# CONFIG_STM32_SPI1_REMAP is not set
+# CONFIG_STM32_I2C1_REMAP is not set
+# CONFIG_STM32_JTAG_DISABLE is not set
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set
+# CONFIG_STM32_JTAG_SW_ENABLE is not set
+# CONFIG_STM32_FORCEPOWER is not set
+# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
+
+#
+# SPI Configuration
+#
+# CONFIG_STM32_SPI_INTERRUPTS is not set
+# CONFIG_STM32_SPI_DMA is not set
+
+#
+# SDIO Configuration
+#
+CONFIG_SDIO_DMA=y
+CONFIG_SDIO_PRI=128
+CONFIG_SDIO_DMAPRIO=0x00001000
+# CONFIG_SDIO_WIDTH_D1_ONLY is not set
+
+#
+# Ethernet MAC configuration
+#
+CONFIG_STM32_PHYADDR=1
+
+#
+# USB Host Configuration
+#
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+CONFIG_ARCH_DMA=y
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# Board Settings
+#
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+# CONFIG_ARCH_INTERRUPTSTACK is not set
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_FIRE_STM32V2=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="fire-stm32v2"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_HAVE_BUTTONS=y
+# CONFIG_ARCH_BUTTONS is not set
+CONFIG_ARCH_HAVE_IRQBUTTONS=y
+CONFIG_NSH_MMCSDMINOR=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDSPIPORTNO=0
+
+#
+# Board-Specific Options
+#
+
+#
+# M3 Wildfire Configuration
+#
+
+#
+# RTOS Features
+#
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=200
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=5
+CONFIG_DEV_CONSOLE=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+# CONFIG_SCHED_LPWORK is not set
+CONFIG_SCHED_WAITPID=y
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_CLOCK is not set
+# CONFIG_DISABLE_POSIX_TIMERS is not set
+# CONFIG_DISABLE_PTHREAD is not set
+# CONFIG_DISABLE_SIGNALS is not set
+# CONFIG_DISABLE_MQUEUE is not set
+# CONFIG_DISABLE_MOUNTPOINT is not set
+# CONFIG_DISABLE_ENVIRON is not set
+CONFIG_DISABLE_POLL=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Stack and heap information
+#
+# CONFIG_CUSTOM_STACK is not set
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+
+#
+# Device Drivers
+#
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+CONFIG_I2C=y
+# CONFIG_I2C_SLAVE is not set
+CONFIG_I2C_TRANSFER=y
+# CONFIG_I2C_WRITEREAD is not set
+CONFIG_I2C_POLLED=y
+# CONFIG_I2C_TRACE is not set
+CONFIG_SPI=y
+# CONFIG_SPI_OWNBUS is not set
+CONFIG_SPI_EXCHANGE=y
+# CONFIG_SPI_CMDDATA is not set
+CONFIG_RTC=y
+# CONFIG_RTC_DATETIME is not set
+# CONFIG_RTC_HIRES is not set
+# CONFIG_RTC_ALARM is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+CONFIG_MMCSD=y
+CONFIG_MMCSD_NSLOTS=1
+# CONFIG_MMCSD_READONLY is not set
+# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set
+# CONFIG_MMCSD_MMCSUPPORT is not set
+# CONFIG_MMCSD_HAVECARDDETECT is not set
+CONFIG_MMCSD_SPI=y
+CONFIG_MMCSD_SPICLOCK=20000000
+CONFIG_MMCSD_SDIO=y
+# CONFIG_SDIO_MUXBUS is not set
+# CONFIG_MTD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_DM90x0 is not set
+CONFIG_ENC28J60=y
+CONFIG_ENC28J60_NINTERFACES=1
+CONFIG_ENC28J60_SPIMODE=0
+CONFIG_ENC28J60_FREQUENCY=20000000
+# CONFIG_ENC28J60_STATS is not set
+# CONFIG_ENC28J60_HALFDUPPLEX is not set
+# CONFIG_NET_E1000 is not set
+# CONFIG_NET_SLIP is not set
+# CONFIG_NET_VNET is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_LOWLEVEL_CONSOLE is not set
+# CONFIG_16550_UART is not set
+CONFIG_ARCH_HAVE_USART1=y
+CONFIG_ARCH_HAVE_USART2=y
+CONFIG_MCU_SERIAL=y
+CONFIG_STANDARD_SERIAL=y
+CONFIG_USART1_SERIAL_CONSOLE=y
+# CONFIG_USART2_SERIAL_CONSOLE is not set
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART1 Configuration
+#
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART1_BAUD=115200
+CONFIG_USART1_BITS=8
+CONFIG_USART1_PARITY=0
+CONFIG_USART1_2STOP=0
+
+#
+# USART2 Configuration
+#
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART2_BAUD=115200
+CONFIG_USART2_BITS=8
+CONFIG_USART2_PARITY=0
+CONFIG_USART2_2STOP=0
+CONFIG_USBDEV=y
+# CONFIG_USBDEV_COMPOSITE is not set
+# CONFIG_USBDEV_ISOCHRONOUS is not set
+# CONFIG_USBDEV_DUALSPEED is not set
+CONFIG_USBDEV_SELFPOWERED=y
+# CONFIG_USBDEV_BUSPOWERED is not set
+# CONFIG_USBDEV_TRACE is not set
+# CONFIG_PL2303 is not set
+# CONFIG_CDCACM is not set
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+CONFIG_NET=y
+# CONFIG_NET_NOINTS is not set
+# CONFIG_NET_MULTIBUFFER is not set
+# CONFIG_NET_IPv6 is not set
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_NACTIVESOCKETS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+# CONFIG_NET_TCPURGDATA is not set
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_MAX_LISTENPORTS=16
+CONFIG_NET_TCP_READAHEAD_BUFSIZE=562
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCP_RECVDELAY=0
+# CONFIG_NET_TCPBACKLOG is not set
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+# CONFIG_NET_PINGADDRCONF is not set
+# CONFIG_NET_IGMP is not set
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_RECEIVE_WINDOW=562
+CONFIG_NET_ARPTAB_SIZE=16
+# CONFIG_NET_ARP_IPIN is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_NFS is not set
+# CONFIG_FS_NXFFS is not set
+# CONFIG_FS_ROMFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=1
+# CONFIG_GRAN is not set
+
+#
+# Library Routines
+#
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_HAVE_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+# CONFIG_HAVE_CXX is not set
+# CONFIG_HAVE_CXXINITIALIZE is not set
+# CONFIG_CXX_NEWLONG is not set
+
+#
+# Application Configuration
+#
+
+#
+# Named Applications
+#
+CONFIG_NAMEDAPP=y
+
+#
+# Examples
+#
+
+#
+# ADC example
+#
+# CONFIG_EXAMPLES_ADC is not set
+
+#
+# Buttons example
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+
+#
+# CAN example
+#
+# CONFIG_EXAMPLES_CAN is not set
+
+#
+# USB CDC/ACM class driver example
+#
+# CONFIG_EXAMPLES_CDCACM is not set
+
+#
+# USB composite class driver example
+#
+# CONFIG_EXAMPLES_COMPOSITE is not set
+
+#
+# DHCP server example
+#
+# CONFIG_EXAMPLES_DHCPD is not set
+
+#
+# FTP client example
+#
+# CONFIG_EXAMPLES_FTPC is not set
+
+#
+# FTP server example
+#
+# CONFIG_EXAMPLES_FTPD is not set
+
+#
+# "Hello, World!" example
+#
+# CONFIG_EXAMPLES_HELLO is not set
+
+#
+# "Hello, World!" C++ example
+#
+# CONFIG_EXAMPLES_HELLOXX is not set
+
+#
+# USB HID keyboard example
+#
+# CONFIG_EXAMPLES_HIDKBD is not set
+
+#
+# IGMP example
+#
+# CONFIG_EXAMPLES_IGMP is not set
+
+#
+# LCD read/write example
+#
+# CONFIG_EXAMPLES_LCDRW is not set
+
+#
+# Memory management example
+#
+# CONFIG_EXAMPLES_MM is not set
+
+#
+# File system mount example
+#
+# CONFIG_EXAMPLES_MOUNT is not set
+
+#
+# FreeModBus example
+#
+# CONFIG_EXAMPLES_MODBUS is not set
+
+#
+# Network test example
+#
+# CONFIG_EXAMPLES_NETTEST is not set
+
+#
+# NuttShell (NSH) example
+#
+CONFIG_EXAMPLES_NSH=y
+
+#
+# NULL example
+#
+# CONFIG_EXAMPLES_NULL is not set
+
+#
+# NX graphics example
+#
+# CONFIG_EXAMPLES_NX is not set
+
+#
+# NxConsole example
+#
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+
+#
+# NXFFS file system example
+#
+# CONFIG_EXAMPLES_NXFFS is not set
+
+#
+# NXFLAT example
+#
+# CONFIG_EXAMPLES_NXFLAT is not set
+
+#
+# NX graphics "Hello, World!" example
+#
+# CONFIG_EXAMPLES_NXHELLO is not set
+
+#
+# NX graphics image example
+#
+# CONFIG_EXAMPLES_NXIMAGE is not set
+
+#
+# NX graphics lines example
+#
+# CONFIG_EXAMPLES_NXLINES is not set
+
+#
+# NX graphics text example
+#
+# CONFIG_EXAMPLES_NXTEXT is not set
+
+#
+# OS test example
+#
+# CONFIG_EXAMPLES_OSTEST is not set
+
+#
+# Pascal "Hello, World!"example
+#
+# CONFIG_EXAMPLES_PASHELLO is not set
+
+#
+# Pipe example
+#
+# CONFIG_EXAMPLES_PIPE is not set
+
+#
+# Poll example
+#
+# CONFIG_EXAMPLES_POLL is not set
+
+#
+# Pulse width modulation (PWM) example
+#
+
+#
+# Quadrature encoder example
+#
+# CONFIG_EXAMPLES_QENCODER is not set
+
+#
+# RGMP example
+#
+# CONFIG_EXAMPLES_RGMP is not set
+
+#
+# ROMFS example
+#
+# CONFIG_EXAMPLES_ROMFS is not set
+
+#
+# sendmail example
+#
+# CONFIG_EXAMPLES_SENDMAIL is not set
+
+#
+# Serial loopback example
+#
+# CONFIG_EXAMPLES_SERLOOP is not set
+
+#
+# Telnet daemon example
+#
+# CONFIG_EXAMPLES_TELNETD is not set
+
+#
+# THTTPD web server example
+#
+# CONFIG_EXAMPLES_THTTPD is not set
+
+#
+# TIFF generation example
+#
+# CONFIG_EXAMPLES_TIFF is not set
+
+#
+# Touchscreen example
+#
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+
+#
+# UDP example
+#
+# CONFIG_EXAMPLES_UDP is not set
+
+#
+# uIP web server example
+#
+# CONFIG_EXAMPLES_UIP is not set
+
+#
+# USB serial test example
+#
+# CONFIG_EXAMPLES_USBSERIAL is not set
+
+#
+# USB mass storage class example
+#
+CONFIG_EXAMPLES_USBMSC=y
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEVMINOR2=1
+CONFIG_EXAMPLES_USBMSC_DEVPATH2="/dev/mmcsd1"
+CONFIG_EXAMPLES_USBMSC_DEVMINOR3=2
+CONFIG_EXAMPLES_USBMSC_DEVPATH3="/dev/mmcsd2"
+# CONFIG_EXAMPLES_USBMSC_DEBUGMM is not set
+# CONFIG_EXAMPLES_USBMSC_TRACEINIT is not set
+# CONFIG_EXAMPLES_USBMSC_TRACECLASS is not set
+# CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS is not set
+# CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER is not set
+# CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS is not set
+
+#
+# USB serial terminal example
+#
+# CONFIG_EXAMPLES_USBTERM is not set
+
+#
+# Watchdog timer example
+#
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# wget example
+#
+# CONFIG_EXAMPLES_WGET is not set
+
+#
+# WLAN example
+#
+# CONFIG_EXAMPLES_WLAN is not set
+
+#
+# Interpreters
+#
+
+#
+# Interpreters
+#
+# CONFIG_FICL is not set
+# CONFIG_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+
+#
+# DHCP client
+#
+# CONFIG_NETUTILS_DHCPC is not set
+
+#
+# DHCP server
+#
+# CONFIG_NETUTILS_DHCPD is not set
+
+#
+# FTP client
+#
+# CONFIG_NETUTILS_FTPC is not set
+
+#
+# FTP server
+#
+# CONFIG_NETUTILS_FTPD is not set
+
+#
+# Name resolution
+#
+CONFIG_NETUTILS_RESOLV=y
+CONFIG_NET_RESOLV_ENTRIES=8
+
+#
+# SMTP
+#
+# CONFIG_NETUTILS_SMTP is not set
+
+#
+# TFTP client
+#
+CONFIG_NETUTILS_TELNETD=y
+
+#
+# TFTP client
+#
+CONFIG_NETUTILS_TFTPC=y
+
+#
+# THTTPD web server
+#
+# CONFIG_NETUTILS_THTTPD is not set
+
+#
+# uIP support library
+#
+CONFIG_NETUTILS_UIPLIB=y
+
+#
+# uIP web client
+#
+CONFIG_NETUTILS_WEBCLIENT=y
+
+#
+# uIP web server
+#
+# CONFIG_NETUTILS_WEBSERVER is not set
+
+#
+# ModBus
+#
+
+#
+# FreeModbus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+CONFIG_NSH_LIBRARY=y
+CONFIG_NSH_BUILTIN_APPS=y
+
+#
+# Disable Individual commands
+#
+# CONFIG_NSH_DISABLE_CAT is not set
+# CONFIG_NSH_DISABLE_CD is not set
+# CONFIG_NSH_DISABLE_CP is not set
+# CONFIG_NSH_DISABLE_DD is not set
+# CONFIG_NSH_DISABLE_ECHO is not set
+# CONFIG_NSH_DISABLE_EXEC is not set
+# CONFIG_NSH_DISABLE_EXIT is not set
+# CONFIG_NSH_DISABLE_FREE is not set
+# CONFIG_NSH_DISABLE_GET is not set
+# CONFIG_NSH_DISABLE_HELP is not set
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_KILL is not set
+# CONFIG_NSH_DISABLE_LOSETUP is not set
+# CONFIG_NSH_DISABLE_LS is not set
+# CONFIG_NSH_DISABLE_MB is not set
+# CONFIG_NSH_DISABLE_MKDIR is not set
+# CONFIG_NSH_DISABLE_MKFATFS is not set
+# CONFIG_NSH_DISABLE_MKFIFO is not set
+# CONFIG_NSH_DISABLE_MKRD is not set
+# CONFIG_NSH_DISABLE_MH is not set
+# CONFIG_NSH_DISABLE_MOUNT is not set
+# CONFIG_NSH_DISABLE_MW is not set
+# CONFIG_NSH_DISABLE_NSFMOUNT is not set
+# CONFIG_NSH_DISABLE_PS is not set
+# CONFIG_NSH_DISABLE_PING is not set
+# CONFIG_NSH_DISABLE_PUT is not set
+# CONFIG_NSH_DISABLE_PWD is not set
+# CONFIG_NSH_DISABLE_RM is not set
+# CONFIG_NSH_DISABLE_RMDIR is not set
+# CONFIG_NSH_DISABLE_SET is not set
+# CONFIG_NSH_DISABLE_SH is not set
+# CONFIG_NSH_DISABLE_SLEEP is not set
+# CONFIG_NSH_DISABLE_TEST is not set
+# CONFIG_NSH_DISABLE_UMOUNT is not set
+# CONFIG_NSH_DISABLE_UNSET is not set
+# CONFIG_NSH_DISABLE_USLEEP is not set
+# CONFIG_NSH_DISABLE_WGET is not set
+# CONFIG_NSH_DISABLE_XD is not set
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+# CONFIG_NSH_DISABLESCRIPT is not set
+# CONFIG_NSH_DISABLEBG is not set
+CONFIG_NSH_CONSOLE=y
+# CONFIG_NSH_USBCONSOLE is not set
+# CONFIG_NSH_CONDEV is not set
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_TELNETD_PORT=23
+CONFIG_NSH_TELNETD_DAEMONPRIO=100
+CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048
+CONFIG_NSH_TELNETD_CLIENTPRIO=100
+CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048
+CONFIG_NSH_IOBUFFER_SIZE=512
+# CONFIG_NSH_DHCPC is not set
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+# CONFIG_NSH_NOMAC is not set
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom free memory command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+CONFIG_SYSTEM_I2CTOOL=y
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=2
+CONFIG_I2CTOOL_MINADDR=0x03
+CONFIG_I2CTOOL_MAXADDR=0x77
+CONFIG_I2CTOOL_MAXREGADDR=0xff
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# readline() support
+#
+CONFIG_SYSTEM_READLINE=y
+CONFIG_READLINE_ECHO=y
+
+#
+# VSN board Add-Ons
+#
+
+#
+# VSN board add-ons
+#
+# CONFIG_VSN_POWEROFF is not set
+# CONFIG_VSN_RAMTRON is not set
+# CONFIG_VSN_SDCARD is not set
+# CONFIG_VSN_SYSINFO is not set
diff --git a/nuttx/configs/fire-stm32v2/nsh/setenv.sh b/nuttx/configs/fire-stm32v2/nsh/setenv.sh
new file mode 100755
index 000000000..e6f4ee2e0
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/nsh/setenv.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+# configs/fire-stm32v2/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools/ subdirectory
+export TOOLS_DIR="${WD}/configs/fire-stm32v2/tools"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:${TOOLS_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/fire-stm32v2/scripts/ld.script b/nuttx/configs/fire-stm32v2/scripts/ld.script
new file mode 100644
index 000000000..443dec50d
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/scripts/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/fire-stm32v2/scripts/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/fire-stm32v2/scripts/ld.script.dfu b/nuttx/configs/fire-stm32v2/scripts/ld.script.dfu
new file mode 100644
index 000000000..c7add1422
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/scripts/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/fire-stm32v2/scripts/ld.script.dfu
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * STM3210E-EVAL's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/fire-stm32v2/src/Makefile b/nuttx/configs/fire-stm32v2/src/Makefile
new file mode 100644
index 000000000..4c4fd1d41
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/Makefile
@@ -0,0 +1,123 @@
+############################################################################
+# configs/fire-stm32v2/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_spi.c up_usbdev.c up_mmcsd.c
+
+ifeq ($(CONFIG_STM32_FSMC),y)
+CSRCS += up_lcd.c up_selectlcd.c
+endif
+
+ifeq ($(CONFIG_HAVE_CXX),y)
+CSRCS += up_cxxinitialize.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_autoleds.c
+else
+CSRCS += up_userleds.c
+endif
+
+ifeq ($(CONFIG_ENC28J60),y)
+CSRCS += up_enc28j60.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
+CSRCS += up_composite.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/fire-stm32v2/src/fire-internal.h b/nuttx/configs/fire-stm32v2/src/fire-internal.h
new file mode 100644
index 000000000..801fb127e
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/fire-internal.h
@@ -0,0 +1,307 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/fire-internal.h
+ * arch/arm/src/board/fire-internal.n
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_FIRE_STM32V2_SRC_FIRE_INTERNAL_H
+#define __CONFIGS_FIRE_STM32V2_SRC_FIRE_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SPI modules does this chip support? Most support 2 SPI modules (others
+ * may support more -- in such case, the following must be expanded).
+ */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+#endif
+
+/* There is only CAN1 on the M3 Wildfire board */
+
+#if defined(CONFIG_STM32_CAN2)
+# warning "The M3 Wildfire only supports CAN1"
+#endif
+
+/* M3 Wildfire GPIOs ****************************************************************/
+/* Camera
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 23 PA0 PA0-C-VSYNC Camera (P9)
+ * 67 PA8 PA8-C-XCLK Camera (P9)
+ * 91 PB5 PB5-C-WRST Camera (P9)
+ * 95 PB8 PB8-C-DO_0 Camera (P9)
+ * 96 PB9 PB9-C-DO_1 Camera (P9)
+ * 47 PB10 PB10-C-DO_2 Camera (P9)
+ * 48 PB11 PB11-C-DO_3 Camera (P9)
+ * 51 PB12 PB12-C-DO_4 Camera (P9)
+ * 52 PB13 PB13-C-DO_5 Camera (P9)
+ * 53 PB14 PB14-C-DO_6 Camera (P9)
+ * 54 PB15 PB15-C-DO_7 Camera (P9)
+ * 63 PC6 PC6-C-SIO_C Camera (P9)
+ * 64 PC7 PC7-C-SIO_D Camera (P9)
+ * 84 PD3 PD3-C-WEN Camera (P9)
+ * 87 PD6 PD6-C-OE Camera (P9)
+ * 59 PD12 C-LED_EN Camera (P9)
+ * 97 PE0 PE0-C-RRST Camera (P9)
+ * 1 PE2 PE2-C-RCLK Camera (P9)
+ */
+
+/* Bell
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 3 PE4 PE4-BEEP LS1 Bell
+ */
+
+/* 2.4" TFT + Touchscreen
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 92 PB6 PB6-I2C1-SCL 2.4" TFT + Touchscreen, AT24C02
+ * 93 PB7 PB7-I2C1-SDA 2.4" TFT + Touchscreen, AT24C02
+ * 81 PD0 PD0-FSMC_D2 2.4" TFT + Touchscreen
+ * 82 PD1 PD1-FSMC_D3 2.4" TFT + Touchscreen
+ * 85 PD4 PD4-FSMC_NOE 2.4" TFT + Touchscreen
+ * 86 PD5 PD5-FSMC_NWE 2.4" TFT + Touchscreen
+ * 88 PD7 PD7-FSMC_NE1 2.4" TFT + Touchscreen
+ * 55 PD8 PD8-FSMC_D13 2.4" TFT + Touchscreen
+ * 56 PD9 PD9-FSMC_D14 2.4" TFT + Touchscreen
+ * 57 PD10 PD10-FSMC_D15 2.4" TFT + Touchscreen
+ * 58 PD11 PD11-FSMC_A16 2.4" TFT + Touchscreen
+ * 60 PD13 PD13-LCD/LIGHT 2.4" TFT + Touchscreen
+ * 61 PD14 PD14-FSMC_D0 2.4" TFT + Touchscreen
+ * 62 PD15 PD15-FSMC_D1 2.4" TFT + Touchscreen
+ * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen
+ * 38 PE7 PE7-FSMC_D4 2.4" TFT + Touchscreen
+ * 39 PE8 PE8-FSMC_D5 2.4" TFT + Touchscreen
+ * 40 PE9 PE9-FSMC_D6 2.4" TFT + Touchscreen
+ * 41 PE10 PE10-FSMC_D7 2.4" TFT + Touchscreen
+ * 42 PE11 PE11-FSMC_D8 2.4" TFT + Touchscreen
+ * 43 PE12 PE12-FSMC_D9 2.4" TFT + Touchscreen
+ * 44 PE13 PE13-FSMC_D10 2.4" TFT + Touchscreen
+ * 45 PE14 PE14-FSMC_D11 2.4" TFT + Touchscreen
+ * 46 PE15 PE15-FSMC_D12 2.4" TFT + Touchscreen
+ */
+
+#define GPIO_LCD_BACKLIGHT (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN13)
+
+/* GPIO_LCD_CS - Is there some kind of chip select for SPI1? */
+
+/* LEDs
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 18 PC3 PC3-LED1 LED1, Active low (pulled high)
+ * 33 PC4 PC4-LED2 LED2, Active low (pulled high)
+ * 34 PC5 PC5-LED3 LED3, Active low (pulled high)
+ */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN3)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN4)
+#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN5)
+
+/* Buttons
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open)
+ * 36 PB1 PB1-KEY2 KEY2, Low when closed (pulled high if open)
+ */
+
+#define MIN_IRQBUTTON BUTTON_KEY1
+#define MAX_IRQBUTTON BUTTON_KEY2
+#define NUM_IRQBUTTONS (MAX_IRQBUTTON - MIN_IRQBUTTON + 1)
+
+#define GPIO_BTN_KEY1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTB|GPIO_PIN0)
+#define GPIO_BTN_KEY2 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTB|GPIO_PIN1)
+
+/* 2MBit SPI FLASH
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ */
+
+#ifndef CONFIG_ENC28J60
+# define GPIO_FLASH_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
+#endif
+
+/* ENC28J60
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen, 10Mbit EN28J60 Reset
+ * 4 PE5 (no name) 10Mbps ENC28J60 Interrupt
+ */
+
+#if defined(CONFIG_STM32_FSMC) && defined(CONFIG_ENC28J60)
+# warning "TFT LCD and ENCJ2860 shared PE1"
+#endif
+
+/* CS and Reset are active low. Initial states are not selected and not in
+ * reset (driver does a soft reset).
+ */
+
+#ifdef CONFIG_ENC28J60
+# define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
+# define GPIO_ENC28J60_RESET (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN1)
+# define GPIO_ENC28J60_INTR (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTE|GPIO_PIN5)
+#endif
+
+/* MP3
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 48 PB11 PB11-MP3-RST MP3
+ * 51 PB12 PB12-SPI2-NSS MP3
+ * 52 PB13 PB13-SPI2-SCK MP3
+ * 53 PB14 PB14-SPI2-MISO MP3
+ * 54 PB15 PB15-SPI2-MOSI MP3
+ * 63 PC6 PC6-MP3-XDCS MP3
+ * 64 PC7 PC7-MP3-DREQ MP3
+ */
+
+#define GPIO_MP3_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN6)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the M3 Wildfire board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the M3 Wildfire board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_usbinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_selectlcd(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_sdinitialize
+ *
+ * Description:
+ * Initialize the SPI-based SD card. Requires CONFIG_DISABLE_MOUNTPOINT=n
+ * and CONFIG_STM32_SDIO=y
+ *
+ ****************************************************************************/
+
+int stm32_sdinitialize(int minor);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_FIRE_STM32V2_SRC_FIRE_INTERNAL_H */
+
diff --git a/nuttx/configs/fire-stm32v2/src/up_autoleds.c b/nuttx/configs/fire-stm32v2/src/up_autoleds.c
new file mode 100644
index 000000000..4e70b01dd
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_autoleds.c
@@ -0,0 +1,388 @@
+/****************************************************************************
+ * configs/fire-stm32v2/src/up_autoleds.c
+ * arch/arm/src/board/up_autoleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+#include <nuttx/power/pm.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "fire-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings.
+ *
+ * OFFBITS ONBITS
+ * CLR SET CLR SET
+ * 210 210 210 210
+ */
+
+#define FIRE_LED1 (1 << 0)
+#define FIRE_LED2 (1 << 1)
+#define FIRE_LED3 (1 << 2)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (3)
+#define OFF_SETBITS_SHIFT (6)
+#define OFF_CLRBITS_SHIFT (9)
+
+#define ON_BITS(v) ((v) & 0x3f)
+#define OFF_BITS(v) (((v) >> 6) & 0x03f)
+#define SETBITS(b) ((b) & 0x07)
+#define CLRBITS(b) (((b) >> 3) & 0x07)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+/* ON OFF
+ * -------------------------- -- ------------------ -----------------
+ * LED1 LED2 LED3 LED1 LED2 LED3
+ * -------------------------- -- ------ ----- ----- ----- ----- -----
+ * LED_STARTED 0 OFF OFF OFF OFF OFF OFF
+ * LED_HEAPALLOCATE 1 ON OFF OFF OFF OFF OFF
+ * LED_IRQSENABLED 2 OFF ON OFF ON OFF OFF
+ * LED_STACKCREATED 3 OFF OFF OFF OFF ON OFF
+ *
+ * LED_INIRQ 4 NC NC ON NC NC OFF
+ * LED_SIGNAL 4 NC NC ON NC NC OFF
+ * LED_ASSERTION 4 NC NC ON NC NC OFF
+ * LED_PANIC 4 NC NC ON NC NC OFF
+ * -------------------------- -- ------ ----- ----- ----- ----- -----
+ */
+
+#define LED_STARTED_ON_SETBITS (0)
+#define LED_STARTED_ON_CLRBITS ((FIRE_LED1|FIRE_LED2|FIRE_LED3) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS LED_STARTED_ON_SETBITS
+#define LED_STARTED_OFF_CLRBITS LED_STARTED_ON_CLRBITS
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((FIRE_LED1) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((FIRE_LED2|FIRE_LED3) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS LED_STARTED_ON_SETBITS
+#define LED_HEAPALLOCATE_OFF_CLRBITS LED_STARTED_ON_CLRBITS
+
+#define LED_IRQSENABLED_ON_SETBITS ((FIRE_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((FIRE_LED1|FIRE_LED3) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS LED_HEAPALLOCATE_ON_SETBITS
+#define LED_IRQSENABLED_OFF_CLRBITS LED_HEAPALLOCATE_ON_CLRBITS
+
+#define LED_STACKCREATED_ON_SETBITS (0)
+#define LED_STACKCREATED_ON_CLRBITS ((FIRE_LED1|FIRE_LED2|FIRE_LED3) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS LED_IRQSENABLED_ON_SETBITS
+#define LED_STACKCREATED_OFF_CLRBITS LED_IRQSENABLED_ON_CLRBITS
+
+#define LED_FLASH_ON_SETBITS ((FIRE_LED3) << ON_SETBITS_SHIFT)
+#define LED_FLASH_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_FLASH_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_FLASH_OFF_CLRBITS ((FIRE_LED3) << OFF_CLRBITS_SHIFT)
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+
+/* LED State Controls */
+
+static inline void led_clrbits(unsigned int clrbits);
+static inline void led_setbits(unsigned int setbits);
+static void led_setonoff(unsigned int bits);
+
+/* LED Power Management */
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
+static int led_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_FLASH_ON_SETBITS | LED_FLASH_ON_CLRBITS |
+ LED_FLASH_OFF_SETBITS | LED_FLASH_OFF_CLRBITS)
+};
+
+#ifdef CONFIG_PM
+static struct pm_callback_s g_ledscb =
+{
+ .notify = led_pm_notify,
+ .prepare = led_pm_prepare,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: led_clrbits
+ *
+ * Description:
+ * Clear all LEDs to the bit encoded state. The LEDs are pulled up and,
+ * hence, active low.
+ *
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & FIRE_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((clrbits & FIRE_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((clrbits & FIRE_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, true);
+ }
+}
+
+/****************************************************************************
+ * Name: led_setbits
+ *
+ * Description:
+ * Set all LEDs to the bit encoded state. The LEDs are pulled up and,
+ * hence, active low.
+ *
+ ****************************************************************************/
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & FIRE_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((setbits & FIRE_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((setbits & FIRE_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, false);
+ }
+}
+
+/****************************************************************************
+ * Name: led_setonoff
+ *
+ * Description:
+ * Set/clear all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Name: led_pm_notify
+ *
+ * Description:
+ * Notify the driver of new power state. This callback is called after
+ * all drivers have had the opportunity to prepare for the new power state.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ switch (pmstate)
+ {
+ case(PM_NORMAL):
+ {
+ /* Restore normal LEDs operation */
+
+ }
+ break;
+
+ case(PM_IDLE):
+ {
+ /* Entering IDLE mode - Turn leds off */
+
+ }
+ break;
+
+ case(PM_STANDBY):
+ {
+ /* Entering STANDBY mode - Logic for PM_STANDBY goes here */
+
+ }
+ break;
+
+ case(PM_SLEEP):
+ {
+ /* Entering SLEEP mode - Logic for PM_SLEEP goes here */
+
+ }
+ break;
+
+ default:
+ {
+ /* Should not get here */
+
+ }
+ break;
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: led_pm_prepare
+ *
+ * Description:
+ * Request the driver to prepare for a new power state. This is a warning
+ * that the system is about to enter into a new power state. The driver
+ * should begin whatever operations that may be required to enter power
+ * state. The driver may abort the state change mode by returning a
+ * non-zero value from the callback function.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static int led_pm_prepare(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ /* No preparation to change power modes is required by the LEDs driver.
+ * We always accept the state change by returning OK.
+ */
+
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledpminitialize
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+void up_ledpminitialize(void)
+{
+ /* Register to receive power management callbacks */
+
+ int ret = pm_register(&g_ledscb);
+ if (ret != OK)
+ {
+ up_ledon(LED_ASSERTION);
+ }
+}
+#endif /* CONFIG_PM */
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/fire-stm32v2/src/up_boot.c b/nuttx/configs/fire-stm32v2/src/up_boot.c
new file mode 100644
index 000000000..bb87afcdf
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_boot.c
@@ -0,0 +1,102 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "fire-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/fire-stm32v2/src/up_buttons.c b/nuttx/configs/fire-stm32v2/src/up_buttons.c
new file mode 100644
index 000000000..738d65d5f
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_buttons.c
@@ -0,0 +1,153 @@
+/****************************************************************************
+ * configs/fire-stm32v2/src/up_buttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "fire-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for some pins but NOT used in this file
+ */
+
+ stm32_configgpio(GPIO_BTN_KEY1);
+ stm32_configgpio(GPIO_BTN_KEY2);
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+
+ /* Check that state of each key. A LOW value means that the key is pressed, */
+
+ if (!stm32_gpioread(GPIO_BTN_KEY1))
+ {
+ ret |= BUTTON_KEY1_BIT;
+ }
+
+ if (!stm32_gpioread(GPIO_BTN_KEY2))
+ {
+ ret |= BUTTON_KEY2_BIT;
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ uint16_t gpio;
+
+ if (id == BUTTON_KEY1)
+ {
+ gpio = GPIO_KEY1;
+ }
+ else if (id == BUTTON_KEY2)
+ {
+ gpio = GPIO_KEY2;
+ }
+ else
+ {
+ return NULL;
+ }
+
+ return stm32_gpiosetevent(gpio, true, true, true, irqhandler);
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/fire-stm32v2/src/up_composite.c b/nuttx/configs/fire-stm32v2/src/up_composite.c
new file mode 100644
index 000000000..6ebc06176
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_composite.c
@@ -0,0 +1,106 @@
+/****************************************************************************
+ * configs/fire-stm32v2/src/up_composite.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 SPI-based MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+
+#include "fire-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Device minor number */
+
+#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1
+# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: composite_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int composite_archinitialize(void)
+{
+ /* If examples/composite is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ *
+ * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH
+ * was built.
+ */
+
+#ifndef CONFIG_NSH_BUILTIN_APPS
+ return sd_mount(CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1);
+#else
+ return OK;
+#endif /* CONFIG_NSH_BUILTIN_APPS */
+}
diff --git a/nuttx/configs/fire-stm32v2/src/up_cxxinitialize.c b/nuttx/configs/fire-stm32v2/src/up_cxxinitialize.c
new file mode 100644
index 000000000..d4afdd20b
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_cxxinitialize.c
@@ -0,0 +1,155 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/up_cxxinitialize.c
+ * arch/arm/src/board/up_cxxinitialize.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include <arch/stm32/chip.h>
+#include "chip.h"
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Debug ****************************************************************************/
+/* Non-standard debug that may be enabled just for testing the static constructors */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_CXX
+#endif
+
+#ifdef CONFIG_DEBUG_CXX
+# define cxxdbg dbg
+# define cxxlldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define cxxvdbg vdbg
+# define cxxllvdbg llvdbg
+# else
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+# endif
+#else
+# define cxxdbg(x...)
+# define cxxlldbg(x...)
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This type defines one entry in initialization array */
+
+typedef void (*initializer_t)(void);
+
+/************************************************************************************
+ * External references
+ ************************************************************************************/
+/* _sinit and _einit are symbols exported by the linker script that mark the
+ * beginning and the end of the C++ initialization section.
+ */
+
+extern initializer_t _sinit;
+extern initializer_t _einit;
+
+/* _stext and _etext are symbols exported by the linker script that mark the
+ * beginning and the end of text.
+ */
+
+extern uint32_t _stext;
+extern uint32_t _etext;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_cxxinitialize
+ *
+ * Description:
+ * If C++ and C++ static constructors are supported, then this function
+ * must be provided by board-specific logic in order to perform
+ * initialization of the static C++ class instances.
+ *
+ * This function should then be called in the application-specific
+ * user_start logic in order to perform the C++ initialization. NOTE
+ * that no component of the core NuttX RTOS logic is involved; This
+ * function defintion only provides the 'contract' between application
+ * specific C++ code and platform-specific toolchain support
+ *
+ ***************************************************************************/
+
+void up_cxxinitialize(void)
+{
+ initializer_t *initp;
+
+ cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
+ &_sinit, &_einit, &_stext, &_etext);
+
+ /* Visit each entry in the initialzation table */
+
+ for (initp = &_sinit; initp != &_einit; initp++)
+ {
+ initializer_t initializer = *initp;
+ cxxdbg("initp: %p initializer: %p\n", initp, initializer);
+
+ /* Make sure that the address is non-NULL and lies in the text region
+ * defined by the linker script. Some toolchains may put NULL values
+ * or counts in the initialization table
+ */
+
+ if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
+ {
+ cxxdbg("Calling %p\n", initializer);
+ initializer();
+ }
+ }
+}
+
+#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
+
diff --git a/nuttx/configs/fire-stm32v2/src/up_enc28j60.c b/nuttx/configs/fire-stm32v2/src/up_enc28j60.c
new file mode 100644
index 000000000..5247f5886
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_enc28j60.c
@@ -0,0 +1,211 @@
+/****************************************************************************
+ * configs/fire-stm32v2/src/up_enc28j60.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* 2MBit SPI FLASH OR ENC28J60
+ *
+ * --- ------ -------------- -----------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -----------------------------------------------------
+ *
+ * 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/net/enc28j60.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "fire-internal.h"
+
+#ifdef CONFIG_ENC28J60
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* ENC28J60
+ *
+ * --- ------ -------------- -----------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -----------------------------------------------------
+ *
+ * 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen, 10Mbit EN28J60 Reset
+ * 4 PE5 (no name) 10Mbps ENC28J60 Interrupt
+ */
+
+/* ENC28J60 is on SPI1 */
+
+#ifndef CONFIG_STM32_SPI1
+# error "Need CONFIG_STM32_SPI1 in the configuration"
+#endif
+
+/* SPI Assumptions **********************************************************/
+
+#define ENC28J60_SPI_PORTNO 1 /* On SPI1 */
+#define ENC28J60_DEVNO 0 /* Only one ENC28J60 */
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct stm32_lower_s
+{
+ const struct enc_lower_s lower; /* Low-level MCU interface */
+ xcpt_t handler; /* ENC28J60 interrupt handler */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler);
+static void up_enable(FAR const struct enc_lower_s *lower);
+static void up_disable(FAR const struct enc_lower_s *lower);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* The ENC28J60 normal provides interrupts to the MCU via a GPIO pin. The
+ * following structure provides an MCU-independent mechanixm for controlling
+ * the ENC28J60 GPIO interrupt.
+ */
+
+static struct stm32_lower_s g_enclower =
+{
+ .lower =
+ {
+ .attach = up_attach,
+ .enable = up_enable,
+ .disable = up_disable
+ },
+ .handler = NULL,
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: struct enc_lower_s methods
+ ****************************************************************************/
+
+static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler)
+{
+ FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower;
+
+ /* Just save the handler for use when the interrupt is enabled */
+
+ priv->handler = handler;
+ return OK;
+}
+
+static void up_enable(FAR const struct enc_lower_s *lower)
+{
+ FAR struct stm32_lower_s *priv = (FAR struct stm32_lower_s *)lower;
+
+ DEBUGASSERT(priv->handler);
+ (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, true, true, true, priv->handler);
+}
+
+static void up_disable(FAR const struct enc_lower_s *lower)
+{
+ (void)stm32_gpiosetevent(GPIO_ENC28J60_INTR, true, true, true, NULL);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_netinitialize
+ ****************************************************************************/
+
+void up_netinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Assumptions:
+ * 1) ENC28J60 pins were configured in up_spi.c early in the boot-up phase.
+ * 2) Clocking for the SPI1 peripheral was also provided earlier in boot-up.
+ */
+
+ spi = up_spiinitialize(ENC28J60_SPI_PORTNO);
+ if (!spi)
+ {
+ nlldbg("Failed to initialize SPI port %d\n", ENC28J60_SPI_PORTNO);
+ return;
+ }
+
+ /* Take ENC28J60 out of reset (active low)*/
+
+ stm32_gpiowrite(GPIO_ENC28J60_RESET, true);
+
+ /* Bind the SPI port to the ENC28J60 driver */
+
+ ret = enc_initialize(spi, &g_enclower.lower, ENC28J60_DEVNO);
+ if (ret < 0)
+ {
+ nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n",
+ ENC28J60_SPI_PORTNO, ENC28J60_DEVNO, ret);
+ return;
+ }
+
+ nllvdbg("Bound SPI port %d to ENC28J60 device %d\n",
+ ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
+}
+
+#endif /* CONFIG_ENC28J60 */
diff --git a/nuttx/configs/fire-stm32v2/src/up_mmcsd.c b/nuttx/configs/fire-stm32v2/src/up_mmcsd.c
new file mode 100644
index 000000000..c0c6693d3
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_mmcsd.c
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * config/fire-stm32v2/src/up_mmcsd.c
+ * arch/arm/src/board/up_mmcsd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "fire-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#define HAVE_MMCSD 1 /* Assume that we have SD support */
+#define STM32_MMCSDSLOTNO 0 /* There is only one slot */
+
+/* Can't support MMC/SD features if the SDIO peripheral is disabled */
+
+#ifndef CONFIG_STM32_SDIO
+# undef HAVE_MMCSD
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#ifdef CONFIG_DISABLE_MOUNTPOINT
+# undef HAVE_MMCSD
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_sdinitialize
+ *
+ * Description:
+ * Initialize the SPI-based SD card. Requires CONFIG_DISABLE_MOUNTPOINT=n
+ * and CONFIG_STM32_SDIO=y
+ *
+ ****************************************************************************/
+
+int stm32_sdinitialize(int minor)
+{
+#ifdef HAVE_MMCSD
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ sdio = sdio_initialize(STM32_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ fdbg("Failed to initialize SDIO slot %d\n", STM32_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ fvdbg("Initialized SDIO slot %d\n", STM32_MMCSDSLOTNO);
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ ret = mmcsd_slotinitialize(minor, sdio);
+ if (ret != OK)
+ {
+ fdbg("Failed to bind SDIO slot %d to the MMC/SD driver, minor=%d\n",
+ STM32_MMCSDSLOTNO, minor);
+ }
+
+ fvdbg("Bound SDIO slot %d to the MMC/SD driver, minor=%d\n",
+ STM32_MMCSDSLOTNO, minor);
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the M3 Wildfire board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/fire-stm32v2/src/up_nsh.c b/nuttx/configs/fire-stm32v2/src/up_nsh.c
new file mode 100644
index 000000000..f728a227a
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_nsh.c
@@ -0,0 +1,151 @@
+/****************************************************************************
+ * config/fire-stm32v2/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "stm32_internal.h"
+#include "fire-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Assume that we support everything until convinced otherwise */
+
+#define HAVE_MMCSD 1
+#define HAVE_USBDEV 1
+
+/* Configuration ************************************************************/
+/* SPI1 connects to the SD CARD (and to the SPI FLASH) */
+
+#define STM32_MMCSDSPIPORTNO 1 /* SPI1 */
+#define STM32_MMCSDSLOTNO 0 /* Only one slot */
+
+/* Can't support MMC/SD features if the SDIO peripheral is disabled */
+
+#ifndef CONFIG_STM32_SDIO
+# undef HAVE_MMCSD
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#ifdef CONFIG_DISABLE_MOUNTPOINT
+# undef HAVE_MMCSD
+#endif
+
+/* Default MMC/SD minor number */
+
+#ifdef HAVE_MMCSD
+# ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+# endif
+
+/* Default MMC/SD SLOT number */
+
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != STM32_MMCSDSLOTNO
+# error "Only one MMC/SD slot: Slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO
+# endif
+
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO
+# endif
+#endif
+
+/* Can't support USB host or device features if the USB peripheral or the USB
+ * device infrastructure is not enabled
+ */
+
+#if !defined(CONFIG_STM32_USB) || !defined(CONFIG_USBDEV)
+# undef HAVE_USBDEV
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef HAVE_MMCSD
+ int ret;
+
+ /* Initialize the SDIO-based MMC/SD slot */
+
+ ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to initialize MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/fire-stm32v2/src/up_selectlcd.c b/nuttx/configs/fire-stm32v2/src/up_selectlcd.c
new file mode 100644
index 000000000..99d18cd27
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_selectlcd.c
@@ -0,0 +1,210 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/up_selectlcd.c
+ * arch/arm/src/board/up_selectlcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_fsmc.h"
+#include "stm32_gpio.h"
+#include "stm32_internal.h"
+#include "fire-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# warning "FSMC is not enabled"
+#endif
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/* 2.4" TFT + Touchscreen. FSMC Bank1
+ *
+ * --- ------ -------------- -------------------------------------------------------------------
+ * PIN NAME SIGNAL NOTES
+ * --- ------ -------------- -------------------------------------------------------------------
+ *
+ * 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
+ * 92 PB6 PB6-I2C1-SCL 2.4" TFT + Touchscreen, AT24C02
+ * 93 PB7 PB7-I2C1-SDA 2.4" TFT + Touchscreen, AT24C02
+ * 81 PD0 PD0-FSMC_D2 2.4" TFT + Touchscreen
+ * 82 PD1 PD1-FSMC_D3 2.4" TFT + Touchscreen
+ * 85 PD4 PD4-FSMC_NOE 2.4" TFT + Touchscreen
+ * 86 PD5 PD5-FSMC_NWE 2.4" TFT + Touchscreen
+ * 88 PD7 PD7-FSMC_NE1 2.4" TFT + Touchscreen
+ * 55 PD8 PD8-FSMC_D13 2.4" TFT + Touchscreen
+ * 56 PD9 PD9-FSMC_D14 2.4" TFT + Touchscreen
+ * 57 PD10 PD10-FSMC_D15 2.4" TFT + Touchscreen
+ * 58 PD11 PD11-FSMC_A16 2.4" TFT + Touchscreen
+ * 60 PD13 PD13-LCD/LIGHT 2.4" TFT + Touchscreen
+ * 61 PD14 PD14-FSMC_D0 2.4" TFT + Touchscreen
+ * 62 PD15 PD15-FSMC_D1 2.4" TFT + Touchscreen
+ * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen
+ * 38 PE7 PE7-FSMC_D4 2.4" TFT + Touchscreen
+ * 39 PE8 PE8-FSMC_D5 2.4" TFT + Touchscreen
+ * 40 PE9 PE9-FSMC_D6 2.4" TFT + Touchscreen
+ * 41 PE10 PE10-FSMC_D7 2.4" TFT + Touchscreen
+ * 42 PE11 PE11-FSMC_D8 2.4" TFT + Touchscreen
+ * 43 PE12 PE12-FSMC_D9 2.4" TFT + Touchscreen
+ * 44 PE13 PE13-FSMC_D10 2.4" TFT + Touchscreen
+ * 45 PE14 PE14-FSMC_D11 2.4" TFT + Touchscreen
+ * 46 PE15 PE15-FSMC_D12 2.4" TFT + Touchscreen
+ *
+ * NOTE: SPI and I2C pin configuration is controlled in the SPI and I2C drivers, respectively.
+ */
+
+static const uint16_t g_lcdconfig[NCOMMON_CONFIG] =
+{
+ /* Address Lines: A16 only */
+
+ GPIO_NPS_A16,
+
+ /* Data Lines: D0... D15 */
+
+ GPIO_NPS_D0, GPIO_NPS_D1, GPIO_NPS_D2, GPIO_NPS_D3,
+ GPIO_NPS_D4, GPIO_NPS_D5, GPIO_NPS_D6, GPIO_NPS_D7,
+ GPIO_NPS_D8, GPIO_NPS_D9, GPIO_NPS_D10, GPIO_NPS_D11,
+ GPIO_NPS_D12, GPIO_NPS_D13, GPIO_NPS_D14, GPIO_NPS_D15,
+
+ /* NOE, NWE, NE1, NBL1 */
+
+ GPIO_NPS_NOE, GPIO_NPS_NWE, GPIO_NPS_NE1, GPIO_NPS_NBL1,
+
+ /* Backlight GPIO */
+
+ GPIO_LCD_BACKLIGHT
+};
+#define NLCD_CONFIG (sizeof(g_lcdconfig) / sizeof(uint16_t))
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * Enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+static inline void stm32_enablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHBENR);
+ regval |= RCC_AHBENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHBENR);
+}
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD pin configuration.
+ *
+ ************************************************************************************/
+
+void stm32_selectlcd(void)
+{
+ irqstate_t flags;
+ int i;
+
+ /* Configure LCD GPIO pis */
+
+ flags = irqsave();
+ for (i = 0; i < NLCD_GPIOS; i++)
+ {
+ stm32_configgpio(g_lcdconfig[i]);
+ }
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Bank1 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(1)|FSMC_BTR_ADDHLD(0)|FSMC_BTR_DATAST(2)|FSMC_BTR_BUSTRUN(0)|
+ FSMC_BTR_CLKDIV(0)|FSMC_BTR_DATLAT(0)|FSMC_BTR_ACCMODA, STM32_FSMC_BTR1);
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR4);
+
+ /* Enable the bank by setting the MBKEN bit */
+
+ putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1);
+ irqrestore(flags);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/fire-stm32v2/src/up_spi.c b/nuttx/configs/fire-stm32v2/src/up_spi.c
new file mode 100644
index 000000000..b2ef301b6
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_spi.c
@@ -0,0 +1,216 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "fire-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the M3 Wildfire board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI1 and/or SPI2 was already provided in stm32_rcc.c.
+ * Configurations of SPI pins is performed in stm32_spi.c.
+ * Here, we only initialize chip select pins unique to the board
+ * architecture.
+ */
+
+#ifdef CONFIG_STM32_SPI1
+ /* Configure the TFT/Touchscreen CS GPIO */
+
+#if 0 /* Need to study this */
+ stm32_configgpio(GPIO_LCD_CS);
+#endif
+
+ /* Configure the TFT/Touchscreen and ENC28J60 or SPI-based FLASH PIOs */
+
+ /* Configure ENC28J60 SPI1 CS (also RESET and interrupt pins) */
+
+#ifdef CONFIG_ENC28J60
+ stm32_configgpio(GPIO_ENC28J60_CS);
+ stm32_configgpio(GPIO_ENC28J60_RESET);
+ stm32_configgpio(GPIO_ENC28J60_INTR);
+#else
+
+ /* Configure FLASH SPI1 CS */
+
+ stm32_configgpio(GPIO_FLASH_CS);
+#endif
+
+#endif /* CONFIG_STM32_SPI1 */
+
+#ifdef CONFIG_STM32_SPI2
+ /* Configure the MP3 SPI2 CS GPIO */
+
+ stm32_configgpio(GPIO_MP3_CS);
+
+#endif /* CONFIG_STM32_SPI2 */
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+#if 0 /* Need to study this */
+ if (devid == SPIDEV_LCD)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_LCD_CS, !selected);
+ }
+ else
+#endif
+#ifdef CONFIG_ENC28J60
+ if (devid == SPIDEV_ETHERNET)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_ENC28J60_CS, !selected);
+ }
+#else
+ if (devid == SPIDEV_FLASH)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_FLASH_CS, !selected);
+ }
+#endif
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ if (devid == SPIDEV_AUDIO)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_MP3_CS, !selected);
+ }
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/fire-stm32v2/src/up_usbdev.c b/nuttx/configs/fire-stm32v2/src/up_usbdev.c
new file mode 100644
index 000000000..e335edd43
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_usbdev.c
@@ -0,0 +1,120 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "fire-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the M3 Wildfire board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* USB Soft Connect Pullup */
+
+#if 0 /* REVISIT */
+ stm32_configgpio(GPIO_USB_PULLUP);
+#endif
+}
+
+/************************************************************************************
+ * Name: stm32_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide stm32_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+#if 0 /* REVISIT */
+ stm32_gpiowrite(GPIO_USB_PULLUP, !enable);
+#endif
+ return OK;
+}
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+
diff --git a/nuttx/configs/fire-stm32v2/src/up_usbmsc.c b/nuttx/configs/fire-stm32v2/src/up_usbmsc.c
new file mode 100644
index 000000000..8a8269539
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_usbmsc.c
@@ -0,0 +1,103 @@
+/****************************************************************************
+ * configs/fire-stm32v2/src/up_usbmsc.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 SPI-based MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "stm32_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+ return stm32_sdinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1);
+#else
+ return OK;
+#endif
+}
diff --git a/nuttx/configs/fire-stm32v2/src/up_userleds.c b/nuttx/configs/fire-stm32v2/src/up_userleds.c
new file mode 100644
index 000000000..da43d03ad
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_userleds.c
@@ -0,0 +1,139 @@
+/****************************************************************************
+ * configs/fire-stm32v2/src/up_userleds.c
+ * arch/arm/src/board/up_userleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "fire-internal.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* This array maps an LED number to GPIO pin configuration */
+
+static uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED1, GPIO_LED2, GPIO_LED3
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ledinit
+ ****************************************************************************/
+
+void stm32_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+}
+
+/****************************************************************************
+ * Name: stm32_setled
+ *
+ * Description:
+ * Set one LED to the 'ledon' state. The LEDs are pulled up and, hence,
+ * active low.
+ *
+ ****************************************************************************/
+
+void stm32_setled(int led, bool ledon)
+{
+ if ((unsigned)led < BOARD_NLEDS)
+ {
+ stm32_gpiowrite(g_ledcfg[led], !ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: stm32_setleds
+ *
+ * Description:
+ * Set each LED to the bit encoded state. The LEDs are pulled up and,
+ * hence, active low.
+ *
+ ****************************************************************************/
+
+void stm32_setleds(uint8_t ledset)
+{
+ stm32_gpiowrite(BOARD_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED2, (ledset & BOARD_LED2_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED3, (ledset & BOARD_LED3_BIT) == 0);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/fire-stm32v2/src/up_watchdog.c b/nuttx/configs/fire-stm32v2/src/up_watchdog.c
new file mode 100644
index 000000000..5b11ebc17
--- /dev/null
+++ b/nuttx/configs/fire-stm32v2/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/fire-stm32v2/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/hymini-stm32v/Kconfig b/nuttx/configs/hymini-stm32v/Kconfig
new file mode 100644
index 000000000..860c1d32b
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_HYMINI_STM32V
+endif
diff --git a/nuttx/configs/hymini-stm32v/README.txt b/nuttx/configs/hymini-stm32v/README.txt
new file mode 100644
index 000000000..ddb62e84e
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/README.txt
@@ -0,0 +1,670 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the
+HY-MiniSTM32V development board.
+
+Contents
+========
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - DFU
+ - LEDs
+ - RTC
+ - HY-Mini specific Configuration Options
+ - Configurations
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Raisonance R-Link emulatator and some RIDE7 development tools
+ were used and those tools works only under Windows.
+
+GNU Toolchain Options
+=====================
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. Raisonance GNU toolchain, or
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh hymini-stm32v/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+DFU
+===
+
+ The linker files in these projects can be configured to indicate that you
+ will be loading code using STMicro built-in USB Device Firmware Upgrade (DFU)
+ loader or via some JTAG emulator. You can specify the DFU bootloader by
+ adding the following line:
+
+ CONFIG_STM32_DFU=y
+
+ to your .config file. Most of the configurations in this directory are set
+ up to use the DFU loader.
+
+ If CONFIG_STM32_DFU is defined, the code will not be positioned at the beginning
+ of FLASH (0x08000000) but will be offset to 0x08003000. This offset is needed
+ to make space for the DFU loader and 0x08003000 is where the DFU loader expects
+ to find new applications at boot time. If you need to change that origin for some
+ other bootloader, you will need to edit the file(s) ld.script.dfu for each
+ configuration.
+
+ The DFU SE PC-based software is available from the STMicro website,
+ http://www.st.com. General usage instructions:
+
+ 1. Convert the NuttX Intel Hex file (nuttx.hex) into a special DFU
+ file (nuttx.dfu)... see below for details.
+ 2. Connect the Hy-Mini STM32v board to your computer using a USB
+ cable.
+ 3. Start the DFU loader on the Hy-Mini STM32v board. You do this by
+ resetting the board while holding the "Key" button. Windows should
+ recognize that the DFU loader has been installed.
+ 3. Run the DFU SE program to load nuttx.dfu into FLASH.
+
+ What if the DFU loader is not in FLASH? The loader code is available
+ inside of the Demo dirctory of the USBLib ZIP file that can be downloaded
+ from the STMicro Website. You can build it using RIDE (or other toolchains);
+ you will need a JTAG emulator to burn it into FLASH the first time.
+
+ In order to use STMicro's built-in DFU loader, you will have to get
+ the NuttX binary into a special format with a .dfu extension. The
+ DFU SE PC_based software installation includes a file "DFU File Manager"
+ conversion program that a file in Intel Hex format to the special DFU
+ format. When you successfully build NuttX, you will find a file called
+ nutt.hex in the top-level directory. That is the file that you should
+ provide to the DFU File Manager. You will end up with a file called
+ nuttx.dfu that you can use with the STMicro DFU SE program.
+
+LEDs
+====
+
+The HY-MiniSTM32 board provides only two controlable LEDs labeled LED1 and LED2.
+Usage of these LEDs is defined in include/board.h and src/up_leds.c.
+They are encoded as follows:
+
+ SYMBOL Meaning LED1* LED2
+ ------------------- ----------------------- ------- -------
+ LED_STARTED NuttX has been started OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated ON OFF
+ LED_IRQSENABLED Interrupts enabled OFF ON
+ LED_STACKCREATED Idle stack created ON OFF
+ LED_INIRQ In an interrupt** OFF N/C
+ LED_SIGNAL In a signal handler*** N/C ON
+ LED_ASSERTION An assertion failed ON ON
+ LED_PANIC The system has crashed BLINK BLINK
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If Nuttx starts correctly, normal state is to have LED1 on and LED2 off.
+ ** LED1 is turned off during interrrupt.
+*** LED2 is turned on during signal handler.
+
+RTC
+===
+
+ The STM32 RTC may configured using the following settings.
+
+ CONFIG_RTC - Enables general support for a hardware RTC. Specific
+ architectures may require other specific settings.
+ CONFIG_RTC_HIRES - The typical RTC keeps time to resolution of 1
+ second, usually supporting a 32-bit time_t value. In this case,
+ the RTC is used to &quot;seed&quot; the normal NuttX timer and the
+ NuttX timer provides for higher resoution time. If CONFIG_RTC_HIRES
+ is enabled in the NuttX configuration, then the RTC provides higher
+ resolution time and completely replaces the system timer for purpose of
+ date and time.
+ CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the
+ frequency of the high resolution RTC must be provided. If CONFIG_RTC_HIRES
+ is not defined, CONFIG_RTC_FREQUENCY is assumed to be one.
+ CONFIG_RTC_ALARM - Enable if the RTC hardware supports setting of an alarm.
+ A callback function will be executed when the alarm goes off
+
+ In hi-res mode, the STM32 RTC operates only at 16384Hz. Overflow interrupts
+ are handled when the 32-bit RTC counter overflows every 3 days and 43 minutes.
+ A BKP register is incremented on each overflow interrupt creating, effectively,
+ a 48-bit RTC counter.
+
+ In the lo-res mode, the RTC operates at 1Hz. Overflow interrupts are not handled
+ (because the next overflow is not expected until the year 2106.
+
+ WARNING: Overflow interrupts are lost whenever the STM32 is powered down. The
+ overflow interrupt may be lost even if the STM32 is powered down only momentarily.
+ Therefore hi-res solution is only useful in systems where the power is always on.
+
+HY-Mini specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F103VCT6
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=hymini-stm32v (for the HY-Mini development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x0000C000 (48Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The STM32F103V supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ AHB
+ ---
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_CRC
+ CONFIG_STM32_FSMC
+ CONFIG_STM32_SDIO
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3 (required for PWM control of LCD backlight)
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI4
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_USB
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_BKP
+ CONFIG_STM32_PWR
+ CONFIG_STM32_DAC
+ CONFIG_STM32_USB
+
+ APB2
+ ----
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_ADC3
+
+ Timer and I2C devices may need to the following to force power to be applied
+ unconditionally at power up. (Otherwise, the device is powered when it is
+ initialized).
+
+ CONFIG_STM32_FORCEPOWER
+
+ The Timer3 alternate mapping is required for PWM control of LCD backlight
+
+ CONFIG_STM32_TIM3_PARTIAL_REMAP=y
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,8
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,8
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,8, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,8
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,8, m=1,..,2
+
+ Others alternate pin mappings available:
+
+ CONFIG_STM32_TIM1_FULL_REMAP
+ CONFIG_STM32_TIM1_PARTIAL_REMAP
+ CONFIG_STM32_TIM2_FULL_REMAP
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_1
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_2
+ CONFIG_STM32_TIM3_FULL_REMAP
+ CONFIG_STM32_TIM3_PARTIAL_REMAP
+ CONFIG_STM32_TIM4_REMAP
+ CONFIG_STM32_USART1_REMAP
+ CONFIG_STM32_USART2_REMAP
+ CONFIG_STM32_USART3_FULL_REMAP
+ CONFIG_STM32_USART3_PARTIAL_REMAP
+ CONFIG_STM32_SPI1_REMAP
+ CONFIG_STM32_SPI3_REMAP
+ CONFIG_STM32_I2C1_REMAP
+ CONFIG_STM32_CAN1_REMAP1
+ CONFIG_STM32_CAN1_REMAP2
+ CONFIG_STM32_CAN2_REMAP
+
+ STM32F103V specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+
+ Note: USART1 is connected to a PL2303 serial to USB converter.
+ So USART1 is available through USB port labeled CN3 on the board.
+
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+ CONFIG_MMCSD_HAVECARDDETECT - Select if SDIO driver card detection
+ is 100% accurate (it is on the HY-MiniSTM32V)
+
+ HY-MiniSTM32V CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ HY-MiniSTM32V LCD Hardware Configuration (SSD1289 controler)
+
+ CONFIG_NX_LCDDRIVER - To be defined to include LCD driver
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. In this orientation, the HY-MiniSTM32V's
+ LCD used connector is at the right of the display.
+ Default is this 320x240 "landscape" orientation
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support. In this orientation, the HY-MiniSTM32V's
+ LCD used connector is at the bottom of the display. Default is
+ 320x240 "landscape" orientation.
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support. In this orientation, the
+ HY-MiniSTM32V's LCD used connector is at the top of the display.
+ Default is 320x240 "landscape" orientation.
+ CONFIG_LCD_BACKLIGHT - Define to support an adjustable backlight
+ using timer 3. The granularity of the settings is determined
+ by CONFIG_LCD_MAXPOWER. Requires CONFIG_STM32_TIM3.
+
+
+Configurations
+==============
+
+Each HY-MiniSTM32V configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh hymini-stm32v/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ buttons:
+ --------
+
+ Uses apps/examples/buttons to exercise HY-MiniSTM32V buttons and
+ button interrupts.
+
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+
+ nsh and nsh2:
+ ------------
+ Configure the NuttShell (nsh) located at examples/nsh.
+
+ Differences between the two NSH configurations:
+
+ =========== ======================= ================================
+ nsh nsh2
+ =========== ======================= ================================
+ Toolchain: Codesourcery for Linux Codesourcery for Linux (1)
+ ----------- ----------------------- --------------------------------
+ Loader: ST bootloader ST bootloader
+ ----------- ----------------------- --------------------------------
+ Serial Debug output: USART1 Debug output: USART1
+ Console: NSH output: USART1 NSH output: USART1 (3)
+ ----------- ----------------------- --------------------------------
+ microSD Yes Yes
+ Support
+ ----------- ----------------------- --------------------------------
+ FAT FS CONFIG_FAT_LCNAME=y CONFIG_FAT_LCNAME=y
+ Config CONFIG_FAT_LFN=n CONFIG_FAT_LFN=y (4)
+ ----------- ----------------------- --------------------------------
+ LCD Driver No Yes
+ Support
+ ----------- ----------------------- --------------------------------
+ RTC Support No Yes
+ ----------- ----------------------- --------------------------------
+ Support for No Yes
+ Built-in
+ Apps
+ ----------- ----------------------- --------------------------------
+ Built-in None apps/examples/nx
+ Apps apps/examples/nxhello
+ apps/examples/usbstorage (5)
+ apps/examples/buttons
+ apps/examples/nximage
+ =========== ======================= ================================
+
+ (1) You will probably need to modify nsh/setenv.sh or nsh2/setenv.sh
+ to set up the correct PATH variable for whichever toolchain you
+ may use.
+ (2) Since DfuSe is assumed, this configuration may only work under
+ Cygwin without modification.
+ (3) When any other device other than /dev/console is used for a user
+ interface, (1) linefeeds (\n) will not be expanded to carriage return
+ / linefeeds \r\n). You will need to configure your terminal program
+ to account for this. And (2) input is not automatically echoed so
+ you will have to turn local echo on.
+ (4) Microsoft holds several patents related to the design of
+ long file names in the FAT file system. Please refer to the
+ details in the top-level COPYING file. Please do not use FAT
+ long file name unless you are familiar with these patent issues.
+ (5) When built as an NSH add-on command (CONFIG_EXAMPLES_USBMSC_BUILTIN=y),
+ Caution should be used to assure that the SD drive is not in use when
+ the USB storage device is configured. Specifically, the SD driver
+ should be unmounted like:
+
+ nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Card is mounted in NSH
+ ...
+ nsh> umount /mnd/sdcard # Unmount before connecting USB!!!
+ nsh> msconn # Connect the USB storage device
+ ...
+ nsh> msdis # Disconnect USB storate device
+ nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Restore the mount
+
+ Failure to do this could result in corruption of the SD card format.
+
+ nx:
+ ---
+ An example using the NuttX graphics system (NX). This example
+ focuses on general window controls, movement, mouse and keyboard
+ input.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
+
+ nxlines:
+ ------
+ Another example using the NuttX graphics system (NX). This
+ example focuses on placing lines on the background in various
+ orientations.
+
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
+
+ usbserial:
+ ---------
+ This configuration directory exercises the USB serial class
+ driver at examples/usbserial. See examples/README.txt for
+ more information.
+
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+
+ USB debug output can be enabled as by changing the following
+ settings in the configuration file:
+
+ -CONFIG_DEBUG=n
+ -CONFIG_DEBUG_VERBOSE=n
+ -CONFIG_DEBUG_USB=n
+ +CONFIG_DEBUG=y
+ +CONFIG_DEBUG_VERBOSE=y
+ +CONFIG_DEBUG_USB=y
+
+ -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+ +CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=y
+
+ By default, the usbserial example uses the Prolific PL2303
+ serial/USB converter emulation. The example can be modified
+ to use the CDC/ACM serial class by making the following changes
+ to the configuration file:
+
+ -CONFIG_PL2303=y
+ +CONFIG_PL2303=n
+
+ -CONFIG_CDCACM=n
+ +CONFIG_CDCACM=y
+
+ The example can also be converted to use the alternative
+ USB serial example at apps/examples/usbterm by changing the
+ following:
+
+ -CONFIGURED_APPS += examples/usbserial
+ +CONFIGURED_APPS += examples/usbterm
+
+ In either the original appconfig file (before configuring)
+ or in the final apps/.config file (after configuring).
+
+ usbstorage:
+ ----------
+ This configuration directory exercises the USB mass storage
+ class driver at examples/usbstorage. See examples/README.txt for
+ more information.
+
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+
diff --git a/nuttx/configs/hymini-stm32v/buttons/Make.defs b/nuttx/configs/hymini-stm32v/buttons/Make.defs
new file mode 100644
index 000000000..7956afb10
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/buttons/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/hymini-stm32v/buttons/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/buttons/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/buttons/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/buttons/appconfig b/nuttx/configs/hymini-stm32v/buttons/appconfig
new file mode 100644
index 000000000..b20cea202
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/buttons/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/hymini-stm32v/buttons/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/buttons
+
diff --git a/nuttx/configs/hymini-stm32v/buttons/defconfig b/nuttx/configs/hymini-stm32v/buttons/defconfig
new file mode 100644
index 000000000..b03997e42
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/buttons/defconfig
@@ -0,0 +1,481 @@
+############################################################################
+# configs/hymini-stm32v/buttons/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="buttons_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=7
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=2
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="WAKEUP"
+CONFIG_EXAMPLE_BUTTONS_NAME1="TAMPER"
+CONFIG_EXAMPLE_BUTTONS_NAME2="KEY"
+CONFIG_EXAMPLE_BUTTONS_NAME3="SELECT"
+CONFIG_EXAMPLE_BUTTONS_NAME4="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME5="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME6="RIGHT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="UP"
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/buttons/ld.script b/nuttx/configs/hymini-stm32v/buttons/ld.script
new file mode 100644
index 000000000..ef6968958
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/buttons/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/hymini-stm32v/buttons/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VCT6 has 256Kb of FLASH beginning at address 0x0800:0000 and
+ * 48Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103V has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/buttons/ld.script.dfu b/nuttx/configs/hymini-stm32v/buttons/ld.script.dfu
new file mode 100644
index 000000000..5c839a0d8
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/buttons/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/buttons/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/buttons/setenv.sh b/nuttx/configs/hymini-stm32v/buttons/setenv.sh
new file mode 100755
index 000000000..df0dba318
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/buttons/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/hymini-stm32v/buttons/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/hymini-stm32v/include/README.txt b/nuttx/configs/hymini-stm32v/include/README.txt
new file mode 100644
index 000000000..ab0848412
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the HY-MiniSTM32V development board.
diff --git a/nuttx/configs/hymini-stm32v/include/board.h b/nuttx/configs/hymini-stm32v/include/board.h
new file mode 100644
index 000000000..333f83b89
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/include/board.h
@@ -0,0 +1,244 @@
+/************************************************************************************
+ * configs/hymini-stm32v/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Laurent Latil. All rights reserved.
+ * Author: Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Derives, in part, from configs/stm3210e-eval/include/board.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* On-board crystal frequency is 8MHz (HSE) */
+
+#define STM32_BOARD_XTAL 8000000ul
+
+/* PLL source is HSE/1, PLL multipler is 9: PLL frequency is 8MHz (XTAL) x 9 = 72MHz */
+
+#define STM32_CFGR_PLLSRC RCC_CFGR_PLLSRC
+#define STM32_CFGR_PLLXTPRE 0
+#define STM32_CFGR_PLLMUL RCC_CFGR_PLLMUL_CLKx9
+#define STM32_PLL_FREQUENCY (9*STM32_BOARD_XTAL)
+
+/* Use the PLL and set the SYSCLK source to be the PLL */
+
+#define STM32_SYSCLK_SW RCC_CFGR_SW_PLL
+#define STM32_SYSCLK_SWS RCC_CFGR_SWS_PLL
+#define STM32_SYSCLK_FREQUENCY STM32_PLL_FREQUENCY
+
+/* AHB clock (HCLK) is SYSCLK (72MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
+#define STM32_HCLK_FREQUENCY STM32_PLL_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB2 clock (PCLK2) is HCLK (72MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
+#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* APB2 timers 1 and 8 will receive PCLK2. */
+
+#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
+
+/* APB1 clock (PCLK1) is HCLK/2 (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd2
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB1 timers 2-4 will be twice PCLK1 (I presume the remaining will receive PCLK1) */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
+
+/* USB divider -- Divide PLL clock by 1.5 */
+
+#define STM32_CFGR_USBPRE 0
+
+/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
+ * otherwise frequency is 2xAPBx.
+ * Note: TIM1,8 are on APB2, others on APB1 */
+
+#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode. These values have not been
+ * tuned!!!
+ *
+ * HCLK=72MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(178+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (178 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_MMCXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_SDXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* LED definitions ******************************************************************/
+
+/* The board has 2 LEDs that we will encode as: */
+#define LED_STARTED 0 /* No LEDs */
+#define LED_HEAPALLOCATE 1 /* LED1 on */
+#define LED_IRQSENABLED 2 /* LED2 on */
+#define LED_STACKCREATED 3 /* LED1 on */
+#define LED_INIRQ 4 /* LED1 off */
+#define LED_SIGNAL 5 /* LED2 on */
+#define LED_ASSERTION 6 /* LED1 + LED2 */
+#define LED_PANIC 7 /* LED1 / LED2 blinking */
+
+/* The board supports two user buttons
+ *
+ * KeyA -- Connected to PC.13
+ * KeyB -- Connected to PB.2
+ */
+
+#define BUTTON_KEYA 0
+#define BUTTON_KEYB 1
+
+#define NUM_BUTTONS 2
+
+#define BUTTON_KEYA_BIT (1 << BUTTON_KEYA)
+#define BUTTON_KEYB_BIT (1 << BUTTON_KEYB)
+
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the initialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/hymini-stm32v/nsh/Make.defs b/nuttx/configs/hymini-stm32v/nsh/Make.defs
new file mode 100644
index 000000000..442eb2974
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/hymini-stm32v/nsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/nsh/appconfig b/nuttx/configs/hymini-stm32v/nsh/appconfig
new file mode 100644
index 000000000..f15695797
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/hymini-stm32v/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/hymini-stm32v/nsh/defconfig b/nuttx/configs/hymini-stm32v/nsh/defconfig
new file mode 100755
index 000000000..98849c1b8
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh/defconfig
@@ -0,0 +1,466 @@
+############################################################################
+# configs/hymini-stm32v/nsh/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=n
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103V specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/nsh/ld.script b/nuttx/configs/hymini-stm32v/nsh/ld.script
new file mode 100755
index 000000000..c09e716cb
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nsh/ld.script.dfu b/nuttx/configs/hymini-stm32v/nsh/ld.script.dfu
new file mode 100755
index 000000000..5dfc51ad1
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nsh/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nsh/setenv.sh b/nuttx/configs/hymini-stm32v/nsh/setenv.sh
new file mode 100755
index 000000000..a0371cdce
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/hymini-stm32v/dfu/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/hymini-stm32v/nsh2/Make.defs b/nuttx/configs/hymini-stm32v/nsh2/Make.defs
new file mode 100644
index 000000000..574230067
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh2/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/hymini-stm32v/nsh2/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh2/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh2/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/nsh2/appconfig b/nuttx/configs/hymini-stm32v/nsh2/appconfig
new file mode 100644
index 000000000..78f3e76c5
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh2/appconfig
@@ -0,0 +1,53 @@
+############################################################################
+# configs/hymini-stm32v/nsh2/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# The NX and NXHELLO examples configured as an NX built-in commands
+
+# CONFIGURED_APPS += examples/nx
+CONFIGURED_APPS += examples/usbstorage
+CONFIGURED_APPS += examples/nximage
+CONFIGURED_APPS += examples/touchscreen
+CONFIGURED_APPS += examples/lcdtest
+CONFIGURED_APPS += examples/buttons
+CONFIGURED_APPS += examples/tc_test
diff --git a/nuttx/configs/hymini-stm32v/nsh2/defconfig b/nuttx/configs/hymini-stm32v/nsh2/defconfig
new file mode 100644
index 000000000..95e7f8b95
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh2/defconfig
@@ -0,0 +1,585 @@
+############################################################################
+# configs/hymini-stm32v/nsh2/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=y
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+
+# Backup domain
+CONFIG_STM32_BKP=y
+CONFIG_STM32_PWR=y
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=y
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+CONFIG_STM32_TIM3_PARTIAL_REMAP=y
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+CONFIG_RTC=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_GRAPHICS=y
+CONFIG_DEBUG_LCD=y
+CONFIG_DEBUG_INPUT=y
+CONFIG_DEBUG_USB=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=5
+CONFIG_GREGORIAN_TIME=y
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=y
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=y
+
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=y
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=n
+
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=y
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=y
+CONFIG_LCD_RPORTRAIT=n
+CONFIG_LCD_BACKLIGHT=y
+
+# Configurable steps for the LCD backlight
+CONFIG_LCD_MAXPOWER=100
+
+# Not used
+CONFIG_LCD_MAXCONTRAST=100
+
+#
+# TouchScreen hardware
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_ADS7843E=y
+CONFIG_SPI_OWNBUS=y
+CONFIG_ADS7843E_SPIDEV=1
+#CONFIG_ADS7843E_SPIMODE=SPIDEV_MODE0
+
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+CONFIG_EXAMPLES_LCDTEST_BUILTIN=y
+CONFIG_EXAMPLES_BUTTONS_BUILTIN=y
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/nsh2/ld.script b/nuttx/configs/hymini-stm32v/nsh2/ld.script
new file mode 100644
index 000000000..1b861e6b6
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh2/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nsh2/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VCT6 has 256Kb of FLASH beginning at address 0x0800:0000 and
+ * 48Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nsh2/ld.script.dfu b/nuttx/configs/hymini-stm32v/nsh2/ld.script.dfu
new file mode 100644
index 000000000..a8d0839c1
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh2/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nsh2/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nsh2/setenv.sh b/nuttx/configs/hymini-stm32v/nsh2/setenv.sh
new file mode 100755
index 000000000..37ae1800b
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nsh2/setenv.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# configs/hymini-stm32v/nsh2/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/hymini-stm32v/nx/Make.defs b/nuttx/configs/hymini-stm32v/nx/Make.defs
new file mode 100644
index 000000000..53533cfcc
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nx/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/hymini-stm32v/nx/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/nx/appconfig b/nuttx/configs/hymini-stm32v/nx/appconfig
new file mode 100644
index 000000000..2a1978a7e
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/hymini-stm32v/nx/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/hymini-stm32v/nx/defconfig b/nuttx/configs/hymini-stm32v/nx/defconfig
new file mode 100644
index 000000000..d4f468d32
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nx/defconfig
@@ -0,0 +1,575 @@
+############################################################################
+# configs/hymini-stm32v/nx/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103V specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=5
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/nx/ld.script b/nuttx/configs/hymini-stm32v/nx/ld.script
new file mode 100644
index 000000000..c4a12d2b9
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nx/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nx/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VCT6 has 256Kb of FLASH beginning at address 0x0800:0000 and
+ * 48Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nx/ld.script.dfu b/nuttx/configs/hymini-stm32v/nx/ld.script.dfu
new file mode 100644
index 000000000..bd995086f
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nx/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nx/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nx/setenv.sh b/nuttx/configs/hymini-stm32v/nx/setenv.sh
new file mode 100755
index 000000000..4e9fdb4ec
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nx/setenv.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# configs/hymini-stm32v/nx/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/hymini-stm32v/nxlines/Make.defs b/nuttx/configs/hymini-stm32v/nxlines/Make.defs
new file mode 100644
index 000000000..764bea986
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nxlines/Make.defs
@@ -0,0 +1,177 @@
+############################################################################
+# configs/hymini-stm32v/nxlines/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxlines/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxlines/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/nxlines/appconfig b/nuttx/configs/hymini-stm32v/nxlines/appconfig
new file mode 100644
index 000000000..bf30ded8b
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nxlines/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/hymini-stm32v/nxlines/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxlines
+
diff --git a/nuttx/configs/hymini-stm32v/nxlines/defconfig b/nuttx/configs/hymini-stm32v/nxlines/defconfig
new file mode 100644
index 000000000..01da0ea84
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nxlines/defconfig
@@ -0,0 +1,583 @@
+############################################################################
+# configs/hymini-stm32v/nxlines/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+
+CONFIG_STM32_TIM3_PARTIAL_REMAP=y
+
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxlines_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=y
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=y
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=n
+CONFIG_LCD_BACKLIGHT=y
+
+# Configurable steps for the LCD backlight
+CONFIG_LCD_MAXPOWER=100
+
+# Not used
+CONFIG_LCD_MAXCONTRAST=100
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxtext
+#
+CONFIG_EXAMPLES_NXTEXT_BUILTIN=n
+CONFIG_EXAMPLES_NXTEXT_VPLANE=0
+CONFIG_EXAMPLES_NXTEXT_DEVNO=0
+CONFIG_EXAMPLES_NXTEXT_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXTEXT_BGFONTID=11
+CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXTEXT_PUCOLOR=0xfd20
+CONFIG_EXAMPLES_NXTEXT_PUFONTID=1
+CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR=0x001f
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_NOGETRUN=y
+CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=n
+CONFIG_EXAMPLES_NXTEXT_BMCACHE=512
+CONFIG_EXAMPLES_NXTEXT_GLCACHE=16
+CONFIG_EXAMPLES_NXTEXT_STACKSIZE=2048
+CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO=80
+CONFIG_EXAMPLES_NXTEXT_SERVERPRIO=120
+CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/nxlines/ld.script b/nuttx/configs/hymini-stm32v/nxlines/ld.script
new file mode 100644
index 000000000..4938ad501
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nxlines/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nxlines/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VCT6 has 256Kb of FLASH beginning at address 0x0800:0000 and
+ * 48Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nxlines/ld.script.dfu b/nuttx/configs/hymini-stm32v/nxlines/ld.script.dfu
new file mode 100644
index 000000000..b64109da8
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nxlines/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/nxlines/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/nxlines/setenv.sh b/nuttx/configs/hymini-stm32v/nxlines/setenv.sh
new file mode 100755
index 000000000..53ccb2d0f
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/nxlines/setenv.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# configs/hymini-stm32v/nxlines/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!"
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/hymini-stm32v/src/Makefile b/nuttx/configs/hymini-stm32v/src/Makefile
new file mode 100644
index 000000000..fcfb670da
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/Makefile
@@ -0,0 +1,106 @@
+############################################################################
+# configs/hymini-stm32v/src/Makefile
+#
+# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+# Laurent Latil <laurent@latil.nom.fr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_leds.c up_buttons.c up_spi.c up_usbdev.c
+
+ifeq ($(CONFIG_NX_LCDDRIVER),y)
+CSRCS += ssd1289.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_INPUT),y)
+CSRCS += up_ts.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/hymini-stm32v/src/README.txt b/nuttx/configs/hymini-stm32v/src/README.txt
new file mode 100644
index 000000000..d7c4f97cc
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the HY-MiniSTM32V development board.
diff --git a/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h b/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h
new file mode 100644
index 000000000..03dceea19
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h
@@ -0,0 +1,140 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/hymini_stm32v-internal.h
+ * arch/arm/src/board/hymini_stm32v-internal.h
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_HYMINI_STM32V_INTERNAL_H
+#define __CONFIGS_HYMINI_STM32V_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
+ * modules (others may support more -- in such case, the following must be
+ * expanded).
+ */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+#endif
+
+/* GPIOs **************************************************************/
+/* LEDs */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN0)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1)
+
+/* BUTTONS -- NOTE that some have EXTI interrupts configured */
+
+#define MIN_IRQBUTTON BUTTON_KEYA
+#define MAX_IRQBUTTON BUTTON_KEYB
+#define NUM_IRQBUTTONS NUM_BUTTONS
+
+/* Button A is externally pulled up */
+#define GPIO_BTN_KEYA (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTC|GPIO_PIN13)
+
+/* Button B is externally pulled dw */
+#define GPIO_BTN_KEYB (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTB|GPIO_PIN2)
+
+/* SPI touch screen (ADS7843) chip select: PA.4 */
+
+#define GPIO_TS_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
+
+/* Touch screen (ADS7843) IRQ pin: PB.6 */
+#define GPIO_TS_IRQ (GPIO_INPUT|GPIO_CNF_INPULLUP|GPIO_MODE_INPUT|\
+ GPIO_PORTB|GPIO_PIN6)
+
+/* USB Soft Connect Pullup: PB.7 */
+#define GPIO_USB_PULLUP (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7)
+
+/* SD card detect pin: PD.3 */
+#define GPIO_SD_CD (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTD|GPIO_PIN3)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Hy-Mini STM32v board.
+ *
+ ************************************************************************************/
+
+extern void weak_function stm32_spiinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the Hy-Mini STM32v board.
+ *
+ ************************************************************************************/
+
+extern void weak_function stm32_usbinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_HYMINI_STM32V_INTERNAL_H */
+
diff --git a/nuttx/configs/hymini-stm32v/src/ssd1289.c b/nuttx/configs/hymini-stm32v/src/ssd1289.c
new file mode 100644
index 000000000..0ebf82274
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/ssd1289.c
@@ -0,0 +1,989 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/ssd1289.c
+ * arch/arm/src/board/ssd1289.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm32_internal.h"
+#include "hymini_stm32v-internal.h"
+
+#include "ssd1289.h"
+
+/* Color depth and format */
+#define LCD_BPP 16
+#define LCD_COLORFMT FB_FMT_RGB16_565
+
+/* Display Resolution */
+#if defined(CONFIG_LCD_LANDSCAPE)
+# define LCD_XRES 320
+# define LCD_YRES 240
+#else
+# define LCD_XRES 240
+# define LCD_YRES 320
+#endif
+
+#define LCD_BL_TIMER_PERIOD 8999
+
+
+/* Debug ******************************************************************************/
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg(format, arg...) vdbg(format, ##arg)
+#else
+# define lcddbg(x...)
+#endif
+
+/* LCD is connected to the FSMC_Bank1_NOR/SRAM1 and NE1 is used as ship select signal */
+/* RS <==> A16 */
+#define LCD_REG (*((volatile unsigned short *) 0x60000000)) /* RS = 0 */
+#define LCD_RAM (*((volatile unsigned short *) 0x60020000)) /* RS = 1 */
+
+const uint16_t fsmc_gpios[] =
+{ /* A16... A24 */
+ GPIO_NPS_A16, GPIO_NPS_A17, GPIO_NPS_A18, GPIO_NPS_A19, GPIO_NPS_A20,
+ GPIO_NPS_A21, GPIO_NPS_A22, GPIO_NPS_A23,
+
+ /* D0... D15 */GPIO_NPS_D0, GPIO_NPS_D1, GPIO_NPS_D2, GPIO_NPS_D3,
+ GPIO_NPS_D4, GPIO_NPS_D5, GPIO_NPS_D6, GPIO_NPS_D7, GPIO_NPS_D8, GPIO_NPS_D9,
+ GPIO_NPS_D10, GPIO_NPS_D11, GPIO_NPS_D12, GPIO_NPS_D13, GPIO_NPS_D14,
+ GPIO_NPS_D15,
+
+ /* NOE, NWE */GPIO_NPS_NOE, GPIO_NPS_NWE,
+
+ /* NE1 */GPIO_NPS_NE1 };
+
+#define NGPIOS (sizeof(fsmc_gpios)/sizeof(uint16_t))
+
+/** This should be put elsewhere */
+#ifdef __CC_ARM /* ARM Compiler */
+#define lcd_inline static __inline
+#elif defined (__ICCARM__) /* for IAR Compiler */
+#define lcd_inline inline
+#elif defined (__GNUC__) /* GNU GCC Compiler */
+#define lcd_inline static __inline
+#else
+#define lcd_inline static
+#endif
+
+/* Low Level methods */
+void lcd_clear(uint16_t color);
+
+/* LCD Data Transfer Methods */
+int lcd_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels);
+int lcd_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels);
+
+/* LCD Configuration */
+static int lcd_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo);
+static int lcd_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo);
+
+/* LCD RGB Mapping */
+#ifdef CONFIG_FB_CMAP
+# error "RGB color mapping not supported by this driver"
+#endif
+
+/* Cursor Controls */
+#ifdef CONFIG_FB_HWCURSOR
+# error "Cursor control not supported by this driver"
+#endif
+
+/* LCD Specific Controls */
+static int lcd_getpower(struct lcd_dev_s *dev);
+static int lcd_setpower(struct lcd_dev_s *dev, int power);
+static int lcd_getcontrast(struct lcd_dev_s *dev);
+static int lcd_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
+
+/* Initialization (LCD ctrl / backlight) */
+static inline void lcd_initialize(void);
+
+#ifdef CONFIG_LCD_BACKLIGHT
+static void lcd_backlight(void);
+#else
+# define lcd_backlight()
+#endif
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is working memory allocated by the LCD driver for each LCD device
+ * and for each color plane. This memory will hold one raster line of data.
+ * The size of the allocated run buffer must therefore be at least
+ * (bpp * xres / 8). Actual alignment of the buffer must conform to the
+ * bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
+ */
+
+static uint16_t g_runbuffer[LCD_XRES];
+
+/* This structure describes the overall LCD video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{ .fmt = LCD_COLORFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */
+ .xres = LCD_XRES, /* Horizontal resolution in pixel columns */
+ .yres = LCD_YRES, /* Vertical resolution in pixel rows */
+ .nplanes = 1, /* Number of color planes supported */
+};
+
+/* This is the standard, NuttX Plane information object */
+
+static const struct lcd_planeinfo_s g_planeinfo =
+{ .putrun = lcd_putrun, /* Put a run into LCD memory */
+ .getrun = lcd_getrun, /* Get a run from LCD memory */
+ .buffer = (uint8_t*) g_runbuffer, /* Run scratch buffer */
+ .bpp = LCD_BPP, /* Bits-per-pixel */
+};
+
+/* This is the standard, NuttX LCD driver object */
+
+static struct ssd1289_dev_s g_lcddev =
+{ .dev =
+ {
+ /* LCD Configuration */
+
+ .getvideoinfo = lcd_getvideoinfo,
+ .getplaneinfo = lcd_getplaneinfo,
+
+/* LCD RGB Mapping -- Not supported */
+/* Cursor Controls -- Not supported */
+
+/* LCD Specific Controls */
+ .getpower = lcd_getpower,
+ .setpower = lcd_setpower,
+ .getcontrast = lcd_getcontrast,
+ .setcontrast = lcd_setcontrast,
+ },
+ .power=0
+};
+
+/************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for NOR or SRAM
+ *
+ ************************************************************************************/
+
+static inline void stm32_extmemgpios(const uint16_t *gpios, int ngpios)
+{
+ int i;
+
+ /* Configure GPIOs */
+ for (i = 0; i < ngpios; i++)
+ {
+ stm32_configgpio(gpios[i]);
+ }
+}
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# error CONFIG_STM32_FSMC is required for LCD support
+#endif
+
+static void stm32_enablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHBENR);
+ regval |= RCC_AHBENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHBENR);
+}
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+static void stm32_disablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHBENR);
+ regval &= ~RCC_AHBENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHBENR);
+}
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+static void stm32_selectlcd(void)
+{
+ /* Configure new GPIO state */
+ stm32_extmemgpios(fsmc_gpios, NGPIOS);
+
+ /* Enable AHB clocking to the FSMC */
+ stm32_enablefsmc();
+
+ /* Bank1 NOR/SRAM control register configuration */
+ putreg32(FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+ putreg32(
+ FSMC_BTR_ADDSET(2)|FSMC_BTR_ADDHLD(0)|FSMC_BTR_DATAST(2)|FSMC_BTR_BUSTRUN(0)| FSMC_BTR_CLKDIV(0)|FSMC_BTR_DATLAT(0)|FSMC_BTR_ACCMODA,
+ STM32_FSMC_BTR1);
+
+ /* As ext mode is not active the write timing is ignored!! */
+ putreg32(0xffffffff, STM32_FSMC_BWTR1);
+
+ /* Enable the bank by setting the MBKEN bit */
+ putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN,
+ STM32_FSMC_BCR1);
+}
+
+/************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ************************************************************************************/
+// FIXME: Check this code !!
+void stm32_deselectlcd(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(0xffffffff, STM32_FSMC_BCR4);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(0x0fffffff, STM32_FSMC_BTR4);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+lcd_inline void write_cmd(unsigned short cmd)
+{
+ LCD_REG = cmd;
+}
+
+lcd_inline unsigned short read_data(void)
+{
+ return LCD_RAM;
+}
+
+lcd_inline void write_data(unsigned short data_code)
+{
+ LCD_RAM = data_code;
+}
+
+void write_reg(unsigned char reg_addr, unsigned short reg_val)
+{
+ write_cmd(reg_addr);
+ write_data(reg_val);
+}
+
+unsigned short read_reg(unsigned char reg_addr)
+{
+ unsigned short val;
+ write_cmd(reg_addr);
+ val = read_data();
+ return (val);
+}
+
+static inline void lcd_gramselect(void)
+{
+ write_cmd(0x22);
+}
+
+void lcd_setcursor(unsigned int x, unsigned int y)
+{
+#if defined(CONFIG_LCD_PORTRAIT) || defined (CONFIG_LCD_RPORTRAIT)
+# if defined (CONFIG_LCD_RPORTRAIT)
+ x = (LCD_XRES - 1) - x;
+ y = (LCD_YRES - 1) - y;
+# endif
+ write_reg(0x4e, x);
+ write_reg(0x4f, y);
+#endif
+
+#if defined(CONFIG_LCD_LANDSCAPE)
+ y = (LCD_YRES - 1) - y;
+
+ write_reg(0x4e, y);
+ write_reg(0x4f, x);
+#endif
+}
+
+/**************************************************************************************
+ * Name: lcd_putrun
+ *
+ * Description:
+ * This method can be used to write a partial raster line to the LCD:
+ *
+ * row - Starting row to write to (range: 0 <= row < yres)
+ * col - Starting column to write to (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer containing the run to be written to the LCD
+ * npixels - The number of pixels to write to the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+int lcd_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels)
+{
+ int i;
+ FAR const uint16_t *src = (FAR const uint16_t*) buffer;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Write the run to GRAM. */
+ lcd_setcursor(col, row);
+
+ lcd_gramselect();
+ for (i = 0; i < npixels; i++)
+ {
+ write_data(*src++);
+ }
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getrun
+ *
+ * Description:
+ * This method can be used to read a partial raster line from the LCD:
+ *
+ * row - Starting row to read from (range: 0 <= row < yres)
+ * col - Starting column to read read (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer in which to return the run read from the LCD
+ * npixels - The number of pixels to read from the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+int lcd_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels)
+{
+ FAR uint16_t *dest = (FAR uint16_t*) buffer;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Read the run from GRAM. */
+ lcd_setcursor(col, row);
+
+ lcd_gramselect();
+
+ /* dummy read */
+ (void)read_data();
+
+ for (i = 0; i < npixels; i++)
+ {
+ *dest++ = read_data();
+ }
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getvideoinfo
+ *
+ * Description:
+ * Get information about the LCD video controller configuration.
+ *
+ **************************************************************************************/
+
+static int lcd_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ DEBUGASSERT(dev && vinfo);gvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
+ g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getplaneinfo
+ *
+ * Description:
+ * Get information about the configuration of each LCD color plane.
+ *
+ **************************************************************************************/
+
+static int lcd_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo)
+{
+ DEBUGASSERT(dev && pinfo && planeno == 0);gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
+ memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: lcd_getpower
+ *
+ * Description:
+ * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int lcd_getpower(struct lcd_dev_s *dev)
+{
+ gvdbg("power: %d\n", 0);
+ return g_lcddev.power;
+}
+
+/**************************************************************************************
+ * Name: lcd_setpower
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on).
+ * Used here to set pwm duty on timer used for backlight.
+ *
+ **************************************************************************************/
+
+static int lcd_setpower(struct lcd_dev_s *dev, int power)
+{
+ if (g_lcddev.power == power) {
+ return OK;
+ }
+
+ gvdbg("power: %d\n", power);
+ DEBUGASSERT(power <= CONFIG_LCD_MAXPOWER);
+
+ /* Set new power level */
+
+ if (power > 0)
+ {
+#ifdef CONFIG_LCD_BACKLIGHT
+ uint32_t duty;
+
+ /* Calculate the new backlight duty. It is a fraction of the timer
+ * period based on the ration of the current power setting to the
+ * maximum power setting.
+ */
+ duty = ((uint32_t)LCD_BL_TIMER_PERIOD * (uint32_t)power) / CONFIG_LCD_MAXPOWER;
+ if (duty >= LCD_BL_TIMER_PERIOD)
+ {
+ duty = LCD_BL_TIMER_PERIOD - 1;
+ }
+ gvdbg("PWM duty: %d\n", duty);
+ putreg16((uint16_t)duty, STM32_TIM3_CCR2);
+#endif
+ /* TODO turn the display on */
+ }
+ else
+ {
+ /* FIXME: Turn display off ? */
+ gvdbg("Force PWM to 0\n");
+ putreg16((uint16_t)0, STM32_TIM3_CCR2);
+ }
+ g_lcddev.power = power;
+ return OK;
+}
+
+
+/**************************************************************************************
+ * Name: lcd_getcontrast
+ *
+ * Description:
+ * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int lcd_getcontrast(struct lcd_dev_s *dev)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: lcd_setcontrast
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int lcd_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: lcd_lcdinitialize
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+static inline void lcd_initialize(void)
+{
+ /* Display control (GON=1,DTE=0,D[1:0]=01)
+ D[1:0]=01 - Internal display is performed, display is off.
+ */
+ write_reg(0x07, 0x0021);
+
+ /* Oscillator (OSCEN=1) */
+ write_reg(0x00, 0x0001);
+
+ /* Display control (GON=1,DTE=0,D[1:0]=11)
+ D[1:0]=11 - Internal display is performed, display is on.
+ */
+ write_reg(0x07, 0x0023);
+
+ /* Wait 30ms */
+ up_mdelay(30);
+
+ /* Display control (GON=1,DTE=1,D[1:0]=11) */
+ write_reg(0x07, 0x0033);
+
+ /* Power control 1
+ DCT3 DCT2 DCT1 DCT0 BT2 BT1 BT0 - DC3 DC2 DC1 DC0 AP2 AP1 AP0 -
+ 1 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0
+ DCT[3:0] - 1010: fosc/4 (step-up cycle of the step-up circuit for 8-color mode)
+ BT[2:0] - 100 (step-up factor of the step-up circuit)
+ DC[3:0] - 1010: fosc/4 (step-up cycle of the step-up circuit for 262k-color mode)
+ AP[2:0] - 010: Small to medium (amount of current from the stable-current source in internal operational amplifier circuit)
+ */
+ write_reg(0x03, 0xA8A4); /* or 0x0804 ?? */
+
+ /* Power Control 2
+ VRC[2:0] - 000: 5.1v (VCIX2 output voltage)
+ */
+ write_reg(0x0C, 0x0000);
+
+ /* Power Control 3
+ - - - - - - - - - - - - VRH3 VRH2 VRH1 VRH0
+ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
+ VRH[3:0] - 1000: Vref x 2.165 (Set amplitude magnification of VLCD63)
+ */
+ write_reg(0x0D, 0x0008); // or 0x080C ??
+
+ /* power control 4
+ - - VCOMG VDV4 VDV3 VDV2 VDV1 VDV0 - - - - - - - -
+ 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0
+ VDV[4:0] - 01001: VLCD63 x 0.xx (Vcom amplitude)
+ VCOMG - 1 (enable output voltage of VcomL - VDV[4:0])
+ */
+ write_reg(0x0E, 0x2900);
+
+ /* Power Control 5
+ - - - - - - - - nOTP - VCM5 VCM4 VCM3 VCM2 VCM1 VCM0
+ 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0
+ nOTP: 1 - setting of VCM[5:0] becomes valid and voltage of VcomH can be adjusted.
+ VCM[5-0] - 111000: VLCD63 x 0.xx (amplify the VcomH voltage 0.35 to 0.99 times the VLCD63 voltage)
+ */
+ write_reg(0x1E, 0x00B8);
+
+ /* Driver Output Control
+ - RL REV CAD BGR SM TB MUX8 MUX7 MUX6 MUX5 MUX4 MUX3 MUX2 MUX1 MUX0
+ 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1
+ RL - 0 RL setting is ignored when display with RAM (Dmode[1:0] = 00).
+ REV - 1 Reverse source output level
+ CAD - 0 Cs on Common
+ BGR - 1 BGR (Selects the order from RGB to BGR in writing 18-bit pixel data in the GDDRAM)
+ SM - 0 (Gate scan sequence)
+ TB - 1 (output shift direction of the gate driver)
+ MUX[8:0] - 100111111 (319) (number of lines for the LCD driver)
+ */
+ write_reg(0x01, 0x2B3F);
+
+ /* LCD-Driving-Waveform Control
+ - - - FLD ENWS B/C EOR WSMD NW7 NW6 NW5 NW4 NW3 NW2 NW1 NW0
+ 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0
+ FLD - 0 ?
+ ENWS- 0 (disable WSYNC output pin -> HiZ)
+ B/C - 1 (When B/C = 1, a N-line inversion waveform is generated and alternates in a N-line equals to NW[7:0]+1)
+ EOR - 1
+ WSMD- 0
+ NW[7:0] - 0 Specify the number of lines that will alternate at the N-line inversion setting (if B/C = 1).
+ */
+ /* Set FLD ? */
+ write_reg(0x02, 0x0600);
+
+ /* Exit sleep mode */
+ write_reg(0x10, 0x0000);
+
+ /* Entry Mode
+ VSMode DFM1 DFM0 TRANS OEDef WMode DMode1 DMode0 TY1 TY0 ID1 ID0 AM LG2 LG1 LG0
+ 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0
+ VSMode - 0 When VSMode = 1 at DMode[1:0] = “00â€, the frame frequency will be dependent on VSYNC.
+ DFM[1:0] - 11 (65k color mode selected)
+ TRANS - 0 (if TRANS = 1, transparent display is allowed during DMode[1:0] = “1xâ€)
+ 0EDef - 0 (display window is defined by R4Eh and R4Fh)
+ WMode - 0 (Normal data bus)
+ DMode[1:0] - 00 (data display from RAM data)
+ TY[1:0] - 01 (type B. Used for 262k color mode only)
+ ID[1:0] - 11 (address counter auto incremented by 1, horizontal & vertical)
+ AM - 0 Horizontal (direction of the address counter update after data are written to the GDDRAM)
+ LG[2:0] - 000 (operation to perform according to GDRAM compare registers ?)
+ */
+#if defined(CONFIG_LCD_PORTRAIT)
+ write_reg(0x11, 0x6070);
+#elif defined(CONFIG_LCD_RPORTRAIT)
+ /* ID[1:0] - 00 (address counter auto decremented by 1, horizontal & vertical) */
+ write_reg(0x11, 0x6840);
+#elif defined(CONFIG_LCD_LANDSCAPE)
+ /* ID[1:0] - 10 (address counter auto decremented by 1, horizontal & vertical)
+ AM - 1 Vertical direction
+ */
+ write_reg(0x11, 0x6068);
+#else
+#error "LCD orientation not supported"
+#endif
+
+ /* Compare register (unused ?) */
+ write_reg(0x05, 0x0000);
+ write_reg(0x06, 0x0000);
+
+ /* Horizontal Porch
+ XL7 XL6 XL5 XL4 XL3 XL2 IB9 XL1 HBP7 HBP6 HBP5 HBP4 HBP3 HBP2 HBP1 HBP0
+ XL[7:0] - 0xEF (239) (Number of valid pixel per line is equal to XL[7:0] + 1)
+ HBP[7:0] - 0x1C (28) 30 dot clocks (delay period from falling edge of HSYNC signal to first valid data)
+ */
+ write_reg(0x16, 0xEF1C);
+
+ /* Vertical Porch */
+ write_reg(0x17, 0x0003);
+
+ /* Display control
+ - - - PT1 PT0 VLE2 VLE1 SPT - - GON DTE CM - D1 D0
+ 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 1
+ VLE[2:1]: 00 (When VLE1 = 1 or VLE2 = 1, vertical scroll performed in the 1st screen by taking data VL17-0 in R41h
+ register. When VLE1 = 1 and VLE2 = 1, a vertical scroll is performed in the 1st and 2nd screen by VL1[8:0] and VL2[8:0])
+ SPT: 1 (When SPT = “1â€, the 2-division LCD drive is performed.
+ CM: 0 (8-color mode setting 0=disabled, 1=enabled)
+ D[1:0]: 11
+ */
+ write_reg(0x07, 0x0133);
+
+ /* Frame Cycle Control */
+ write_reg(0x0B, 0x0000);
+
+ /* Gate Scan Position */
+ /* write_reg(0x0F, 0x0000); // Default value */
+
+ /* Vertical Scroll Control */
+ write_reg(0x41, 0x0000);
+ write_reg(0x42, 0x0000);
+
+ /* 1st Screen driving position
+ driving start position for the first screen in a line unit. (0)
+ */
+ write_reg(0x48, 0x0000);
+ /* driving end position for the first screen in a line unit. (319) */
+ write_reg(0x49, 0x013F);
+
+ /* 2nd Screen driving position (unused) */
+ write_reg(0x4A, 0x0000);
+ write_reg(0x4B, 0x0000);
+
+ /* start/end positions of the window address in the horizontal direction */
+ write_reg(0x44, 0xEF00);
+
+ /* start/end positions of the window address in the vertical direction */
+ /* write_reg(0x45, 0x0000); // Default value
+ write_reg(0x46, 0x013F); // Default value
+ */
+
+ /* Gamma Control */
+ write_reg(0x0030, 0x0707);
+ write_reg(0x0031, 0x0204);
+ write_reg(0x0032, 0x0204);
+ write_reg(0x0033, 0x0502);
+ write_reg(0x0034, 0x0507);
+ write_reg(0x0035, 0x0204);
+ write_reg(0x0036, 0x0204);
+ write_reg(0x0037, 0x0502);
+ write_reg(0x003A, 0x0302);
+ write_reg(0x003B, 0x0302);
+
+ /* RAM write data mask (unused)
+ write_reg(0x23, 0x0000); // Default value
+ write_reg(0x24, 0x0000); // Default value
+ */
+
+ /* Setting R28h as 0x0006 is required before setting R25h and R29h registers.*/
+
+ write_reg(0x28, 0x0006);
+
+ /* Frame Frequency Control (R25h)
+ OSC3 OSC2 OSC1 OSC0 - - - - - - - - - - - -
+ 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
+ OSC[3:0]: 1110 Corresponding frame freq: 80Hz
+ */
+ write_reg(0x25, 0xE000); /* (Default value = 8000h) */
+}
+
+/**************************************************************************************
+ * Name: lcd_backlight
+ *
+ * Description:
+ * The LCD backlight is driven from PB.5 which must be configured as TIM3
+ * CH2. TIM3 must then be configured to pwm output on PB.5; the duty
+ * of the clock determines the backlight level.
+ *
+ **************************************************************************************/
+
+#ifdef CONFIG_LCD_BACKLIGHT
+
+#ifndef CONFIG_STM32_TIM3_PARTIAL_REMAP
+# error CONFIG_STM32_TIM3_PARTIAL_REMAP must be set (to have TIM3 CH2 on pin B.5)
+#endif
+
+static void lcd_backlight(void)
+{
+ uint16_t ccmr;
+ uint16_t ccer;
+ uint16_t cr2;
+
+ /* Configure PB5 as TIM3 CH2 output */
+ stm32_configgpio(GPIO_TIM3_CH2OUT);
+
+ /* Enabled timer 3 clocking */
+ modifyreg32(STM32_RCC_APB1ENR, 0, RCC_APB1ENR_TIM3EN);
+
+ /* Reset timer 3 */
+
+ modifyreg32(STM32_RCC_APB1RSTR, 0, RCC_APB1RSTR_TIM3RST);
+ modifyreg32(STM32_RCC_APB1RSTR, RCC_APB1RSTR_TIM3RST, 0);
+
+ /* Reset the Counter Mode and set the clock division */
+ putreg16(0, STM32_TIM3_CR1);
+
+ /* Set the Autoreload value */
+ putreg16(LCD_BL_TIMER_PERIOD, STM32_TIM3_ARR);
+
+ /* Set the Prescaler value */
+
+ putreg16(0, STM32_TIM3_PSC);
+
+ /* Generate an update event to reload the Prescaler value immediatly */
+
+ putreg16(ATIM_EGR_UG, STM32_TIM3_EGR);
+
+ /* Disable the Channel 2 */
+
+ ccer = getreg16(STM32_TIM3_CCER);
+ ccer &= ~ATIM_CCER_CC2E;
+ putreg16(ccer, STM32_TIM3_CCER);
+
+ /* Get the TIM3 CR2 register value */
+ cr2 = getreg16(STM32_TIM3_CR2);
+
+ /* Select the Output Compare Mode Bits */
+
+ ccmr = getreg16(STM32_TIM3_CCMR1);
+ ccmr &= ATIM_CCMR1_OC2M_MASK;
+ ccmr |= (ATIM_CCMR_MODE_PWM1 << ATIM_CCMR1_OC2M_SHIFT);
+
+ /* Set the capture compare register value (50% duty) */
+ // FIXME should be set to 0 (appl needs to call setpower to change it)
+ g_lcddev.power = (CONFIG_LCD_MAXPOWER + 1) / 2;
+ putreg16((LCD_BL_TIMER_PERIOD + 1) / 2, STM32_TIM3_CCR2);
+
+ /* Select the output polarity level == HIGH */
+ ccer &= !ATIM_CCER_CC2P;
+
+ /* Enable channel 2*/
+ ccer |= ATIM_CCER_CC2E;
+
+ /* Write the timer configuration */
+
+ putreg16(ccmr, STM32_TIM3_CCMR1);
+ putreg16(ccer, STM32_TIM3_CCER);
+
+ /* Set the auto preload enable bit */
+
+ modifyreg16(STM32_TIM3_CR1, 0, ATIM_CR1_ARPE);
+
+ /* Enable Backlight Timer !!!!*/
+ modifyreg16(STM32_TIM3_CR1, 0, ATIM_CR1_CEN);
+
+ /* Dump timer3 registers */
+ lcddbg("APB1ENR: %08x\n", getreg32(STM32_RCC_APB1ENR));
+ lcddbg("CR1: %04x\n", getreg32(STM32_TIM3_CR1));
+ lcddbg("CR2: %04x\n", getreg32(STM32_TIM3_CR2));
+ lcddbg("SMCR: %04x\n", getreg32(STM32_TIM3_SMCR));
+ lcddbg("DIER: %04x\n", getreg32(STM32_TIM3_DIER));
+ lcddbg("SR: %04x\n", getreg32(STM32_TIM3_SR));
+ lcddbg("EGR: %04x\n", getreg32(STM32_TIM3_EGR));
+ lcddbg("CCMR1: %04x\n", getreg32(STM32_TIM3_CCMR1));
+ lcddbg("CCMR2: %04x\n", getreg32(STM32_TIM3_CCMR2));
+ lcddbg("CCER: %04x\n", getreg32(STM32_TIM3_CCER));
+ lcddbg("CNT: %04x\n", getreg32(STM32_TIM3_CNT));
+ lcddbg("PSC: %04x\n", getreg32(STM32_TIM3_PSC));
+ lcddbg("ARR: %04x\n", getreg32(STM32_TIM3_ARR));
+ lcddbg("CCR1: %04x\n", getreg32(STM32_TIM3_CCR1));
+ lcddbg("CCR2: %04x\n", getreg32(STM32_TIM3_CCR2));
+ lcddbg("CCR3: %04x\n", getreg32(STM32_TIM3_CCR3));
+ lcddbg("CCR4: %04x\n", getreg32(STM32_TIM3_CCR4));
+ lcddbg("CCR4: %04x\n", getreg32(STM32_TIM3_CCR4));
+ lcddbg("CCR4: %04x\n", getreg32(STM32_TIM3_CCR4));
+ lcddbg("DMAR: %04x\n", getreg32(STM32_TIM3_DMAR));
+}
+#endif
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ unsigned short id;
+
+ gvdbg("Initializing\n");
+
+ /* Configure GPIO pins and configure the FSMC to support the LCD */
+ stm32_selectlcd();
+
+ /* Delay required here */
+
+ up_mdelay(50);
+
+ /* Check model id */
+
+ id=read_reg(0x0);
+ if (id != SSD1289_ID) {
+ /* Not a SSD1289 ? */
+ gdbg("up_lcdinitialize: LCD ctrl is not a SSD1289");
+ return ERROR;
+ }
+
+ /* Configure and enable LCD */
+
+ lcd_initialize();
+
+ /* Clear the display (setting it to the color 0=black) */
+
+ lcd_clear(0);
+
+ /* Configure the backlight */
+
+ lcd_backlight();
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return &g_lcddev.dev;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Un-initialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ lcd_setpower(&g_lcddev.dev, 0);
+ stm32_deselectlcd();
+}
+
+/**************************************************************************************
+ * Name: lcd_clear
+ *
+ * Description:
+ * Fill the LCD ctrl memory with given color
+ *
+ **************************************************************************************/
+
+void lcd_clear(uint16_t color)
+{
+ uint32_t index;
+ lcd_setcursor(0, 0);
+ lcd_gramselect(); /* Prepare to write GRAM */
+ for (index = 0; index < LCD_XRES * LCD_YRES; index++)
+ {
+ write_data(color);
+ }
+}
diff --git a/nuttx/configs/hymini-stm32v/src/ssd1289.h b/nuttx/configs/hymini-stm32v/src/ssd1289.h
new file mode 100644
index 000000000..6f81361fe
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/ssd1289.h
@@ -0,0 +1,55 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/ssd1289.h
+ * arch/arm/src/board/ssd1289.h
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef SSD1289_H_
+#define SSD1289_H_
+
+#include <nuttx/lcd/lcd.h>
+
+/* LCD IDs */
+#define SSD1289_ID 0x8989
+
+struct ssd1289_dev_s
+{
+ /* Publicly visible device structure */
+ struct lcd_dev_s dev;
+
+ /* Private LCD-specific information follows */
+ uint8_t power; /* Current power setting */
+};
+
+#endif /* SSD1289_H_ */
diff --git a/nuttx/configs/hymini-stm32v/src/up_boot.c b/nuttx/configs/hymini-stm32v/src/up_boot.c
new file mode 100644
index 000000000..4b48e0b57
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_boot.c
@@ -0,0 +1,103 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/spi.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "hymini_stm32v-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the initialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/hymini-stm32v/src/up_buttons.c b/nuttx/configs/hymini-stm32v/src/up_buttons.c
new file mode 100644
index 000000000..c3ea0b821
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_buttons.c
@@ -0,0 +1,159 @@
+/****************************************************************************
+ * configs/hymini-stm32v/src/up_buttons.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "hymini_stm32v-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pin configuration for each HY-mini button. This array is indexed by
+ * the BUTTON_* definitions in board.h
+ */
+
+//static const uint16_t g_buttons[NUM_BUTTONS] =
+// {
+// GPIO_BTN_KEYA, GPIO_BTN_KEYB
+// };
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+ {
+ stm32_configgpio(GPIO_BTN_KEYA);
+ stm32_configgpio(GPIO_BTN_KEYB);
+ }
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+ {
+ uint8_t ret = 0;
+ bool pinValue;
+
+ /* Check that state of each key */
+
+ /* Pin is pulled up */
+ pinValue = stm32_gpioread(GPIO_BTN_KEYA);
+ if (!pinValue)
+ {
+ // Button pressed
+ ret = 1 << BUTTON_KEYA;
+ }
+
+ /* Pin is pulled down */
+ pinValue = stm32_gpioread(GPIO_BTN_KEYB);
+ if (pinValue)
+ {
+ // Button pressed
+ ret |= 1 << BUTTON_KEYB;
+ }
+ return ret;
+ }
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+ {
+ xcpt_t oldhandler = NULL;
+ uint32_t pinset = GPIO_BTN_KEYA;
+
+ if (id == 1)
+ {
+ pinset = GPIO_BTN_KEYB;
+ }
+ if (id < 2)
+ {
+ oldhandler = stm32_gpiosetevent(pinset, true, true, true, irqhandler);
+ }
+ return oldhandler;
+ }
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/hymini-stm32v/src/up_leds.c b/nuttx/configs/hymini-stm32v/src/up_leds.c
new file mode 100644
index 000000000..3cd0d44bd
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_leds.c
@@ -0,0 +1,241 @@
+/****************************************************************************
+ * configs/hymini-stm32v/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "hymini_stm32v-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define HYMINI_STM32_LED1 (1 << 0)
+#define HYMINI_STM32_LED2 (1 << 1)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+/* On: !LED1 + !LED2 Off: - */
+#define LED_STARTED_ON_SETBITS ((0) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((HYMINI_STM32_LED1|HYMINI_STM32_LED2) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS (0 << OFF_CLRBITS_SHIFT)
+
+/* On: LED1+!LED2 Off: N/A */
+#define LED_HEAPALLOCATE_ON_SETBITS ((HYMINI_STM32_LED1) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((HYMINI_STM32_LED2) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS (0)
+#define LED_HEAPALLOCATE_OFF_CLRBITS (0)
+
+/* On: LED2+!LED1 Off: N/A */
+#define LED_IRQSENABLED_ON_SETBITS ((HYMINI_STM32_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((HYMINI_STM32_LED1) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS (0)
+#define LED_IRQSENABLED_OFF_CLRBITS (0)
+
+/* On: LED1+!LED2 Off: N/A */
+#define LED_STACKCREATED_ON_SETBITS ((HYMINI_STM32_LED1) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((HYMINI_STM32_LED2) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS (0)
+#define LED_STACKCREATED_OFF_CLRBITS (0)
+
+/* On: !LED1 Off: LED1 */
+#define LED_INIRQ_ON_SETBITS ((0) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((HYMINI_STM32_LED1) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((HYMINI_STM32_LED1) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((0) << OFF_CLRBITS_SHIFT)
+
+/* On: LED2 Off: !LED2 */
+#define LED_SIGNAL_ON_SETBITS ((HYMINI_STM32_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((HYMINI_STM32_LED2) << OFF_CLRBITS_SHIFT)
+
+/* On: LED1+LED2 Off: - */
+#define LED_ASSERTION_ON_SETBITS ((HYMINI_STM32_LED2|HYMINI_STM32_LED2) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((0) << OFF_CLRBITS_SHIFT)
+
+/* On: LED1 Off: LED2 */
+#define LED_PANIC_ON_SETBITS ((HYMINI_STM32_LED1) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((HYMINI_STM32_LED2) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((HYMINI_STM32_LED2) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((HYMINI_STM32_LED1) << OFF_CLRBITS_SHIFT)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS | LED_STARTED_OFF_SETBITS
+ | LED_STARTED_OFF_CLRBITS),
+
+(LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS
+ | LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+(LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS
+ | LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+(LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS
+ | LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+(LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS | LED_INIRQ_OFF_SETBITS
+ | LED_INIRQ_OFF_CLRBITS),
+
+(LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS | LED_SIGNAL_OFF_SETBITS
+ | LED_SIGNAL_OFF_CLRBITS),
+
+(LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS | LED_ASSERTION_OFF_SETBITS
+ | LED_ASSERTION_OFF_CLRBITS),
+
+(LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS | LED_PANIC_OFF_SETBITS
+ | LED_PANIC_OFF_CLRBITS) };
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & HYMINI_STM32_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & HYMINI_STM32_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+}
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & HYMINI_STM32_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & HYMINI_STM32_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+}
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Configure LED1 & LED2 GPIOs for output */
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/hymini-stm32v/src/up_nsh.c b/nuttx/configs/hymini-stm32v/src/up_nsh.c
new file mode 100644
index 000000000..ae1ea03a6
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_nsh.c
@@ -0,0 +1,182 @@
+/****************************************************************************
+ * config/hymini-stm32v/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_STM32_SPI1
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+#endif
+
+#ifdef CONFIG_STM32_SDIO
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "stm32_internal.h"
+#include "hymini_stm32v-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* For now, don't build in any SPI1 support -- NSH is not using it */
+
+#undef CONFIG_STM32_SPI1
+
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_HYMINI_STM32V
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new STM32 boards here */
+# error "Unrecognized STM32 board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* Card detect */
+ bool cd_status;
+#endif
+
+ /* Mount the SDIO-based MMC/SD block driver */
+
+#ifdef NSH_HAVEMMCSD
+ /* First, get an instance of the SDIO interface */
+
+ message("nsh_archinitialize: Initializing SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Use SD card detect pin to check if a card is inserted */
+
+ cd_status = !stm32_gpioread(GPIO_SD_CD);
+ message("Card detect : %hhu", cd_status);
+
+ sdio_mediachange(sdio, cd_status);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/hymini-stm32v/src/up_spi.c b/nuttx/configs/hymini-stm32v/src/up_spi.c
new file mode 100644
index 000000000..631c70ce9
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_spi.c
@@ -0,0 +1,179 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "hymini_stm32v-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#define SPI_DEBUG /* Define to enable debug */
+#define SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the HY-MiniSTM32 board.
+ *
+ ************************************************************************************/
+
+void stm32_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI1 and/or SPI2 was already provided in stm32_rcc.c.
+ * Configurations of SPI pins is performed in stm32_spi.c.
+ * Here, we only initialize chip select pins unique to the board
+ * architecture.
+ */
+
+#ifdef CONFIG_STM32_SPI1
+ /* Configure the SPI-based touch screen CS GPIO */
+ spivdbg("Configure GPIO for SPI1/CS\n");
+ stm32_configgpio(GPIO_TS_CS);
+#endif
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ if (devid == SPIDEV_TOUCHSCREEN)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_TS_CS, !selected);
+ }
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/hymini-stm32v/src/up_ts.c b/nuttx/configs/hymini-stm32v/src/up_ts.c
new file mode 100644
index 000000000..e5a779605
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_ts.c
@@ -0,0 +1,180 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/up_ts.c
+ * arch/arm/src/board/up_ts.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/spi.h>
+#include <nuttx/arch.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include "stm32.h"
+#include "stm32_internal.h"
+#include "hymini_stm32v-internal.h"
+
+#include <nuttx/input/touchscreen.h>
+#include <nuttx/input/ads7843e.h>
+
+#if !defined(CONFIG_STM32_SPI1)
+# error CONFIG_STM32_SPI1 must be defined to use the ADS7843 on this board
+#endif
+
+static int hymini_ts_irq_attach(FAR struct ads7843e_config_s *state, xcpt_t isr);
+static void hymini_ts_irq_enable(FAR struct ads7843e_config_s *state,
+ bool enable);
+static void hymini_ts_irq_clear(FAR struct ads7843e_config_s *state);
+static bool hymini_ts_busy(FAR struct ads7843e_config_s *state);
+static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state);
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+static FAR struct ads7843e_config_s ts_cfg =
+{
+ .frequency = CONFIG_ADS7843E_FREQUENCY,
+
+ .attach = hymini_ts_irq_attach,
+ .enable=hymini_ts_irq_enable,
+ .clear=hymini_ts_irq_clear,
+ .busy = hymini_ts_busy,
+ .pendown=hymini_ts_pendown
+};
+
+static xcpt_t tc_isr;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/* Attach the ADS7843E interrupt handler to the GPIO interrupt */
+static int hymini_ts_irq_attach(FAR struct ads7843e_config_s *state, xcpt_t isr)
+{
+ ivdbg("hymini_ts_irq_attach\n");
+
+ tc_isr = isr;
+ stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, isr);
+ return OK;
+}
+
+/* Enable or disable the GPIO interrupt */
+static void hymini_ts_irq_enable(FAR struct ads7843e_config_s *state,
+ bool enable)
+{
+ illvdbg("%d\n", enable);
+
+ stm32_gpiosetevent(GPIO_TS_IRQ, true, true, true, enable? tc_isr:NULL);
+}
+
+/* Acknowledge/clear any pending GPIO interrupt */
+static void hymini_ts_irq_clear(FAR struct ads7843e_config_s *state)
+{
+ // FIXME Nothing to do ?
+}
+
+/* As the busy line is not connected, we just wait a little bit here */
+static bool hymini_ts_busy(FAR struct ads7843e_config_s *state)
+{
+ up_mdelay(50);
+ return false;
+}
+
+/* Return the state of the pen down GPIO input */
+static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state)
+{
+ bool pin_value = stm32_gpioread(GPIO_TS_IRQ);
+ return !pin_value;
+}
+
+/****************************************************************************
+ * Name: arch_tcinitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * configure the touchscreen device. This function will register the driver
+ * as /dev/inputN where N is the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int arch_tcinitialize(int minor)
+{
+ FAR struct spi_dev_s *dev;
+
+ idbg("minor %d\n", minor);
+
+ dev = up_spiinitialize(1);
+ if (!dev)
+ {
+ idbg("Failed to initialize SPI bus\n");
+ return -ENODEV;
+ }
+
+ /* Configure the PIO interrupt */
+
+ stm32_configgpio(GPIO_TS_IRQ);
+
+ return ads7843e_register(dev, &ts_cfg, minor);
+}
+
+/****************************************************************************
+ * Name: arch_tcuninitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * uninitialize the touchscreen device.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None.
+ *
+ ****************************************************************************/
+
+void arch_tcuninitialize(void)
+{
+ /* FIXME What can/should we do here ? */
+}
diff --git a/nuttx/configs/hymini-stm32v/src/up_usbdev.c b/nuttx/configs/hymini-stm32v/src/up_usbdev.c
new file mode 100644
index 000000000..061ed9234
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_usbdev.c
@@ -0,0 +1,117 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "hymini_stm32v-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the Hy-Mini STM32v board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ ulldbg("called\n");
+
+ /* USB Soft Connect Pullup */
+ stm32_configgpio(GPIO_USB_PULLUP);
+}
+
+/************************************************************************************
+ * Name: stm32_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide stm32_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+ stm32_gpiowrite(GPIO_USB_PULLUP, !enable);
+ return OK;
+}
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+
diff --git a/nuttx/configs/hymini-stm32v/src/up_usbmsc.c b/nuttx/configs/hymini-stm32v/src/up_usbmsc.c
new file mode 100644
index 000000000..1ce55adcc
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_usbmsc.c
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * configs/hymini-stm32v/src/up_usbmsc.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "stm32_internal.h"
+
+/* There is nothing to do here if SDIO support is not selected. */
+
+#ifdef CONFIG_STM32_SDIO
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_HYMINI_STM32V
+# undef STM32_MMCSDSLOTNO
+# define STM32_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new STM32 boards here */
+# error "Unrecognized STM32 board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initialized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("usbmsc_archinitialize: "
+ "Initializing SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+
+ sdio = sdio_initialize(STM32_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ message("usbmsc_archinitialize: "
+ "Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_EXAMPLES_USBMSC_DEVMINOR1);
+
+ ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, sdio);
+ if (ret != OK)
+ {
+ message("usbmsc_archinitialize: "
+ "Failed to bind SDIO to the MMC/SD driver: %d\n",
+ ret);
+ return ret;
+ }
+ message("usbmsc_archinitialize: "
+ "Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the Hy-Mini STM32v board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+
+#endif /* CONFIG_EXAMPLES_USBMSC_BUILTIN */
+
+ return OK;
+}
+
+#endif /* CONFIG_STM32_SDIO */
diff --git a/nuttx/configs/hymini-stm32v/src/up_watchdog.c b/nuttx/configs/hymini-stm32v/src/up_watchdog.c
new file mode 100644
index 000000000..638fae440
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/hymini-stm32v/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/hymini-stm32v/usbserial/Make.defs b/nuttx/configs/hymini-stm32v/usbserial/Make.defs
new file mode 100644
index 000000000..2109c48d8
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbserial/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/hymini-stm32v/usbserial/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/usbserial/appconfig b/nuttx/configs/hymini-stm32v/usbserial/appconfig
new file mode 100644
index 000000000..14802f340
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbserial/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/hymini-stm32v/usbserial/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbserial
+
diff --git a/nuttx/configs/hymini-stm32v/usbserial/defconfig b/nuttx/configs/hymini-stm32v/usbserial/defconfig
new file mode 100755
index 000000000..15f0695cf
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbserial/defconfig
@@ -0,0 +1,498 @@
+############################################################################
+# configs/hymini-stm32v/usbserial/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103V specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="usbserial_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=23
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration (Prolific PL2303 Emulation)
+#
+CONFIG_PL2303=y
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=n
+CONFIG_EXAMPLES_USBTERM_BUFLEN=256
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/usbserial/ld.script b/nuttx/configs/hymini-stm32v/usbserial/ld.script
new file mode 100755
index 000000000..8a8361614
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbserial/ld.script
@@ -0,0 +1,113 @@
+/****************************************************************************
+ * configs/hymini-stm32v/usbserial/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Laurent Latil <laurent@latil.nom.fr>
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103VCT6 has 256Kb of FLASH beginning at address 0x0800:0000 and
+ * 48Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/usbserial/ld.script.dfu b/nuttx/configs/hymini-stm32v/usbserial/ld.script.dfu
new file mode 100755
index 000000000..5734ed267
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbserial/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/usbserial/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/usbserial/setenv.sh b/nuttx/configs/hymini-stm32v/usbserial/setenv.sh
new file mode 100755
index 000000000..6b324148d
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbserial/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/hymini-stm32v/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/hymini-stm32v/usbstorage/Make.defs b/nuttx/configs/hymini-stm32v/usbstorage/Make.defs
new file mode 100644
index 000000000..91a677d47
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbstorage/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/hymini-stm32v/usbstorage/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/hymini-stm32v/usbstorage/appconfig b/nuttx/configs/hymini-stm32v/usbstorage/appconfig
new file mode 100644
index 000000000..3e171d83a
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/hymini-stm32v/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/hymini-stm32v/usbstorage/defconfig b/nuttx/configs/hymini-stm32v/usbstorage/defconfig
new file mode 100755
index 000000000..8e5cc1b53
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbstorage/defconfig
@@ -0,0 +1,488 @@
+############################################################################
+# configs/hymini-stm32v/usbstorage/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103VCT6=y
+CONFIG_ARCH_BOARD="hymini-stm32v"
+CONFIG_ARCH_BOARD_HYMINI_STM32V=y
+
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=49152
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+CONFIG_STM32_DFU=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103V specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=30
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/hymini-stm32v/usbstorage/ld.script b/nuttx/configs/hymini-stm32v/usbstorage/ld.script
new file mode 100755
index 000000000..7e92fec83
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbstorage/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/hymini-stm32v/usbstorage/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/usbstorage/ld.script.dfu b/nuttx/configs/hymini-stm32v/usbstorage/ld.script.dfu
new file mode 100755
index 000000000..7bb2997c2
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbstorage/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/hymini-stm32v/usbstorage/ld.script.dfu
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * Hy-Mini STM32v's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103VCT6 has 48Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/hymini-stm32v/usbstorage/setenv.sh b/nuttx/configs/hymini-stm32v/usbstorage/setenv.sh
new file mode 100755
index 000000000..a0371cdce
--- /dev/null
+++ b/nuttx/configs/hymini-stm32v/usbstorage/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/hymini-stm32v/dfu/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/kwikstik-k40/Kconfig b/nuttx/configs/kwikstik-k40/Kconfig
new file mode 100644
index 000000000..5172da5e7
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_KWIKSTIK_K40
+endif
diff --git a/nuttx/configs/kwikstik-k40/README.txt b/nuttx/configs/kwikstik-k40/README.txt
new file mode 100644
index 000000000..ea6d9dee6
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/README.txt
@@ -0,0 +1,478 @@
+README.txt
+==========
+
+This is the README file for the port of NuttX to the Freescale Kinetis
+KwiStick K40. Refer to the Freescale web site for further information
+about this part:
+http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KWIKSTIK-K40
+
+The Kwikstik is used with the FreeScale Tower System (mostly just to
+provide a simple UART connection)
+
+Contents
+========
+
+ o Kinetis KwikStik-K40 Features
+ o Kinetis KwikStik-K60 Pin Configuration
+ - On-Board Connections
+ - Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ - Connections via the Tower Primary Connector Side A
+ - Connections via the Tower Primary Connector Side B
+ - TWR-SER Serial Board Connection
+ o Development Environment
+ o GNU Toolchain Options
+ o IDEs
+ o NuttX buildroot Toolchain
+
+Kinetis KwikStik-K40 Features:
+==============================
+
+ o Kinetis K40 MCU in 144 LQFP
+ - 100 MHz ARM Cortex-M4 core
+ - 256Kb program flash, 256Kb FlexMemory
+ - Full-speed USB 2.0 device
+ - Low-pwer segment LCD controller
+ - SPI, UART, CAN and more
+ o Large segment LCD display with 306 segments
+ o 2.3mm audio output and 2 micro USB connectors
+ o Omnidirectional microphone and a buzzer
+ o On-board Segger J-Link debugger interface
+ o Infrared communication port
+ o microSD card slot
+ o Capacitive touch sensing interface
+ o Freescale Tower System connectivity for UART, timers, CAN, SPI, I2C, and DAC
+ o Freescale Tower plug-in (TWRPI) socket connectivity for ADC, SPI, I2C, and GPIO
+
+Kinetis KwikStik-K40 Pin Configuration
+======================================
+
+On-Board Connections
+------------------- -------------------------- -------- -------------------
+FEATURE CONNECTION PORT/PIN PIN FUNCTION
+------------------- -------------------------- -------- -------------------
+Audio Jack Output Audio Amp On PTE28 PTE28
+ Audio Output DAC1_OUT DAC1_OUT
+ Volume Up PTD10 PTD10
+ Volume Down PTD11 PTD11
+Buzzer Audio Out PTA8 FTM1_CH0
+Microphone Microphone input PTA7 ADC0_SE10
+SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ SD Command PTE3 SDHC0_CMD
+ SD Data0 PTD12 SDHC0_D4
+ SD Data1 PTD13 SDHC0_D5
+ SD Data2 PTD14 SDHC0_D6
+ SD Data3 PTD15 SDHC0_D7
+ SD Card Detect PTE27 PTE27
+ SD Card On PTE6 PTE6
+Infrared Port IR Transmit PTE4 IR_TX
+ IR Receive PTA13 CMP2_IN0
+Touch Pads E1 / Touch PTB0 TSI0_CH0
+ E2 / Touch PTA4 TSI0_CH5
+ E3 / Touch PTA24 PTA24
+ E4 / Touch PTA25 PTA25
+ E5 / Touch PTA26 PTA26
+ E6 / Touch PTA27 PTA27
+
+Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+------------------- -------------------------- -------- -------------------
+FEATURE CONNECTION PORT/PIN PIN FUNCTION
+------------------- -------------------------- -------- -------------------
+General Purpose TWRPI AN0 (J8 Pin 8) ? ADC0_DP0/ADC1_DP3
+TWRPI Socket TWRPI AN1 (J8 Pin 9) ? ADC0_DM0/ADC1_DM3
+ TWRPI AN2 (J8 Pin 12) ? ADC1_DP0/ADC0_DP3
+ TWRPI ID0 (J8 Pin 17) ? ADC0_DP1
+ TWRPI ID1 (J8 Pin 18) ? ADC0_DM1
+ TWRPI I2C SCL (J9 Pin 3) PTC10 I2C1_SCL
+ TWRPI I2C SDA (J9 Pin 4) PTC11 I2C1_SDA
+ TWRPI SPI MISO (J9 Pin 9) PTB23 SPI2_SIN
+ TWRPI SPI MOSI (J9 Pin 10) PTB22 SPI2_SOUT
+ TWRPI SPI SS (J9 Pin 11) PTB20 SPI2_PCS0
+ TWRPI SPI CLK (J9 Pin 12) PTB21 SPI2_SCK
+ TWRPI GPIO0 (J9 Pin 15) PTC12 PTC12
+ TWRPI GPIO1 (J9 Pin 16) PTB9 PTB9
+ TWRPI GPIO2 (J9 Pin 17) PTB10 PTB10
+ TWRPI GPIO3 (J9 Pin 18) PTC5 PTC5
+ TWRPI GPIO4 (J9 Pin 19) PTA5 PTA5
+
+The KwikStik features an expansion card-edge connector that interfaces to the Primary Elevator board in a Tower system (Primary side).
+
+Connections via the Tower Primary Connector Side A
+--- -------------------- --------------------------------
+PIN NAME USAGE
+--- -------------------- --------------------------------
+A9 GPIO9 / CTS1 PTE10/UART_CTS
+A43 RXD1 PTE9/UART_RX
+A44 TXD1 PTE8/UART_TX
+A63 RSTOUT_b PTA9/FTM1_CH1
+
+Connections via the Tower Primary Connector Side B
+--- -------------------- --------------------------------
+PIN NAME USAGE
+--- -------------------- --------------------------------
+B21 GPIO1 / RTS1 PTE7/UART_RTS
+B37 PWM7 PTA8/FTM1_CH0
+B38 PWM6 PTA9/FTM1_CH1
+B41 CANRX0 PTE25/CAN1_RX
+B42 CANTX0 PTE24/CAN1_TX
+B44 SPI0_MISO PTA17/SPI0_SIN
+B45 SPI0_MOSI PTA16/SPI0_SOUT
+B46 SPI0_CS0_b PTA14/SPI0_PCS0
+B48 SPI0_CLK PTA15/SPI0_SCK
+B50 SCL1 PTE1/I2C1_SCL
+B51 SDA1 PTE0/I2C1_SDA
+B52 GPIO5 / SD_CARD_DET PTA16
+
+TWR-SER Serial Board Connection
+===============================
+
+The serial board connects into the tower and then maps to the tower pins to
+yet other functions (see TWR-SER.pdf).
+
+For the serial port, the following jumpers are required:
+
+ J15: 1-2 (default)
+ J17: 1-2 (default)
+ J18: 1-2 (default)
+ J19: 1-2 (default)
+
+The two connections map as follows:
+
+ A41 RXD0 - Not connected
+ A42 TXD0 - Not connected
+ A43 RXD1 - ELE_RXD (connects indirectory to DB-9 connector J8)
+ A44 TXD1 - ELE_TXD (connects indirectory to DB-9 connector J8)
+
+Finally, we can conclude that
+
+ UART5 (PTE8/9) is associated with the DB9 connector
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+=====================
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the CodeSourcery Windows toolchain. To
+ use the devkitARM or the NuttX GNU toolchain, you simply need to change the
+ the following configuration options to your .config (or defconfig) file:
+
+ CONFIG_KINETIS_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_KINETIS_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_KINETIS_DEVKITARM=y : devkitARM under Windows
+ CONFIG_KINETIS_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_KINETIS_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/k40,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/kinetis/k40_vectors.S.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M4 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M4 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ NOTE: The NuttX toolchain is an OABI toolchain (vs. the more common EABI)
+ and does not include optimizations for Cortex-M4 (ARMv7E-M).
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh kwikstik-k40/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M4 toolchain for Cygwin under Windows.
+
+KwikStik-K40-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This sould
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM4=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=k40
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_MK40X256VLQ100
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=kwikstik-k40 (for the KwikStik-K40 development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_KWIKSTIK_K40=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The Kinetis K40 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_KINETIS_TRACE -- Enable trace clocking on power up.
+ CONFIG_KINETIS_FLEXBUS -- Enable flexbus clocking on power up.
+ CONFIG_KINETIS_UART0 -- Support UART0
+ CONFIG_KINETIS_UART1 -- Support UART1
+ CONFIG_KINETIS_UART2 -- Support UART2
+ CONFIG_KINETIS_UART3 -- Support UART3
+ CONFIG_KINETIS_UART4 -- Support UART4
+ CONFIG_KINETIS_UART5 -- Support UART5
+ CONFIG_KINETIS_ENET -- Support Ethernet (K60 only)
+ CONFIG_KINETIS_RNGB -- Support the random number generator(K60 only)
+ CONFIG_KINETIS_FLEXCAN0 -- Support FlexCAN0
+ CONFIG_KINETIS_FLEXCAN1 -- Support FlexCAN1
+ CONFIG_KINETIS_SPI0 -- Support SPI0
+ CONFIG_KINETIS_SPI1 -- Support SPI1
+ CONFIG_KINETIS_SPI2 -- Support SPI2
+ CONFIG_KINETIS_I2C0 -- Support I2C0
+ CONFIG_KINETIS_I2C1 -- Support I2C1
+ CONFIG_KINETIS_I2S -- Support I2S
+ CONFIG_KINETIS_DAC0 -- Support DAC0
+ CONFIG_KINETIS_DAC1 -- Support DAC1
+ CONFIG_KINETIS_ADC0 -- Support ADC0
+ CONFIG_KINETIS_ADC1 -- Support ADC1
+ CONFIG_KINETIS_CMP -- Support CMP
+ CONFIG_KINETIS_VREF -- Support VREF
+ CONFIG_KINETIS_SDHC -- Support SD host controller
+ CONFIG_KINETIS_FTM0 -- Support FlexTimer 0
+ CONFIG_KINETIS_FTM1 -- Support FlexTimer 1
+ CONFIG_KINETIS_FTM2 -- Support FlexTimer 2
+ CONFIG_KINETIS_LPTIMER -- Support the low power timer
+ CONFIG_KINETIS_RTC -- Support RTC
+ CONFIG_KINETIS_SLCD -- Support the segment LCD (K40 only)
+ CONFIG_KINETIS_EWM -- Support the external watchdog
+ CONFIG_KINETIS_CMT -- Support Carrier Modulator Transmitter
+ CONFIG_KINETIS_USBOTG -- Support USB OTG (see also CONFIG_USBHOST and CONFIG_USBDEV)
+ CONFIG_KINETIS_USBDCD -- Support the USB Device Charger Detection module
+ CONFIG_KINETIS_LLWU -- Support the Low Leakage Wake-Up Unit
+ CONFIG_KINETIS_TSI -- Support the touch screeen interface
+ CONFIG_KINETIS_FTFL -- Support FLASH
+ CONFIG_KINETIS_DMA -- Support DMA
+ CONFIG_KINETIS_CRC -- Support CRC
+ CONFIG_KINETIS_PDB -- Support the Programmable Delay Block
+ CONFIG_KINETIS_PIT -- Support Programmable Interval Timers
+ CONFIG_ARMV7M_MPU -- Support the MPU
+
+ Kinetis interrupt priorities (Default is the mid priority)
+
+ CONFIG_KINETIS_UART0PRIO
+ CONFIG_KINETIS_UART1PRIO
+ CONFIG_KINETIS_UART2PRIO
+ CONFIG_KINETIS_UART3PRIO
+ CONFIG_KINETIS_UART4PRIO
+ CONFIG_KINETIS_UART5PRIO
+
+ CONFIG_KINETIS_SDHC_PRIO
+
+ PIN Interrupt Support
+
+ CONFIG_GPIO_IRQ -- Enable pin interrtup support. Also needs
+ one or more of the following:
+ CONFIG_KINETIS_PORTAINTS -- Support 32 Port A interrupts
+ CONFIG_KINETIS_PORTBINTS -- Support 32 Port B interrupts
+ CONFIG_KINETIS_PORTCINTS -- Support 32 Port C interrupts
+ CONFIG_KINETIS_PORTDINTS -- Support 32 Port D interrupts
+ CONFIG_KINETIS_PORTEINTS -- Support 32 Port E interrupts
+
+ Kinetis K40 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn (n=0..5) for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART.
+ CONFIG_UARTn_BITS - The number of bits. Must be either 8 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+
+ KwikStik-K40 LCD Hardware Configuration
+
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. Default is this 320x240 "landscape" orientation
+ (this setting is informative only... not used).
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support. In this orientation, the KwikStik-K40's
+ LCD ribbon cable is at the bottom of the display. Default is
+ 320x240 "landscape" orientation.
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support. In this orientation, the
+ KwikStik-K40's LCD ribbon cable is at the top of the display.
+ Default is 320x240 "landscape" orientation.
+ CONFIG_LCD_BACKLIGHT - Define to support an adjustable backlight
+ using timer 1. The granularity of the settings is determined
+ by CONFIG_LCD_MAXPOWER. Requires CONFIG_KINETIS_TIM1.
+
+Configurations
+==============
+
+Each KwikStik-K40 configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh kwikstik-k40/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ CONFIG_KINETIS_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
diff --git a/nuttx/configs/kwikstik-k40/include/board.h b/nuttx/configs/kwikstik-k40/include/board.h
new file mode 100644
index 000000000..86434ca7c
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/include/board.h
@@ -0,0 +1,285 @@
+/************************************************************************************
+ * configs/kwikstik-k40/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* The Kwikstik-K40 has a 4MHz crystal on board */
+
+#undef BOARD_EXTCLOCK /* Crystal */
+#define BOARD_EXTAL_FREQ 4000000 /* 4MHz crystal frequency (REFCLK) */
+#define BOARD_XTAL32_FREQ 32768 /* 32KHz RTC Oscillator */
+
+/* PLL Configuration. NOTE: Only even frequency crystals are supported that will
+ * produce a 2MHz reference clock to the PLL.
+ *
+ * PLL Input frequency: PLLIN = REFCLK/PRDIV = 4MHz/2 = 2MHz
+ * PLL Output frequency: PLLOUT = PLLIN*VDIV = 2Mhz*48 = 96MHz
+ * MCG Frequency: PLLOUT = 96MHz
+ */
+
+#define BOARD_PRDIV 2 /* PLL External Reference Divider */
+#define BOARD_VDIV 48 /* PLL VCO Divider (frequency multiplier) */
+
+#define BOARD_PLLIN_FREQ (BOARD_EXTAL_FREQ / BOARD_PRDIV)
+#define BOARD_PLLOUT_FREQ (BOARD_PLLIN_FREQ * BOARD_VDIV)
+#define BOARD_MCG_FREQ BOARD_PLLOUT_FREQ
+
+/* SIM CLKDIV1 dividers */
+
+#define BOARD_OUTDIV1 1 /* Core = MCG, 96MHz */
+#define BOARD_OUTDIV2 2 /* Bus = MCG/2, 48MHz */
+#define BOARD_OUTDIV3 2 /* FlexBus = MCG/2, 48MHz */
+#define BOARD_OUTDIV4 4 /* Flash clock = MCG/4, 24MHz */
+
+#define BOARD_CORECLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV1)
+#define BOARD_BUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV2)
+#define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3)
+#define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4)
+
+/* SDHC clocking ********************************************************************/
+
+/* SDCLK configurations corresponding to various modes of operation. Formula is:
+ *
+ * SDCLK frequency = (base clock) / (prescaler * divisor)
+ *
+ * The SDHC module is always configure configured so that the core clock is the base
+ * clock.
+ */
+
+/* Identification mode: 400KHz = 96MHz / ( 16 * 15) */
+
+#define BOARD_SDHC_IDMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV16
+#define BOARD_SDHC_IDMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
+
+/* MMC normal mode: 16MHz = 96MHz / (2 * 3) */
+
+#define BOARD_SDHC_MMCMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+#define BOARD_SDHC_MMCMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
+
+/* SD normal mode (1-bit): 16MHz = 96MHz / (2 * 3) */
+
+#define BOARD_SDHC_SD1MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+#define BOARD_SDHC_SD1MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
+
+/* SD normal mode (4-bit): 24MHz = 96MHz / (2 * 2) (with DMA)
+ * SD normal mode (4-bit): 16MHz = 96MHz / (2 * 3) (no DMA)
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(2)
+#else
+//# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+//# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
+# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV16
+# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
+#endif
+
+/* LED definitions ******************************************************************/
+/* The KwikStik-K40 board has no MCU driven, GPIO-based LEDs */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Button definitions ***************************************************************/
+/* The KwikStik-K40 board has no standard GPIO contact buttons */
+
+/* Alternative pin resolution *******************************************************/
+/* If there are alternative configurations for various pins in the
+ * kinetis_k40pinmux.h header file, those alternative pins will be labeled with a
+ * suffix like _1, _2, etc. The logic in this file must select the correct pin
+ * configuration for the board by defining a pin configuration (with no suffix) that
+ * maps to the correct alternative.
+ */
+
+/* On-Board Connections
+ *
+ * ------------------- -------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * ------------------- -------------------------- -------- -------------------
+ * Audio Jack Output Audio Amp On PTE28 PTE28
+ * Audio Output DAC1_OUT DAC1_OUT
+ * Volume Up PTD10 PTD10
+ * Volume Down PTD11 PTD11
+ * Buzzer Audio Out PTA8 FTM1_CH0
+ * Microphone Microphone input PTA7 ADC0_SE10
+ * SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ * SD Command PTE3 SDHC0_CMD
+ * SD Data0 PTD12 SDHC0_D4
+ * SD Data1 PTD13 SDHC0_D5
+ * SD Data2 PTD14 SDHC0_D6
+ * SD Data3 PTD15 SDHC0_D7
+ * SD Card Detect PTE27 PTE27
+ * SD Card On PTE6 PTE6
+ * Infrared Port IR Transmit PTE4 IR_TX
+ * IR Receive PTA13 CMP2_IN0
+ * Touch Pads E1 / Touch PTB0 TSI0_CH0
+ * E2 / Touch PTA4 TSI0_CH5
+ * E3 / Touch PTA24 PTA24
+ * E4 / Touch PTA25 PTA25
+ * E5 / Touch PTA26 PTA26
+ * E6 / Touch PTA27 PTA27
+ */
+
+#define PIN_FTM1_CH0 PIN_FTM1_CH0_1
+
+/* Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ * ------------------- -------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * ------------------- -------------------------- -------- -------------------
+ * General Purpose TWRPI AN0 (J8 Pin 8) ? ADC0_DP0/ADC1_DP3
+ * TWRPI Socket TWRPI AN1 (J8 Pin 9) ? ADC0_DM0/ADC1_DM3
+ * TWRPI AN2 (J8 Pin 12) ? ADC1_DP0/ADC0_DP3
+ * TWRPI ID0 (J8 Pin 17) ? ADC0_DP1
+ * TWRPI ID1 (J8 Pin 18) ? ADC0_DM1
+ * TWRPI I2C SCL (J9 Pin 3) PTC10 I2C1_SCL
+ * TWRPI I2C SDA (J9 Pin 4) PTC11 I2C1_SDA
+ * TWRPI SPI MISO (J9 Pin 9) PTB23 SPI2_SIN
+ * TWRPI SPI MOSI (J9 Pin 10) PTB22 SPI2_SOUT
+ * TWRPI SPI SS (J9 Pin 11) PTB20 SPI2_PCS0
+ * TWRPI SPI CLK (J9 Pin 12) PTB21 SPI2_SCK
+ * TWRPI GPIO0 (J9 Pin 15) PTC12 PTC12
+ * TWRPI GPIO1 (J9 Pin 16) PTB9 PTB9
+ * TWRPI GPIO2 (J9 Pin 17) PTB10 PTB10
+ * TWRPI GPIO3 (J9 Pin 18) PTC5 PTC5
+ * TWRPI GPIO4 (J9 Pin 19) PTA5 PTA5
+ */
+
+#define PIN_I2C1_SCL PIN_I2C1_SCL_1
+#define PIN_I2C1_SDA PIN_I2C1_SDA_1
+#define PIN_SPI2_SIN PIN_SPI2_SIN_1
+#define PIN_SPI2_SOUT PIN_SPI2_SOUT_1
+#define PIN_SPI2_PCS0 PIN_SPI2_PCS0_1
+#define PIN_SPI2_SCK PIN_SPI2_SCK_1
+
+/* Connections via the Tower Primary Connector Side A
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * A9 GPIO9 / CTS1 PTE10/UART_CTS
+ * A43 RXD1 PTE9/UART_RX
+ * A44 TXD1 PTE8/UART_TX
+ * A63 RSTOUT_b PTA9/FTM1_CH1
+ */
+
+#define PIN_UART5_CTS PIN_UART5_CTS_2
+#define PIN_FTM1_CH1 PIN_FTM1_CH1_1
+
+/* Connections via the Tower Primary Connector Side B
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * B21 GPIO1 / RTS1 PTE7/UART_RTS
+ * B37 PWM7 PTA8/FTM1_CH0
+ * B38 PWM6 PTA9/FTM1_CH1
+ * B41 CANRX0 PTE25/CAN1_RX
+ * B42 CANTX0 PTE24/CAN1_TX
+ * B44 SPI0_MISO PTA17/SPI0_SIN
+ * B45 SPI0_MOSI PTA16/SPI0_SOUT
+ * B46 SPI0_CS0_b PTA14/SPI0_PCS0
+ * B48 SPI0_CLK PTA15/SPI0_SCK
+ * B50 SCL1 PTE1/I2C1_SCL
+ * B51 SDA1 PTE0/I2C1_SDA
+ * B52 GPIO5 / SD_CARD_DET PTA16
+ */
+
+#define PIN_UART3_RTS PIN_UART3_RTS_3
+#define PIN_CAN1_RX PIN_CAN1_RX_2
+#define PIN_CAN1_TX PIN_CAN1_TX_2
+#define PIN_SPI0_SIN PIN_SPI0_SIN_1
+#define PIN_SPI0_SOUT PIN_SPI0_SOUT_1
+#define PIN_SPI0_SCK PIN_SPI0_SCK_1
+#define PIN_SPI0_PCS0 PIN_SPI0_PCS0_1
+#define PIN_I2C1_SCL PIN_I2C1_SCL_2
+#define PIN_I2C1_SDA PIN_I2C1_SDA_2
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_boardinitialize(void);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/kwikstik-k40/ostest/Make.defs b/nuttx/configs/kwikstik-k40/ostest/Make.defs
new file mode 100644
index 000000000..f78ea44fd
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/kwikstik-k40/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_KINETIS_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+endif
+ifeq ($(CONFIG_KINETIS_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_KINETIS_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+endif
+ifeq ($(CONFIG_KINETIS_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft -mlong-calls
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/kwikstik-k40/ostest/appconfig b/nuttx/configs/kwikstik-k40/ostest/appconfig
new file mode 100644
index 000000000..9fa43afb8
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/kwikstik-k40/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/kwikstik-k40/ostest/defconfig b/nuttx/configs/kwikstik-k40/ostest/defconfig
new file mode 100755
index 000000000..4d9047339
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/ostest/defconfig
@@ -0,0 +1,463 @@
+############################################################################
+# configs/kwikstik-k40/ostest/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="kinetis"
+CONFIG_ARCH_CHIP_MK40X256VLQ100=y
+CONFIG_ARCH_BOARD="kwikstik-k40"
+CONFIG_ARCH_BOARD_KWIKSTIK_K40=y
+CONFIG_BOARD_LOOPSPERMSEC=9535
+CONFIG_DRAM_START=0x1fff8000
+CONFIG_DRAM_SIZE= 0x00010000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_KINETIS_CODESOURCERYW=n
+CONFIG_KINETIS_CODESOURCERYL=n
+CONFIG_KINETIS_DEVKITARM=n
+CONFIG_KINETIS_BUILDROOT=y
+CONFIG_KINETIS_DFU=y
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_KINETIS_TRACE=n
+CONFIG_KINETIS_FLEXBUS=n
+CONFIG_KINETIS_UART0=n
+CONFIG_KINETIS_UART1=n
+CONFIG_KINETIS_UART2=n
+CONFIG_KINETIS_UART3=n
+CONFIG_KINETIS_UART4=n
+CONFIG_KINETIS_UART5=y
+CONFIG_KINETIS_ENET=n
+CONFIG_KINETIS_RNGB=n
+CONFIG_KINETIS_FLEXCAN0=n
+CONFIG_KINETIS_FLEXCAN1=n
+CONFIG_KINETIS_SPI0=n
+CONFIG_KINETIS_SPI1=n
+CONFIG_KINETIS_SPI2=n
+CONFIG_KINETIS_I2C0=n
+CONFIG_KINETIS_I2C1=n
+CONFIG_KINETIS_I2S=n
+CONFIG_KINETIS_DAC0=n
+CONFIG_KINETIS_DAC1=n
+CONFIG_KINETIS_ADC0=n
+CONFIG_KINETIS_ADC1=n
+CONFIG_KINETIS_CMP=n
+CONFIG_KINETIS_VREF=n
+CONFIG_KINETIS_SDHC=n
+CONFIG_KINETIS_FTM0=n
+CONFIG_KINETIS_FTM1=n
+CONFIG_KINETIS_FTM2=n
+CONFIG_KINETIS_LPTIMER=n
+CONFIG_KINETIS_RTC=n
+CONFIG_KINETIS_SLCD=n
+CONFIG_KINETIS_EWM=n
+CONFIG_KINETIS_CMT=n
+CONFIG_KINETIS_USBOTG=n
+CONFIG_KINETIS_USBDCD=n
+CONFIG_KINETIS_LLWU=n
+CONFIG_KINETIS_TSI=n
+CONFIG_KINETIS_FTFL=n
+CONFIG_KINETIS_DMA=n
+CONFIG_KINETIS_CRC=n
+CONFIG_KINETIS_PDB=n
+CONFIG_KINETIS_PIT=n
+CONFIG_ARMV7M_MPU=n
+
+#
+# PIN Interrupt Support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_KINETIS_PORTAINTS=n
+CONFIG_KINETIS_PORTBINTS=n
+CONFIG_KINETIS_PORTCINTS=n
+CONFIG_KINETIS_PORTDINTS=n
+CONFIG_KINETIS_PORTEINTS=n
+
+#
+# K40X256VLQ100 specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_BOOT_RAMFUNCS=y
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/kwikstik-k40/ostest/ld.script b/nuttx/configs/kwikstik-k40/ostest/ld.script
new file mode 100755
index 000000000..2b7b517fa
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/ostest/ld.script
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * configs/kwikstik-k40/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The K40X256VLQ100 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of SRAM beginning at address 0x1800:0000 (SRAM_L) and 0x2000:000
+ * (SRAM_U).
+ *
+ * NOTE: that the first part of the K40 FLASH region is reserved for
+ * interrupt vectflash and, following that, is a region from 0x0000:0400
+ * to 0x0000:040f that is reserved for the FLASH control fields (FCF).
+ *
+ * NOTE: The on-chip RAM is split evenly among SRAM_L and SRAM_U. The RAM is
+ * also implemented such that the SRAM_L and SRAM_U ranges form a
+ * contiguous block in the memory map.
+ */
+
+MEMORY
+{
+ vectflash (rx) : ORIGIN = 0x00000000, LENGTH = 1K - 16
+ cfmprotect (rx) : ORIGIN = 0x00000400, LENGTH = 16
+ progflash (rx) : ORIGIN = 0x00000800, LENGTH = 256K - 2K
+ datasram (rwx) : ORIGIN = 0x1fff8000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectflash
+
+ .cfmprotect : {
+ *(.cfmconfig)
+ } > cfmprotect
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > progflash
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _eronly = LOADADDR(.data);
+
+ .ramfunc ALIGN(4): {
+ _sramfuncs = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfuncs = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _framfuncs = LOADADDR(.ramfunc);
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > datasram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > datasram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > datasram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/kwikstik-k40/ostest/setenv.sh b/nuttx/configs/kwikstik-k40/ostest/setenv.sh
new file mode 100755
index 000000000..089419ac7
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/kwikstik-k40/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/kwikstik-k40/src/Makefile b/nuttx/configs/kwikstik-k40/src/Makefile
new file mode 100644
index 000000000..ae935f6d9
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/Makefile
@@ -0,0 +1,105 @@
+############################################################################
+# configs/kwikstik-k40/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_lcd.c up_spi.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBDEV),y)
+CSRCS += up_usbdev.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/kwikstik-k40/src/kwikstik-internal.h b/nuttx/configs/kwikstik-k40/src/kwikstik-internal.h
new file mode 100644
index 000000000..145b62d5f
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/kwikstik-internal.h
@@ -0,0 +1,195 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/kwikstik-internal.h
+ * arch/arm/src/board/kwikstik-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_KWIKSTK_K40_SRC_KWIKSTIK_INTERNAL_H
+#define __CONFIGS_KWIKSTK_K40_SRC_KWIKSTIK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
+ * modules (others may support more -- in such case, the following must be
+ * expanded).
+ */
+
+#if KINETIS_NSPI < 1
+# undef CONFIG_KINETIS_SPI1
+# undef CONFIG_KINETIS_SPI2
+#elif KINETIS_NSPI < 2
+# undef CONFIG_KINETIS_SPI2
+#endif
+
+/* KwikStik-K40 GPIOs ***************************************************************/
+/* On-Board Connections
+ *
+ * ------------------- -------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * ------------------- -------------------------- -------- -------------------
+ * Audio Jack Output Audio Amp On PTE28 PTE28
+ * Audio Output DAC1_OUT DAC1_OUT
+ * Volume Up PTD10 PTD10
+ * Volume Down PTD11 PTD11
+ * Buzzer Audio Out PTA8 FTM1_CH0
+ * Microphone Microphone input PTA7 ADC0_SE10
+ * SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ * SD Command PTE3 SDHC0_CMD
+ * SD Data0 PTD12 SDHC0_D4
+ * SD Data1 PTD13 SDHC0_D5
+ * SD Data2 PTD14 SDHC0_D6
+ * SD Data3 PTD15 SDHC0_D7
+ * SD Card Detect PTE27 PTE27
+ * SD Card On PTE6 PTE6
+ * Infrared Port IR Transmit PTE4 IR_TX
+ * IR Receive PTA13 CMP2_IN0
+ * Touch Pads E1 / Touch PTB0 TSI0_CH0
+ * E2 / Touch PTA4 TSI0_CH5
+ * E3 / Touch PTA24 PTA24
+ * E4 / Touch PTA25 PTA25
+ * E5 / Touch PTA26 PTA26
+ * E6 / Touch PTA27 PTA27
+ */
+
+#define GPIO_SD_CARDDETECT (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTE | PIN27)
+#define GPIO_SD_CARDON (GPIO_HIGHDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTE | PIN6)
+
+/* Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ * ------------------- -------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * ------------------- -------------------------- -------- -------------------
+ * General Purpose TWRPI AN0 (J8 Pin 8) ? ADC0_DP0/ADC1_DP3
+ * TWRPI Socket TWRPI AN1 (J8 Pin 9) ? ADC0_DM0/ADC1_DM3
+ * TWRPI AN2 (J8 Pin 12) ? ADC1_DP0/ADC0_DP3
+ * TWRPI ID0 (J8 Pin 17) ? ADC0_DP1
+ * TWRPI ID1 (J8 Pin 18) ? ADC0_DM1
+ * TWRPI I2C SCL (J9 Pin 3) PTC10 I2C1_SCL
+ * TWRPI I2C SDA (J9 Pin 4) PTC11 I2C1_SDA
+ * TWRPI SPI MISO (J9 Pin 9) PTB23 SPI2_SIN
+ * TWRPI SPI MOSI (J9 Pin 10) PTB22 SPI2_SOUT
+ * TWRPI SPI SS (J9 Pin 11) PTB20 SPI2_PCS0
+ * TWRPI SPI CLK (J9 Pin 12) PTB21 SPI2_SCK
+ * TWRPI GPIO0 (J9 Pin 15) PTC12 PTC12
+ * TWRPI GPIO1 (J9 Pin 16) PTB9 PTB9
+ * TWRPI GPIO2 (J9 Pin 17) PTB10 PTB10
+ * TWRPI GPIO3 (J9 Pin 18) PTC5 PTC5
+ * TWRPI GPIO4 (J9 Pin 19) PTA5 PTA5
+ */
+
+/* Connections via the Tower Primary Connector Side A
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * A9 GPIO9 / CTS1 PTE10/UART_CTS
+ * A43 RXD1 PTE9/UART_RX
+ * A44 TXD1 PTE8/UART_TX
+ * A63 RSTOUT_b PTA9/FTM1_CH1
+ */
+
+/* Connections via the Tower Primary Connector Side B
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * B21 GPIO1 / RTS1 PTE7/UART_RTS
+ * B37 PWM7 PTA8/FTM1_CH0
+ * B38 PWM6 PTA9/FTM1_CH1
+ * B41 CANRX0 PTE25/CAN1_RX
+ * B42 CANTX0 PTE24/CAN1_TX
+ * B44 SPI0_MISO PTA17/SPI0_SIN
+ * B45 SPI0_MOSI PTA16/SPI0_SOUT
+ * B46 SPI0_CS0_b PTA14/SPI0_PCS0
+ * B48 SPI0_CLK PTA15/SPI0_SCK
+ * B50 SCL1 PTE1/I2C1_SCL
+ * B51 SDA1 PTE0/I2C1_SDA
+ * B52 GPIO5 / SD_CARD_DET PTA16
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Initialize LED GPIOs so that LEDs can be controlled.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void up_ledinit(void);
+#endif
+
+/************************************************************************************
+ * Name: kinetis_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function kinetis_spiinitialize(void);
+
+/************************************************************************************
+ * Name: kinetis_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function kinetis_usbinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_KWIKSTK_K40_SRC_KWIKSTIK_INTERNAL_H */
+
diff --git a/nuttx/configs/kwikstik-k40/src/up_boot.c b/nuttx/configs/kwikstik-k40/src/up_boot.c
new file mode 100644
index 000000000..cf5bba4e7
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_boot.c
@@ -0,0 +1,102 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "kwikstik-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All Kinetis architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void kinetis_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * kinetis_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
+ if (kinetis_spiinitialize)
+ {
+ kinetis_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function kinetis_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_KINETIS_USB)
+ if (kinetis_usbinitialize)
+ {
+ kinetis_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/kwikstik-k40/src/up_buttons.c b/nuttx/configs/kwikstik-k40/src/up_buttons.c
new file mode 100644
index 000000000..a30a480bc
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_buttons.c
@@ -0,0 +1,123 @@
+/****************************************************************************
+ * configs/kwikstik-k40/src/up_buttons.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "kwikstik-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ /* The KwikStik-K40 board has no standard GPIO contact buttons */
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ /* The KwikStik-K40 board has no standard GPIO contact buttons */
+
+ return 0;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ /* The KwikStik-K40 board has no standard GPIO contact buttons */
+
+ return NULL;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/kwikstik-k40/src/up_lcd.c b/nuttx/configs/kwikstik-k40/src/up_lcd.c
new file mode 100644
index 000000000..c8a8a9008
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_lcd.c
@@ -0,0 +1,134 @@
+/**************************************************************************************
+ * configs/kwikstik-k40/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "kwikstik-internal.h"
+
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+
+/* Configuration **********************************************************************/
+
+/* Display/Color Properties ***********************************************************/
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg(format, arg...) vdbg(format, ##arg)
+#else
+# define lcddbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ gvdbg("Initializing\n");
+#warning "Missing logic"
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+#warning "Missing logic"
+ return NULL;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+#warning "Missing logic"
+}
+
diff --git a/nuttx/configs/kwikstik-k40/src/up_leds.c b/nuttx/configs/kwikstik-k40/src/up_leds.c
new file mode 100644
index 000000000..a455fcc34
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_leds.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/kwikstik-k40/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Initialize LED GPIOs so that LEDs can be controlled.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* The KwikStik-K40 board has no MCU driven, GPIO-based LEDs */
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ /* The KwikStik-K40 board has no MCU driven, GPIO-based LEDs */
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ /* The KwikStik-K40 board has no MCU driven, GPIO-based LEDs */
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/kwikstik-k40/src/up_nsh.c b/nuttx/configs/kwikstik-k40/src/up_nsh.c
new file mode 100644
index 000000000..884ff3c44
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_nsh.c
@@ -0,0 +1,258 @@
+/****************************************************************************
+ * config/kwikstik-k40/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_KINETIS_SDHC
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "kinetis_internal.h"
+#include "kwikstik-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_KWIKSTIK_K40
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot, slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new Kinetis boards here */
+# error "Unrecognized Kinetis board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDHC support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* We expect to receive GPIO interrupts for card insertion events */
+
+#ifndef CONFIG_GPIO_IRQ
+# error "CONFIG_GPIO_IRQ required for card detect interrupt"
+#endif
+
+#ifndef CONFIG_KINETIS_PORTEINTS
+# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* This structure encapsulates the global variable used in this file and
+ * reduces the probability of name collistions.
+ */
+
+#ifdef NSH_HAVEMMCSD
+struct kinetis_nsh_s
+{
+ FAR struct sdio_dev_s *sdhc; /* SDIO driver handle */
+ bool inserted; /* True: card is inserted */
+};
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static struct kinetis_nsh_s g_nsh;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: kinetis_mediachange
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static void kinetis_mediachange(void)
+{
+ bool inserted;
+
+ /* Get the current value of the card detect pin. This pin is pulled up on
+ * board. So low means that a card is present.
+ */
+
+ inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
+
+ /* Has the pin changed state? */
+
+ if (inserted != g_nsh.inserted)
+ {
+ /* Yes.. perform the appropriate action (this might need some debounce). */
+
+ g_nsh.inserted = inserted;
+ sdhc_mediachange(g_nsh.sdhc, inserted);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: kinetis_cdinterrupt
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int kinetis_cdinterrupt(int irq, FAR void *context)
+{
+ /* All of the work is done by kinetis_mediachange() */
+
+ kinetis_mediachange();
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ int ret;
+
+ /* Configure GPIO pins.
+ *
+ * First CD power. The initial state will provide SD power.
+ */
+
+ kinetis_pinconfig(GPIO_SD_CARDON); /* Applies power to the card */
+
+ /* Attached the card detect interrupt (but don't enable it yet) */
+
+ kinetis_pinconfig(GPIO_SD_CARDDETECT);
+ kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt);
+
+ /* Mount the SDHC-based MMC/SD block driver */
+ /* First, get an instance of the SDHC interface */
+
+ message("nsh_archinitialize: Initializing SDHC slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+
+ g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!g_nsh.sdhc)
+ {
+ message("nsh_archinitialize: Failed to initialize SDHC slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDHC interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDHC to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDHC to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDHC to the MMC/SD driver\n");
+
+ /* Handle the initial card state */
+
+ kinetis_mediachange();
+
+ /* Enable CD interrupts to handle subsequent media changes */
+
+ kinetis_pinirqenable(GPIO_SD_CARDDETECT);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/kwikstik-k40/src/up_spi.c b/nuttx/configs/kwikstik-k40/src/up_spi.c
new file mode 100644
index 000000000..e88721dda
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_spi.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "kinetis_internal.h"
+#include "kwikstik-internal.h"
+
+#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#ifdef CONFIG_DEBUG_SPI
+# define spidbg lldbg
+# ifdef CONFIG_DEBUG_SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+void weak_function kinetis_spiinitialize(void)
+{
+# warning "Missing logic"
+}
+
+/****************************************************************************
+ * Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
+ *
+ * Description:
+ * The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common Kinetis logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_SPI1
+void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_KINETIS_SPI2
+void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_KINETIS_SPI3
+void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
diff --git a/nuttx/configs/kwikstik-k40/src/up_usbdev.c b/nuttx/configs/kwikstik-k40/src/up_usbdev.c
new file mode 100644
index 000000000..38e3413c7
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_usbdev.c
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * configs/kwikstik-k40/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "kinetis_internal.h"
+#include "kwikstik-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the KwikStik-K40 board.
+ *
+ ************************************************************************************/
+
+void kinetis_usbinitialize(void)
+{
+# warning "Missing logic"
+}
+
+/************************************************************************************
+ * Name: kinetis_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide kinetis_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int kinetis_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+# warning "Missing logic"
+ return OK;
+}
+
+/************************************************************************************
+ * Name: kinetis_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the kinetis_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void kinetis_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+#warning "Missing logic"
+}
+
diff --git a/nuttx/configs/kwikstik-k40/src/up_usbmsc.c b/nuttx/configs/kwikstik-k40/src/up_usbmsc.c
new file mode 100644
index 000000000..8051ea1ba
--- /dev/null
+++ b/nuttx/configs/kwikstik-k40/src/up_usbmsc.c
@@ -0,0 +1,118 @@
+/****************************************************************************
+ * configs/kwikstik-k40/src/up_usbmsc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the Kinetis MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "kinetis_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_KWIKSTIK_K40
+# undef KINETIS_MMCSDSLOTNO
+# define KINETIS_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new Kinetis boards here */
+# error "Unrecognized Kinetis board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+# warning "Missing logic"
+#endif /* CONFIG_EXAMPLES_USBMSC_BUILTIN */
+
+ return OK;
+}
diff --git a/nuttx/configs/lincoln60/Kconfig b/nuttx/configs/lincoln60/Kconfig
new file mode 100644
index 000000000..113d41d7f
--- /dev/null
+++ b/nuttx/configs/lincoln60/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LINCOLN60
+endif
diff --git a/nuttx/configs/lincoln60/README.txt b/nuttx/configs/lincoln60/README.txt
new file mode 100644
index 000000000..d94666d90
--- /dev/null
+++ b/nuttx/configs/lincoln60/README.txt
@@ -0,0 +1,441 @@
+README
+^^^^^^
+
+README for NuttX port to the Micromint Lincoln 60 board
+
+Contents
+^^^^^^^^
+
+ Lincoln 60 development board
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ USB Device Controller Functions
+ Lincoln 60 Configuration Options
+ USB Host Configuration
+ Configurations
+
+Lincoln 60 board
+^^^^^^^^^^^^^^^^
+
+ Memory Map
+ ----------
+
+ Block Start Length
+ Name Address
+ --------------------- ---------- ------
+ Internal flash 0x00000000 512K
+ RAM 0x10000000 32K
+ RAM1 0x2007C000 16K
+ RAM2 0x20080000 16K
+
+ GPIO Usage:
+ -----------
+
+ GPIO PIN SIGNAL NAME
+ -------------------------------- ---- --------------
+ P1[18] 32 LED1
+ P3[26] 26 LED2
+ P2[10] 53 BTN1
+
+ Console
+ -------
+
+ The Lincoln 60 has two serial connectors. The serial console defaults
+ to COM1 (UART0).
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM toolchain, you simply need add one of the
+ following configuration options to your .config (or defconfig) file:
+
+ CONFIG_LPC17_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC17_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC17_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC17_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC17_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows)and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or
+ Linux native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc17xx,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc17x/lpc17_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lincoln60/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+Lincoln 60 Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc17xx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LPC1768=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=lincoln60 (for the Lincoln 60 board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LINCOLN60=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x10000000
+
+ CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ CONFIG_LPC17_MAINOSC=y
+ CONFIG_LPC17_PLL0=y
+ CONFIG_LPC17_PLL1=n
+ CONFIG_LPC17_ETHERNET=n
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_LPC17_USBOTG=n
+ CONFIG_LPC17_USBDEV=n
+ CONFIG_LPC17_UART0=y
+ CONFIG_LPC17_UART1=n
+ CONFIG_LPC17_UART2=n
+ CONFIG_LPC17_UART3=n
+ CONFIG_LPC17_CAN1=n
+ CONFIG_LPC17_CAN2=n
+ CONFIG_LPC17_SPI=n
+ CONFIG_LPC17_SSP0=n
+ CONFIG_LPC17_SSP1=n
+ CONFIG_LPC17_I2C0=n
+ CONFIG_LPC17_I2C1=n
+ CONFIG_LPC17_I2S=n
+ CONFIG_LPC17_TMR0=n
+ CONFIG_LPC17_TMR1=n
+ CONFIG_LPC17_TMR2=n
+ CONFIG_LPC17_TMR3=n
+ CONFIG_LPC17_RIT=n
+ CONFIG_LPC17_PWM=n
+ CONFIG_LPC17_MCPWM=n
+ CONFIG_LPC17_QEI=n
+ CONFIG_LPC17_RTC=n
+ CONFIG_LPC17_WDT=n
+ CONFIG_LPC17_ADC=n
+ CONFIG_LPC17_DAC=n
+ CONFIG_LPC17_GPDMA=n
+ CONFIG_LPC17_FLASH=n
+
+ LPC17xx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ LPC17xx specific CAN device driver settings. These settings all
+ require CONFIG_CAN:
+
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
+ CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
+
+ LPC17xx specific PHY/Ethernet device driver settings. These setting
+ also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
+
+ CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+
+ CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ LPC17xx USB Device Configuration
+
+ CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+ CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+ CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in SRAM.
+ CONFIG_LPC17_USBDEV_DMA
+ Enable lpc17xx-specific DMA support
+ CONFIG_LPC17_USBDEV_NOVBUS
+ Define if the hardware implementation does not support the VBUS signal
+ CONFIG_LPC17_USBDEV_NOLED
+ Define if the hardware implementation does not support the LED output
+
+ LPC17xx USB Host Configuration
+
+ CONFIG_USBHOST_OHCIRAM_SIZE
+ Total size of OHCI RAM (in AHB SRAM Bank 1)
+ CONFIG_USBHOST_NEDS
+ Number of endpoint descriptors
+ CONFIG_USBHOST_NTDS
+ Number of transfer descriptors
+ CONFIG_USBHOST_TDBUFFERS
+ Number of transfer descriptor buffers
+ CONFIG_USBHOST_TDBUFSIZE
+ Size of one transfer descriptor buffer
+ CONFIG_USBHOST_IOBUFSIZE
+ Size of one end-user I/O buffer. This can be zero if the
+ application can guarantee that all end-user I/O buffers
+ reside in AHB SRAM.
+
+USB Host Configuration
+^^^^^^^^^^^^^^^^^^^^^^
+
+The Lincoln 60 board supports a USB host interface. The hidkbd
+example can be used to test this interface.
+
+The NuttShell (NSH) lincoln60 can also be modified in order to support USB
+host operations. To make these modifications, do the following:
+
+1. First configure to build the NSH configuration from the top-level
+ NuttX directory:
+
+ cd tools
+ ./configure lincoln60/nsh
+ cd ..
+
+2. Then edit the top-level .config file to enable USB host. Make the
+ following changes:
+
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_USBHOST=n
+ CONFIG_SCHED_WORKQUEUE=y
+
+When this change is made, NSH should be extended to support USB flash
+devices. When a FLASH device is inserted, you should see a device
+appear in the /dev (pseudo) directory. The device name should be
+like /dev/sda, /dev/sdb, etc. The USB mass storage device, is present
+it can be mounted from the NSH command line like:
+
+ ls /dev
+ mount -t vfat /dev/sda /mnt/flash
+
+Files on the connect USB flash device should then be accessible under
+the mountpoint /mnt/flash.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Lincoln 60 configuration is maintained in a sudirectory and can be selected
+as follow:
+
+ cd tools
+ ./configure.sh lincoln60/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ Builds the NuttX OS test at apps/examples/ostest.
+
+ nsh:
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables only the serial NSH interfaces. See notes
+ above for enabling USB host support in this configuration.
diff --git a/nuttx/configs/lincoln60/include/board.h b/nuttx/configs/lincoln60/include/board.h
new file mode 100644
index 000000000..b616689ec
--- /dev/null
+++ b/nuttx/configs/lincoln60/include/board.h
@@ -0,0 +1,222 @@
+/****************************************************************************
+ * configs/lincoln60/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdbool.h>
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+# include <nuttx/irq.h>
+#endif
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking ****************************************************************/
+/* NOTE: The following definitions require lpc17_syscon.h. It is not included here
+ * because the including C file may not have that file in its include path.
+ */
+
+#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
+#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
+#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency */
+#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
+
+/* This is the clock setup we configure for:
+ *
+ * SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
+ * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6
+ */
+
+#define LPC17_CCLK 80000000 /* 80Mhz*/
+
+/* Select the main oscillator as the frequency source. SYSCLK is then the frequency
+ * of the main oscillator.
+ */
+
+#undef CONFIG_LPC17_MAINOSC
+#define CONFIG_LPC17_MAINOSC 1
+#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
+
+/* Select the main oscillator and CCLK divider. The output of the divider is CCLK.
+ * The input to the divider (PLLCLK) will be determined by the PLL output.
+ */
+
+#define BOARD_CCLKCFG_DIVIDER 6
+#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
+
+/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
+ *
+ * Source clock: Main oscillator
+ * PLL0 Multiplier value (M): 20
+ * PLL0 Pre-divider value (N): 1
+ *
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
+ */
+
+#undef CONFIG_LPC17_PLL0
+#define CONFIG_LPC17_PLL0 1
+#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
+
+#define BOARD_PLL0CFG_MSEL 20
+#define BOARD_PLL0CFG_NSEL 1
+#define BOARD_PLL0CFG_VALUE \
+ (((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
+
+/* PLL1 -- Not used. */
+
+#undef CONFIG_LPC17_PLL1
+#define BOARD_PLL1CFG_MSEL 36
+#define BOARD_PLL1CFG_NSEL 1
+#define BOARD_PLL1CFG_VALUE \
+ (((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
+
+/* USB divider. This divider is used when PLL1 is not enabled to get the
+ * USB clock from PLL0:
+ *
+ * USBCLK = PLL0CLK / 10 = 48MHz
+ */
+
+#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
+
+/* FLASH Configuration */
+
+#undef CONFIG_LP17_FLASH
+#define CONFIG_LP17_FLASH 1
+#define BOARD_FLASHCFG_VALUE 0x0000303a
+
+/* LED definitions *********************************************************/
+/* The Lincoln 60 has 2 LEDs along the bottom of the board. Green or off.
+ * If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows
+ * for NuttX debug functionality (where NC means "No Change").
+ *
+ * During the boot phases. LED1 and LED2 will show boot status.
+ */
+ /* LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* GREEN OFF */
+#define LED_IRQSENABLED 2 /* OFF GREEN */
+#define LED_STACKCREATED 3 /* OFF OFF */
+
+/* After the system is booted, this logic will no longer use LEDs 1 & 2.
+ * They are available for use the application software using lpc17_led
+ * (prototyped below)
+ */
+ /* LED1 LED2 LED3 LED4 */
+#define LED_INIRQ 4 /* NC NC NC ON (momentary) */
+#define LED_SIGNAL 5 /* NC NC NC ON (momentary) */
+#define LED_ASSERTION 6 /* NC NC NC ON (momentary) */
+#define LED_PANIC 7 /* NC NC NC ON (1Hz flashing) */
+
+#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
+#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
+#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
+#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
+
+/* We need to redefine USB_PWRD as GPIO to get USB Host working
+ * Also remember to add 2 resistors of 15K to D+ and D- pins.
+ */
+
+#ifdef CONFIG_USBHOST
+# ifdef GPIO_USB_PWRD
+# undef GPIO_USB_PWRD
+# define GPIO_USB_PWRD (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN22)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ****************************************************************************/
+
+EXTERN void lpc17_boardinitialize(void);
+
+/****************************************************************************
+ * Name: lpc17_led
+ *
+ * Description:
+ * Once the system has booted, these functions can be used to control LEDs 1 & 2
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void lpc17_led(int lednum, int state);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/lincoln60/nsh/Make.defs b/nuttx/configs/lincoln60/nsh/Make.defs
new file mode 100644
index 000000000..343c2dcc6
--- /dev/null
+++ b/nuttx/configs/lincoln60/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lincoln60/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lincoln60/nsh/appconfig b/nuttx/configs/lincoln60/nsh/appconfig
new file mode 100644
index 000000000..c18668cc4
--- /dev/null
+++ b/nuttx/configs/lincoln60/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/lincoln60/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/lincoln60/nsh/defconfig b/nuttx/configs/lincoln60/nsh/defconfig
new file mode 100644
index 000000000..035c8f074
--- /dev/null
+++ b/nuttx/configs/lincoln60/nsh/defconfig
@@ -0,0 +1,444 @@
+############################################################################
+# configs/lincoln60/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1769=y
+CONFIG_ARCH_BOARD="lincoln60"
+CONFIG_ARCH_BOARD_LINCOLN60=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=y
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=y
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=20
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lincoln60/nsh/setenv.sh b/nuttx/configs/lincoln60/nsh/setenv.sh
new file mode 100755
index 000000000..ef3ca7f67
--- /dev/null
+++ b/nuttx/configs/lincoln60/nsh/setenv.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+# configs/lincoln60/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# TOOLCHAIN_BIN must be defined to the full path to the location where you
+# have installed the toolchain of your choice. Modify the following:
+
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Andd add the toolchain path to the PATH variable
+
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lincoln60/ostest/Make.defs b/nuttx/configs/lincoln60/ostest/Make.defs
new file mode 100644
index 000000000..de45b59df
--- /dev/null
+++ b/nuttx/configs/lincoln60/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lincoln60/ostest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lincoln60/ostest/appconfig b/nuttx/configs/lincoln60/ostest/appconfig
new file mode 100644
index 000000000..678b5e7bc
--- /dev/null
+++ b/nuttx/configs/lincoln60/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lincoln60/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/lincoln60/ostest/defconfig b/nuttx/configs/lincoln60/ostest/defconfig
new file mode 100644
index 000000000..90f980a13
--- /dev/null
+++ b/nuttx/configs/lincoln60/ostest/defconfig
@@ -0,0 +1,483 @@
+############################################################################
+# configs/lincoln60/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1769=y
+CONFIG_ARCH_BOARD="lincoln60"
+CONFIG_ARCH_BOARD_LINCOLN60=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=y
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lincoln60/ostest/setenv.sh b/nuttx/configs/lincoln60/ostest/setenv.sh
new file mode 100755
index 000000000..19c43760f
--- /dev/null
+++ b/nuttx/configs/lincoln60/ostest/setenv.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+# configs/lincoln60/ostest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# TOOLCHAIN_BIN must be defined to the full path to the location where you
+# have installed the toolchain of your choice. Modify the following:
+
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Andd add the toolchain path to the PATH variable
+
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}" \ No newline at end of file
diff --git a/nuttx/configs/lincoln60/scripts/ld.script b/nuttx/configs/lincoln60/scripts/ld.script
new file mode 100644
index 000000000..262e62df8
--- /dev/null
+++ b/nuttx/configs/lincoln60/scripts/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/lincoln60/scripts/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1769 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lincoln60/src/Makefile b/nuttx/configs/lincoln60/src/Makefile
new file mode 100644
index 000000000..1bc1f2fdf
--- /dev/null
+++ b/nuttx/configs/lincoln60/src/Makefile
@@ -0,0 +1,96 @@
+############################################################################
+# configs/lincoln60/src/Makefile
+#
+# Copyright (C) 20102Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lincoln60/src/lincoln60_internal.h b/nuttx/configs/lincoln60/src/lincoln60_internal.h
new file mode 100644
index 000000000..022522e39
--- /dev/null
+++ b/nuttx/configs/lincoln60/src/lincoln60_internal.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * configs/lincoln60/src/lincoln60_internal.h
+ * arch/arm/src/board/lincoln60_internal.n
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef _CONFIGS_LINCOLN60_SRC_LINCOLN60_INTERNAL_H
+#define _CONFIGS_LINCOLN60_SRC_LINCOLN60_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * LEDs GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P1[18] 32 LED1
+ * P3[26] 26 LED2
+ ****************************************************************************/
+
+#define LINCOLN60_LED1 (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN18)
+#define LINCOLN60_LED1_OFF LINCOLN60_LED1
+#define LINCOLN60_LED1_ON (LINCOLN60_LED1 | GPIO_VALUE_ONE)
+#define LINCOLN60_LED2 (GPIO_OUTPUT | GPIO_PORT3 | GPIO_PIN26)
+#define LINCOLN60_LED2_OFF LINCOLN60_LED2
+#define LINCOLN60_LED2_ON (LINCOLN60_LED2 | GPIO_VALUE_ONE)
+
+#define LINCOLN60_HEARTBEAT LINCOLN60_LED2
+
+/****************************************************************************
+ * Buttons GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P2[10] 53 BTN1
+ ****************************************************************************/
+
+#define LINCOLN60_BUT1 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN10)
+
+/* Button IRQ numbers */
+
+#define LINCOLN60_BUT1_IRQ LPC17_IRQ_P0p23
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Lincoln 60 board.
+ *
+ ****************************************************************************/
+
+extern void weak_function lpc17_sspinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_LINCOLN60_SRC_LINCOLN60_INTERNAL_H */
+
diff --git a/nuttx/configs/lincoln60/src/up_boot.c b/nuttx/configs/lincoln60/src/up_boot.c
new file mode 100644
index 000000000..42b01a3ea
--- /dev/null
+++ b/nuttx/configs/lincoln60/src/up_boot.c
@@ -0,0 +1,82 @@
+/************************************************************************************
+ * configs/lincoln60/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+#include "lincoln60_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc17_boardinitialize(void)
+{
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/lincoln60/src/up_buttons.c b/nuttx/configs/lincoln60/src/up_buttons.c
new file mode 100644
index 000000000..55781846d
--- /dev/null
+++ b/nuttx/configs/lincoln60/src/up_buttons.c
@@ -0,0 +1,225 @@
+/****************************************************************************
+ * configs/lincoln60/src/up_buttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include <arch/board/board.h>
+
+#include "lpc17_internal.h"
+#include "lincoln60_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
+ * the BUTTON_* and JOYSTICK_* definitions in board.h
+ */
+
+static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
+{
+ LINCOLN60_BUT1
+};
+
+/* This array defines all of the interupt handlers current attached to
+ * button events.
+ */
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+static xcpt_t g_buttonisr[BOARD_NUM_BUTTONS];
+
+/* This array provides the mapping from button ID numbers to button IRQ
+ * numbers.
+ */
+
+static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
+{
+ LINCOLN60_BUT1_IRQ
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as interrupting inputs. */
+
+ for (i = 0; i < BOARD_NUM_BUTTONS; i++)
+ {
+ lpc17_configgpio(g_buttoncfg[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons.
+ *
+ * up_buttons() may be called at any time to harvest the state of every
+ * button. The state of the buttons is returned as a bitset with one
+ * bit corresponding to each button: If the bit is set, then the button
+ * is pressed. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < BOARD_NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed. */
+
+ bool released = lpc17_gpioread(g_buttoncfg[i]);
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_irqbutton() may be called to register button interrupt handlers.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BOARD_BUTTON_* and BOARD_JOYSTICK_* definitions in board.h for the meaning
+ * of enumeration values. The previous interrupt handler address is returned
+ * (so that it may restored, if so desired).
+ *
+ * Note that up_irqbutton() also enables button interrupts. Button
+ * interrupts will remain enabled after the interrupt handler is attached.
+ * Interrupts may be disabled (and detached) by calling up_irqbutton with
+ * irqhandler equal to NULL.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+ irqstate_t flags;
+ int irq;
+
+ /* Verify that the button ID is within range */
+
+ if ((unsigned)id < BOARD_NUM_BUTTONS)
+ {
+ /* Return the current button handler and set the new interrupt handler */
+
+ oldhandler = g_buttonisr[id];
+ g_buttonisr[id] = irqhandler;
+
+ /* Disable interrupts until we are done */
+
+ flags = irqsave();
+
+ /* Configure the interrupt. Either attach and enable the new
+ * interrupt or disable and detach the old interrupt handler.
+ */
+
+ irq = g_buttonirq[id];
+ if (irqhandler)
+ {
+ /* Attach then enable the new interrupt handler */
+
+ (void)irq_attach(irq, irqhandler);
+ up_enable_irq(irq);
+ }
+ else
+ {
+ /* Disable then then detach the the old interrupt handler */
+
+ up_disable_irq(irq);
+ (void)irq_detach(irq);
+ }
+ irqrestore(flags);
+ }
+ return oldhandler;
+}
+#endif
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/lincoln60/src/up_leds.c b/nuttx/configs/lincoln60/src/up_leds.c
new file mode 100644
index 000000000..fe00895b1
--- /dev/null
+++ b/nuttx/configs/lincoln60/src/up_leds.c
@@ -0,0 +1,219 @@
+/****************************************************************************
+ * configs/lincoln60/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+
+#include "lincoln60_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_VERBOSE
+# define led_dumpgpio(m) lpc17_dumpgpio(LINCOLN60_LED2, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* LED definitions ******************************************************************
+
+The Lincoln 60 has 2 LEDs along the bottom of the board. Green or off.
+If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows for NuttX
+debug functionality (where NC means "No Change").
+
+During the boot phases. LED1 and LED2 will show boot status.
+
+ LED1 LED2
+STARTED OFF OFF
+HEAPALLOCATE BLUE OFF
+IRQSENABLED OFF BLUE
+STACKCREATED OFF OFF
+
+After the system is booted, this logic will no longer use LEDs 1 & 2. They
+are available for use by applications using lpc17_led (prototyped below)
+*/
+
+static bool g_initialized;
+static int g_nestcount;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure all LED GPIO lines */
+
+ led_dumpgpio("up_ledinit() Entry)");
+
+ lpc17_configgpio(LINCOLN60_LED1);
+ lpc17_configgpio(LINCOLN60_LED2);
+
+ led_dumpgpio("up_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ /* We will control LED1 and LED2 not yet completed the boot sequence. */
+
+ if (!g_initialized)
+ {
+ int led1 = 0;
+ int led2 = 0;
+ switch (led)
+ {
+ case LED_STACKCREATED:
+ g_initialized = true;
+ case LED_STARTED:
+ default:
+ break;
+
+ case LED_HEAPALLOCATE:
+ led1 = 1;
+ break;
+
+ case LED_IRQSENABLED:
+ led2 = 1;
+ }
+ lpc17_led(LINCOLN60_LED1,led1);
+ lpc17_led(LINCOLN60_LED2,led2);
+ }
+
+ /* We will always control the HB LED */
+
+ switch (led)
+ {
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ lpc17_gpiowrite(LINCOLN60_HEARTBEAT, false);
+ g_nestcount++;
+
+ default:
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ /* In all states, OFF can only mean turning off the HB LED */
+
+ if (g_nestcount <= 1)
+ {
+ lpc17_led(LINCOLN60_HEARTBEAT, true);
+ g_nestcount = 0;
+ }
+ else
+ {
+ g_nestcount--;
+ }
+}
+
+/************************************************************************************
+ * Name: lpc17_led
+ *
+ * Description:
+ * Once the system has booted, these functions can be used to control the LEDs
+ *
+ ************************************************************************************/
+
+void lpc17_led(int lednum, int state)
+
+{
+ lpc17_gpiowrite(lednum, state);
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lincoln60/src/up_nsh.c b/nuttx/configs/lincoln60/src/up_nsh.c
new file mode 100644
index 000000000..2c829837a
--- /dev/null
+++ b/nuttx/configs/lincoln60/src/up_nsh.c
@@ -0,0 +1,86 @@
+/****************************************************************************
+ * config/lincoln60/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ return OK;
+}
diff --git a/nuttx/configs/lm3s6432-s2e/Kconfig b/nuttx/configs/lm3s6432-s2e/Kconfig
new file mode 100644
index 000000000..102f4a5f6
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LM3S6432S2E
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/lm3s6432-s2e/README.txt b/nuttx/configs/lm3s6432-s2e/README.txt
new file mode 100644
index 000000000..a5b0b566b
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/README.txt
@@ -0,0 +1,381 @@
+README
+^^^^^^
+
+README for NuttX port to the Stellaris RDK-S2E Reference Design Kit and
+the MDL-S2E Ethernet to Serial module.
+
+Contents
+^^^^^^^^
+
+ Stellaris RDK-S2E Reference Design Kit
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ Stellaris MDL-S2E Reference Design Configuration Options
+ Configurations
+
+Stellaris RDK-S2E Reference Design Kit
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Stellaris RDK-S2E Reference Design Kit includes the following features:
+
+ o MDL-S2E Ethernet to serial module
+ o LM3S6432 in a 10 x 10 mm BGA package for reduced board size
+ o 10/100 Mbit Ethernet port
+ o Auto MDI/MDIX cross-over correction
+ o Traffic and link indicators Serial ports
+ o UART ports include RTS/CTS for flow control
+ o UART0 has RS232 levels, transceiver runs at up to 230.4 Kbaud
+ o UART1 has CMOS/TTL levels, can run at 1.0 Mbaud
+
+Features of the LM3S6432 Microcontroller
+
+ o 32-bit RISC performance using ARM® Cortex™-M3 v7M architecture
+ - 50-MHz operation
+ - Hardware-division and single-cycle-multiplication
+ - Integrated Nested Vectored Interrupt Controller (NVIC)
+ - 42 interrupt channels with eight priority levels
+ o 96 KB single-cycle flash
+ o 32 KB single-cycle SRAM
+ o Three general-purpose 32-bit timers
+ o Integrated Ethernet MAC and PHY
+ o Two fully programmable 16C550-type UARTs
+ o Three 10-bit channels (inputs) when used as single-ended inputs
+ o Two independent integrated analog comparators
+ o One I2C module
+ o One PWM generator block
+ – One 16-bit counter
+ – Two comparators
+ – Produces two independent PWM signals
+ – One dead-band generator
+ o 0 to 43 GPIOs, depending on user configuration
+ o On-chip low drop-out (LDO) voltage regulator
+
+GPIO Usage
+
+PIN SIGNAL Function
+--- ----------------- ---------------------------------------
+ L3 PA0/U0RX UART0 receive
+ M3 PA1/U0TX UART0 transmit
+E12 PB0/U0CTS UART0 CTS
+D12 PB1/U0RTS UART0 RTS
+ L5 PA4/SPIRX SPI receive (pin hardwired to U1RX)
+ M5 PA5/SPITX SPI transmit (pin hardwired to U1TX)
+ H2 PD2/U1RX UART1 receive
+ H1 PD3/U1TX UART1 transmit
+ L4 PA3/U1CTS/SPICLK UART1 CTS or SPI clock
+ M4 PA2/U1RTS/SPISEL UART1 RTS or SPI slave select
+J11 PF0/LED1 Ethernet LED1 (green)
+J12 PF1/LED0 Ethernet LED0 (yellow)
+C11 PB2 Transciever #INVALID
+C12 PB3 Transciever #ENABLE
+ A6 PB4 Transciever ON
+ B7 PB5 Transciever #OFF
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux, Mac OS X or Cygwin on Windows can be used for the development
+ environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using GCC on
+ Mac OS X.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ To use a specific toolchain, you simply need to add one of the following
+ configuration options to your .config (or defconfig) file:
+
+ CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux or on Mac OS X.
+ CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or Linux
+ native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lm3s,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lm3s/lm3s_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ This port was tested with tools built using summon-arm-toolchain; available
+ from https://github.com/esden/summon-arm-toolchain, however the buildroot
+ instructions should apply for other platforms.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lm3s6432-s2e/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+
+Stellaris MDL-S2E Reference Design Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lm3s
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LM3S6432
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=lm3s6432-s2e (for the Stellaris MDL-S2E Reference Design)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LM3S6432S2E
+
+ CONFIG_ARCH_LOOPSPERMSEC - As supplied, calibrated for correct operation
+ of delay loops assuming 50MHz CPU frequency.
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ There are configurations for disabling support for interrupts GPIO ports.
+ GPIOH and GPIOJ must be disabled because they do not exist on the LM3S6432.
+ Additional interrupt support can be disabled if desired to reduce memory
+ footprint - GPIOs C-G are not pinned out on the MDL-S2E board.
+
+ CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOC_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOD_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOE_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOF_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOG_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+ CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+ LM3S6432 specific device driver settings
+
+ CONFIG_UARTn_DISABLE
+ The TX and RX pins for UART1 share I/O pins with the TX and RX pins
+ for SSI0. To avoid conflicts, only one of SSI0 and UART1 should
+ be enabled in a configuration.
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is UART1).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ CONFIG_SSI0_DISABLE - Select to disable support for SSI0
+ The TX and RX pins for SSI0 share I/O pins with the TX and RX pins
+ for UART1. To avoid conflicts, only one of SSI0 and UART1 should
+ be enabled in a configuration.
+ CONFIG_SSI1_DISABLE - Select to disable support for SSI1
+ Note that the LM3S6432 only has one SSI, so SSI1 should always be
+ disabled.
+ CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support.
+ Poll-waiting is recommended if the interrupt rate would be to
+ high in the interrupt driven case.
+ CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before
+ emptying the Rx FIFO. If the SPI frequency is high and this
+ value is large, then larger values of this setting may cause
+ Rx FIFO overrun errors. Default: half of the Tx FIFO size (4).
+
+ CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
+ to build the LM3S Ethernet driver
+ CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
+ CONFIG_LM3S_BOARDMAC - This should be set in order to use the
+ MAC address configured in the flash USER registers.
+ CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation
+ CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation
+ CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding
+ CONFIG_LM3S_MULTICAST - Set to enable multicast frames
+ CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode
+ CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection.
+ CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Stellaris MDL-S2E Reference Design configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh lm3s6432-s2e/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+ NOTE: As it is configured now, you MUST have a network connected.
+ Otherwise, the NSH prompt will not come up because the Ethernet
+ driver is waiting for the network to come up. That is probably
+ a bug in the Ethernet driver behavior!
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+ NOTE: as the configuration stands, ostest will hang during the
+ semaphore test. This has not been debugged.
diff --git a/nuttx/configs/lm3s6432-s2e/include/README.txt b/nuttx/configs/lm3s6432-s2e/include/README.txt
new file mode 100644
index 000000000..7e21d4204
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Stellaris MDL-S2E Reference Design.
diff --git a/nuttx/configs/lm3s6432-s2e/include/board.h b/nuttx/configs/lm3s6432-s2e/include/board.h
new file mode 100644
index 000000000..06504ec4f
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/include/board.h
@@ -0,0 +1,144 @@
+/************************************************************************************
+ * configs/lm3s6432-s2e/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* RCC settings */
+
+#define SYSCON_RCC_XTAL SYSCON_RCC_XTAL8000KHZ /* S2E on-board crystal is 8.00 MHz */
+#define XTAL_FREQUENCY 8000000
+
+/* Oscillator source is the main oscillator (not internal, internal/4, 30KHz or
+ * 30KHz from hibernate module) */
+
+#define SYSCON_RCC_OSCSRC SYSCON_RCC_OSCSRC_MOSC
+#define SYSCON_RCC2_OSCSRC SYSCON_RCC2_OSCSRC2_MOSC
+#define OSCSRC_FREQUENCY XTAL_FREQUENCY
+
+/* Use system divider = 4; this corresponds to a system clock frequency
+ * of (400 / 2) / 4 = 50MHz
+ */
+
+#define LM3S_SYSDIV 4
+#define SYSCLK_FREQUENCY 50000000 /* 50MHz */
+
+/* Other RCC settings:
+ *
+ * - Main and internal oscillators enabled.
+ * - PLL and sys dividers not bypassed
+ * - PLL not powered down
+ * - No auto-clock gating reset
+ */
+
+#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV))
+
+/* RCC2 settings -- RCC2 not used. Other RCC2 settings
+ *
+ * - PLL and sys dividers not bypassed.
+ * - PLL not powered down
+ * - Not using RCC2
+ */
+
+#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV))
+
+/* LED definitions ******************************************************************/
+
+/* The S2E has two LEDs on PF2/PF3, shared with the Ethernet.
+ * In keeping with the other lm3s6xxx port, we use one of these for debugging.
+ * Below is the mapping of this
+ * single LED. From this single LED, we can get the following information:
+ *
+ * OFF Steady: The system has failed to boot to the point of enabling interrupts
+ * ON Steady: The systems has enabled interrupts, but none have been received
+ * Dull glow: The system is taking interrupts
+ * Slow blinking: The system has panicked
+ */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* OFF OFF */
+#define LED_IRQSENABLED 2 /* ON ON */
+#define LED_STACKCREATED 3 /* ON ON */
+#define LED_INIRQ 4 /* ON OFF */
+#define LED_SIGNAL 5 /* ON OFF */
+#define LED_ASSERTION 6 /* ON OFF */
+#define LED_PANIC 7 /* ON OFF */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+extern void lm3s_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the MDL-S2E Reference Design, the MAC address will be stored in the
+ * non-volatile USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined,
+ * this function will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+struct ether_addr;
+extern void lm3s_ethernetmac(struct ether_addr *ethaddr);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/lm3s6432-s2e/nsh/Make.defs b/nuttx/configs/lm3s6432-s2e/nsh/Make.defs
new file mode 100644
index 000000000..73f7007e8
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s6432-s2e/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s6432-s2e/nsh/appconfig b/nuttx/configs/lm3s6432-s2e/nsh/appconfig
new file mode 100644
index 000000000..74d29ef67
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/nsh/appconfig
@@ -0,0 +1,58 @@
+############################################################################
+# configs/lm3s6432-s2e/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/lm3s6432-s2e/nsh/defconfig b/nuttx/configs/lm3s6432-s2e/nsh/defconfig
new file mode 100644
index 000000000..a5f2466c2
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/nsh/defconfig
@@ -0,0 +1,342 @@
+############################################################################
+# configs/lm3s6432-s2e/nsh/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6432=y
+CONFIG_ARCH_BOARD="lm3s6432-s2e"
+CONFIG_ARCH_BOARD_LM3S6432S2E=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=y
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=n
+
+#
+# Disable support for interrupts on GPIOs which do not
+# exist on the LM3S6432 or are not pinned anywhere useful
+# on the S2E.
+#
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6432 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=n
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6432 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=y
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6432 specific ethernet device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=10
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+#CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+#CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+#CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=y
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s6432-s2e/nsh/ld.script b/nuttx/configs/lm3s6432-s2e/nsh/ld.script
new file mode 100644
index 000000000..0701841c5
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/nsh/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s6432-s2e/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6432 has 96Kb of FLASH beginning at address 0x0000:0000 and 32Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 96K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6432 has 32Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s6432-s2e/nsh/setenv.sh b/nuttx/configs/lm3s6432-s2e/nsh/setenv.sh
new file mode 100644
index 000000000..3cd011f12
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s6432-s2e/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s6432-s2e/ostest/Make.defs b/nuttx/configs/lm3s6432-s2e/ostest/Make.defs
new file mode 100644
index 000000000..41c1ba32c
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s6432-s2e/ostest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s6432-s2e/ostest/appconfig b/nuttx/configs/lm3s6432-s2e/ostest/appconfig
new file mode 100644
index 000000000..59851765a
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lm3s6432-s2e/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/lm3s6432-s2e/ostest/defconfig b/nuttx/configs/lm3s6432-s2e/ostest/defconfig
new file mode 100644
index 000000000..bc9ce20f0
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/ostest/defconfig
@@ -0,0 +1,339 @@
+############################################################################
+# configs/lm3s6432-s2e/nsh/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S6432=y
+CONFIG_ARCH_BOARD="lm3s6432-s2e"
+CONFIG_ARCH_BOARD_LM3S6432S2E=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=y
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=n
+
+#
+# Disable support for interrupts on GPIOs which do not
+# exist on the LM3S6432 or are not pinned anywhere useful
+# on the S2E.
+#
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6432 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=n
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6432 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=y
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6432 specific ethernet device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s6432-s2e/ostest/ld.script b/nuttx/configs/lm3s6432-s2e/ostest/ld.script
new file mode 100644
index 000000000..bfbf8d302
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/ostest/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s6432-s2e/ostest/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6432 has 96Kb of FLASH beginning at address 0x0000:0000 and 32Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 96K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6432 has 32Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s6432-s2e/ostest/setenv.sh b/nuttx/configs/lm3s6432-s2e/ostest/setenv.sh
new file mode 100644
index 000000000..2cccdc70e
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s6432-s2e/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s6432-s2e/src/Makefile b/nuttx/configs/lm3s6432-s2e/src/Makefile
new file mode 100644
index 000000000..eefaa5039
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/Makefile
@@ -0,0 +1,87 @@
+############################################################################
+# configs/lm3s6432-s2e/src/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_ethernet.c up_ssi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lm3s6432-s2e/src/README.txt b/nuttx/configs/lm3s6432-s2e/src/README.txt
new file mode 100644
index 000000000..63aa5561e
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Stellaris MDL-S2E Reference Design.
diff --git a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h
new file mode 100644
index 000000000..bd4cff77f
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h
@@ -0,0 +1,125 @@
+/************************************************************************************
+ * configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_LM3S6432_S2E_SRC_LM3S6432S2E_INTERNAL_H
+#define __CONFIGS_LM3S6432_S2E_SRC_LM3S6432S2E_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S6432 supports 1 SSI
+ * module (others may support more than 2 -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+#endif
+#undef CONFIG_SSI1_DISABLE
+#define CONFIG_SSI1_DISABLE 1
+
+/* LM3S6432 MDL-S2E *****************************************************************/
+
+/* GPIO Usage
+ *
+ * PIN SIGNAL S2E Function
+ * --- ----------------- ---------------------------------------
+ * L3 PA0/U0RX Virtual COM port receive
+ * M3 PA1/U0TX Virtual COM port transmit
+ * E12 PB0/U0CTS Virtual COM port CTS
+ * D12 PB1/U0RTS Virtual COM port RTS
+ * L5 PA4/SPIRX SPI receive
+ * M5 PA5/SPITX SPI transmit
+ * H2 PD2/U1RX Virtual COM port receive
+ * H1 PD3/U1TX Virtual COM port transmit
+ * L4 PA3/U1CTS/SPICLK Virtual COM port CTS
+ * M4 PA2/U1RTS/SPISEL Virtual COM port RTS
+ * J11 PF0/LED1 Ethernet LED1 (green)
+ * J12 PF1/LED0 Ethernet LED0 (yellow)
+ * C11 PB2 Transciever #INVALID
+ * C12 PB3 Transciever #ENABLE
+ * A6 PB4 Transciever ON
+ * B7 PB5 Transciever #OFF
+ */
+
+/* GPIO for LEDs:
+ * - PF0: User LED
+ */
+
+#define LED1_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | 2)
+#define LED0_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTF | 3)
+
+/* GPIO for SSI0 select
+ */
+#define SSICS_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTA | 3)
+
+/* GPIOs for the RS-232 transciever enable/disable.
+ * Default state for these enables the transciever.
+ */
+#define XCVR_INV_GPIO (GPIO_FUNC_INPUT | GPIO_PORTB | 2)
+#define XCVR_ENA_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTB | 3)
+#define XCVR_ON_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTB | 4)
+#define XCVR_OFF_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTB | 5)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the MDL-S2E.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_LM3S6432_S2E_SRC_LM3S6432S2E_INTERNAL_H */
+
diff --git a/nuttx/configs/lm3s6432-s2e/src/up_boot.c b/nuttx/configs/lm3s6432-s2e/src/up_boot.c
new file mode 100644
index 000000000..3c5787f99
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/up_boot.c
@@ -0,0 +1,103 @@
+/************************************************************************************
+ * configs/lm3s6432-s2e/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "lm3s6432s2e_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+#if !defined(CONFIG_UART1_DISABLE) && !defined(CONFIG_SSI0_DISABLE)
+# error Only one of UART1 and SSI0 can be enabled on this board.
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void lm3s_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
+
+#if !defined(CONFIG_SSI0_DISABLE)
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+
+ /* Configure serial transciever */
+
+ lm3s_configgpio(XCVR_INV_GPIO);
+ lm3s_configgpio(XCVR_ENA_GPIO);
+ lm3s_configgpio(XCVR_ON_GPIO);
+ lm3s_configgpio(XCVR_OFF_GPIO);
+}
diff --git a/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c b/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c
new file mode 100644
index 000000000..09d5040c4
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/lm3s6432-s3e/src/up_ethernet.c
+ * arch/arm/src/board/up_ethernet.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <arch/board/board.h>
+#include <net/ethernet.h>
+
+#include "up_arch.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+void lm3s_ethernetmac(struct ether_addr *ethaddr)
+{
+ uint32_t user0;
+ uint32_t user1;
+
+ /* Get the current value of the user registers */
+
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
+
+ nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff);
+ DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff);
+
+ /* Re-format that MAC address the way that uIP expects to see it */
+
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
+}
+#endif
diff --git a/nuttx/configs/lm3s6432-s2e/src/up_leds.c b/nuttx/configs/lm3s6432-s2e/src/up_leds.c
new file mode 100644
index 000000000..80fea934f
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/up_leds.c
@@ -0,0 +1,168 @@
+/****************************************************************************
+ * configs/lm3s6432-s2e/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "lm3s6432s2e_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_DEBUG
+# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+static uint8_t g_nest;
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ leddbg("Initializing\n");
+
+ /* Configure Port F, Bit 2 as an output, initial value=OFF */
+
+ led_dumpgpio("up_ledinit before lm3s_configgpio()");
+ lm3s_configgpio(LED0_GPIO);
+ lm3s_configgpio(LED1_GPIO);
+ led_dumpgpio("up_ledinit after lm3s_configgpio()");
+ g_nest = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED1_GPIO, false);
+ led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ if (--g_nest <= 0)
+ {
+ led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED1_GPIO, true);
+ led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
+ }
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lm3s6432-s2e/src/up_nsh.c b/nuttx/configs/lm3s6432-s2e/src/up_nsh.c
new file mode 100644
index 000000000..46726e753
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/up_nsh.c
@@ -0,0 +1,87 @@
+/****************************************************************************
+ * config/lm3s6432-s2e/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ return OK;
+}
diff --git a/nuttx/configs/lm3s6432-s2e/src/up_ssi.c b/nuttx/configs/lm3s6432-s2e/src/up_ssi.c
new file mode 100644
index 000000000..d20e1d978
--- /dev/null
+++ b/nuttx/configs/lm3s6432-s2e/src/up_ssi.c
@@ -0,0 +1,151 @@
+/************************************************************************************
+ * configs/lm3s6432-s2e/src/up_ssi.c
+ * arch/arm/src/board/up_ssi.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lm3s_internal.h"
+#include "lm3s6432s2e_internal.h"
+
+#if !defined(CONFIG_SSI0_DISABLE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSI_DEBUG /* Define to enable debug */
+#undef SSI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# ifdef SSI_VERBOSE
+# define ssivdbg lldbg
+# else
+# define ssivdbg(x...)
+# endif
+#else
+# undef SSI_VERBOSE
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_VERBOSE
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssi_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the MDL-S2E.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the SPI CS GPIO */
+
+ ssi_dumpgpio("lm3s_ssiinitialize() Entry)");
+ lm3s_configgpio(SSICS_GPIO);
+ ssi_dumpgpio("lm3s_ssiinitialize() Exit");
+}
+
+/****************************************************************************
+ * The external functions, lm3s_spiselect and lm3s_spistatus must be provided
+ * by board-specific logic. The are implementations of the select and status
+ * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ * All othermethods (including up_spiinitialize()) are provided by common
+ * logic. To use this common SPI logic on your board:
+ *
+ * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your
+ * board-specific logic. This function will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 2. Add a call to up_spiinitialize() in your low level initialization
+ * logic
+ * 3. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssi_dumpgpio("lm3s_spiselect() Entry");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ }
+ ssi_dumpgpio("lm3s_spiselect() Exit");
+}
+
+uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */
diff --git a/nuttx/configs/lm3s6965-ek/Kconfig b/nuttx/configs/lm3s6965-ek/Kconfig
new file mode 100644
index 000000000..809ae2fe6
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LM3S6965EK
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt
new file mode 100644
index 000000000..5b26b41c8
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/README.txt
@@ -0,0 +1,447 @@
+README
+^^^^^^
+
+README for NuttX port to the Stellaris LMS36965 Evaluation Kit
+
+Contents
+^^^^^^^^
+
+ Stellaris LMS36965 Evaluation Kit
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ USB Device Controller Functions
+ OLED
+ Stellaris LM3S6965 Evaluation Kit Configuration Options
+ Configurations
+
+Stellaris LMS36965 Evaluation Kit
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Stellaris LM3S6965 Evaluation Board includes the following features:
+
+ o Stellaris LM3S6965 microcontroller with fully-integrated 10/100 embedded
+ Ethernet controller
+ o Simple setup; USB cable provides serial communication, debugging, and
+ power
+ o OLED graphics display with 128 x 96 pixel resolution
+ o User LED, navigation switches, and select pushbuttons
+ o Magnetic speaker
+ o LM3S6965 I/O available on labeled break-out pads
+ o Standard ARM® 20-pin JTAG debug connector with input and output modes
+ o USB interface for debugging and power supply
+ o MicroSD card slot
+
+Features of the LM3S6965 Microcontroller
+
+ o 32-bit RISC performance using ARM® Cortex™-M3 v7M architecture
+ – 50-MHz operation
+ – Hardware-division and single-cycle-multiplication
+ – Integrated Nested Vectored Interrupt Controller (NVIC)
+ – 42 interrupt channels with eight priority levels
+ o 256 KB single-cycle flash
+ o 64 KB single-cycle SRAM
+ o Four general-purpose 32-bit timers
+ o Integrated Ethernet MAC and PHY
+ o Three fully programmable 16C550-type UARTs
+ o Four 10-bit channels (inputs) when used as single-ended inputs
+ o Two independent integrated analog comparators
+ o Two I2C modules
+ o Three PWM generator blocks
+ – One 16-bit counter
+ – Two comparators
+ – Produces two independent PWM signals
+ – One dead-band generator
+ o Two QEI modules with position integrator for tracking encoder position
+ o 0 to 42 GPIOs, depending on user configuration
+ o On-chip low drop-out (LDO) voltage regulator
+
+GPIO Usage
+
+PIN SIGNAL EVB Function
+--- ----------- ---------------------------------------
+ 26 PA0/U0RX Virtual COM port receive
+ 27 PA1/U0TX Virtual COM port transmit
+ 10 PD0/IDX0 SD card chip select
+ 11 PD1/PWM1 Sound
+ 30 PA4/SSI0RX SD card data out
+ 31 PA5/SSI0TX SD card and OLED display data in
+ 28 PA2/SSI0CLK SD card and OLED display clock
+ 22 PC7/PHB0 OLED display data/control select
+ 29 PA3/SSI0FSS OLED display chip select
+ 73 PE1/PWM5 Down switch
+ 74 PE2/PHB1 Left switch
+ 72 PE0/PWM4 Up switch
+ 75 PE3/PHA1 Right switch
+ 61 PF1/IDX1 Select switch
+ 47 PF0/PWM0 User LED
+ 23 PC6/CCP3 Enable +15 V
+
+OLED
+^^^^
+
+ The Evaluation Kit includes an OLED graphics display. Features:
+
+ - RiT P14201 series display
+ - 128 columns by 96 rows
+ - 4-bit, 16-level gray scale.
+ - High-contrast (typ. 500:1)
+ - Excellent brightness (120 cd/m2)
+ - Fast 10 us response.
+
+ The OLED display has a built-in controller IC with synchronous serial and
+ parallel interfaces (SSD1329). Synchronous serial (SSI) is used on the EVB.
+ The SSI port is shared with the microSD card slot.
+
+ - PC7: OLED display data/control select (D/Cn)
+ - PA3: OLED display chip select (CSn)
+
+ NOTE: Newer versions of the LM3S6965 Evaluation Kit has an OSAM 128x64x4 OLED
+ display. Some tweaks to drivers/lcd/p14201.c would be required to support that
+ LCD.
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM, you simply need to add one of the following
+ configuration options to your .config (or defconfig) file:
+
+ CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or Linux
+ native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+ NOTE 3: I recently (i.e., late 2011) tried building with the CodeSourcery Windows
+ toolchain. The code worked but required 40 seconds to boot (or even until the
+ status LED illuminates)!! Know idea why. With the buildroot tools, boot time is
+ a couple of seconds.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lm3s,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lm3s/lm3s_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lm3s6965-ek/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+USB Device Controller Functions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ Device Overview
+
+ An FT2232 device from Future Technology Devices International Ltd manages
+ USB-to-serial conversion. The FT2232 is factory configured by Luminary
+ Micro to implement a JTAG/SWD port (synchronous serial) on channel A and
+ a Virtual COM Port (VCP) on channel B. This feature allows two simultaneous
+ communications links between the host computer and the target device using
+ a single USB cable. Separate Windows drivers for each function are provided
+ on the Documentation and Software CD.
+
+ Debugging with JTAG/SWD
+
+ The FT2232 USB device performs JTAG/SWD serial operations under the control
+ of the debugger or the Luminary Flash Programmer. It also operate as an
+ In-Circuit Debugger Interface (ICDI), allowing debugging of any external
+ target board. Debugging modes:
+
+ MODE DEBUG FUNCTION USE SELECTED BY
+ 1 Internal ICDI Debug on-board LM3S6965 Default Mode
+ microcontroller over USB
+ interface.
+ 2 ICDI out to JTAG/SWD The EVB is used as a USB Connecting to an external
+ header to SWD/JTAG interface to target and starting debug
+ an external target. software. The red Debug Out
+ LED will be ON.
+ 3 In from JTAG/SWD For users who prefer an Connecting an external
+ header external debug interface debugger to the JTAG/SWD
+ (ULINK, JLINK, etc.) with header.
+ the EVB.
+
+ Virtual COM Port
+
+ The Virtual COM Port (VCP) allows Windows applications (such as HyperTerminal)
+ to communicate with UART0 on the LM3S6965 over USB. Once the FT2232 VCP
+ driver is installed, Windows assigns a COM port number to the VCP channel.
+
+Stellaris LM3S6965 Evaluation Kit Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lm3s
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LM3S6965
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=lm3s6965-ek (for the Stellaris LM3S6965 Evaluation Kit)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LM3S6965EK
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ There are configurations for disabling support for interrupts GPIO ports.
+ GPIOJ must be disabled because it does not exist on the LM3S6918.
+ Additional interrupt support can be disabled if desired to reduce memory
+ footprint.
+
+ CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+ LM3S6818 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ CONFIG_SSI0_DISABLE - Select to disable support for SSI0
+ CONFIG_SSI1_DISABLE - Select to disable support for SSI1
+ CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support.
+ Poll-waiting is recommended if the interrupt rate would be to
+ high in the interrupt driven case.
+ CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before
+ emptying the Rx FIFO. If the SPI frequency is high and this
+ value is large, then larger values of this setting may cause
+ Rx FIFO overrun errors. Default: half of the Tx FIFO size (4).
+
+ CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
+ to build the LM3S Ethernet driver
+ CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
+ CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide
+ a MAC address (via lm3s_ethernetmac()), then this should be selected.
+ CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation
+ CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation
+ CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding
+ CONFIG_LM3S_MULTICAST - Set to enable multicast frames
+ CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode
+ CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection.
+ CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Stellaris LM3S6965 Evaluation Kit configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh lm3s6965-ek/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+ NOTE: As it is configured now, you MUST have a network connected.
+ Otherwise, the NSH prompt will not come up because the Ethernet
+ driver is waiting for the network to come up. That is probably
+ a bug in the Ethernet driver behavior!
+
+ Network File System (NFS) support can be added by setting the
+ following in your configuration file:
+
+ CONFIG_NFS=y
+ nx:
+ And example using the NuttX graphics system (NX). This example
+ uses the P14201 OLED driver.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+
diff --git a/nuttx/configs/lm3s6965-ek/include/README.txt b/nuttx/configs/lm3s6965-ek/include/README.txt
new file mode 100644
index 000000000..00f132a33
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Stellaris LM3S6965 Evaluation Kit.
diff --git a/nuttx/configs/lm3s6965-ek/include/board.h b/nuttx/configs/lm3s6965-ek/include/board.h
new file mode 100644
index 000000000..e8eaf9dd1
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/include/board.h
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/lm3s6965-ek/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* RCC settings */
+
+#define SYSCON_RCC_XTAL SYSCON_RCC_XTAL8000KHZ /* Eagle100 on-board crystall is 8.00 MHz */
+#define XTAL_FREQUENCY 8000000
+
+/* Oscillator source is the main oscillator (not internal, internal/4, 30KHz or
+ * 30KHz from hibernate module) */
+
+#define SYSCON_RCC_OSCSRC SYSCON_RCC_OSCSRC_MOSC
+#define SYSCON_RCC2_OSCSRC SYSCON_RCC2_OSCSRC2_MOSC
+#define OSCSRC_FREQUENCY XTAL_FREQUENCY
+
+/* Use system divider = 4; this corresponds to a system clock frequency
+ * of (400 / 2) / 4 = 50MHz
+ */
+
+#define LM3S_SYSDIV 4
+#define SYSCLK_FREQUENCY 50000000 /* 50MHz */
+
+/* Other RCC settings:
+ *
+ * - Main and internal oscillators enabled.
+ * - PLL and sys dividers not bypassed
+ * - PLL not powered down
+ * - No auto-clock gating reset
+ */
+
+#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV))
+
+/* RCC2 settings -- RCC2 not used. Other RCC2 settings
+ *
+ * - PLL and sys dividers not bypassed.
+ * - PLL not powered down
+ * - Not using RCC2
+ */
+
+#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV))
+
+/* LED definitions ******************************************************************/
+
+/* The LMS36965 Eval Kit has only one user LED: Port F, Bit 0. Below is the mapping of this
+ * single LED. From this single LED, we can get the following information:
+ *
+ * OFF Steady: The system has failed to boot to the point of enabling interrupts
+ * ON Steady: The systems has enabled interrupts, but none have been received
+ * Dull glow: The system is taking interrupts
+ * Slow blinking: The system has panicked
+ */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* OFF OFF */
+#define LED_IRQSENABLED 2 /* ON ON */
+#define LED_STACKCREATED 3 /* ON ON */
+#define LED_INIRQ 4 /* ON OFF */
+#define LED_SIGNAL 5 /* ON OFF */
+#define LED_ASSERTION 6 /* ON OFF */
+#define LED_PANIC 7 /* ON OFF */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+extern void lm3s_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+struct ether_addr;
+extern void lm3s_ethernetmac(struct ether_addr *ethaddr);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/lm3s6965-ek/nsh/Make.defs b/nuttx/configs/lm3s6965-ek/nsh/Make.defs
new file mode 100644
index 000000000..b25fa4bb6
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s6965-ek/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s6965-ek/nsh/appconfig b/nuttx/configs/lm3s6965-ek/nsh/appconfig
new file mode 100644
index 000000000..6277056d0
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nsh/appconfig
@@ -0,0 +1,58 @@
+############################################################################
+# configs/lm3s6965-ek/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig
new file mode 100755
index 000000000..145c992c9
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig
@@ -0,0 +1,344 @@
+############################################################################
+# configs/lm3s6965-ek/nsh/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S=y
+CONFIG_ARCH_CHIP_LM3S6965=y
+CONFIG_ARCH_BOARD="lm3s6965-ek"
+CONFIG_ARCH_BOARD_LM3S6965EK=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6965 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6965 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6965 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=n
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+CONFIG_NFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s6965-ek/nsh/ld.script b/nuttx/configs/lm3s6965-ek/nsh/ld.script
new file mode 100755
index 000000000..d3a0d668e
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nsh/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s6965-ek/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6965 has 256Kb of FLASH beginning at address 0x0000:0000 and 64Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s6965-ek/nsh/setenv.sh b/nuttx/configs/lm3s6965-ek/nsh/setenv.sh
new file mode 100755
index 000000000..0b9389f49
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s6965-ek/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s6965-ek/nx/Make.defs b/nuttx/configs/lm3s6965-ek/nx/Make.defs
new file mode 100644
index 000000000..388caffb6
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nx/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s6965-ek/nx/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s6965-ek/nx/appconfig b/nuttx/configs/lm3s6965-ek/nx/appconfig
new file mode 100644
index 000000000..69f92ce3a
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lm3s6965-ek/nx/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig
new file mode 100755
index 000000000..c6340c76b
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nx/defconfig
@@ -0,0 +1,411 @@
+############################################################################
+# configs/lm3s6965-ek/nx/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S=y
+CONFIG_ARCH_CHIP_LM3S6965=y
+CONFIG_ARCH_BOARD="lm3s6965-ek"
+CONFIG_ARCH_BOARD_LM3S6965EK=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6965 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6965 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6965 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General SPI interface configuration
+#
+CONFIG_SPI_CMDDATA=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_LCD_RITDEBUG=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=12
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=n
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=y
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=255
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=8
+CONFIG_NXTK_BORDERCOLOR2=4
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# RiT P14201 OLED Driver Configuration
+#
+CONFIG_LCD_P14201=y
+CONFIG_P14201_SPIMODE=2
+CONFIG_P14201_FREQUENCY=3500000
+CONFIG_P14201_NINTERFACES=1
+CONFIG_P14201_FRAMEBUFFER=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=2
+CONFIG_EXAMPLES_NX_COLOR1=10
+CONFIG_EXAMPLES_NX_COLOR2=12
+CONFIG_EXAMPLES_NX_TBCOLOR=8
+CONFIG_EXAMPLES_NX_FONTCOLOR=0
+CONFIG_EXAMPLES_NX_BPP=4
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=y
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s6965-ek/nx/ld.script b/nuttx/configs/lm3s6965-ek/nx/ld.script
new file mode 100755
index 000000000..dcb12fa99
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nx/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s6965-ek/nx/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6965 has 256Kb of FLASH beginning at address 0x0000:0000 and 64Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s6965-ek/nx/setenv.sh b/nuttx/configs/lm3s6965-ek/nx/setenv.sh
new file mode 100755
index 000000000..a364c2017
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/nx/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s6965-ek/nx/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s6965-ek/ostest/Make.defs b/nuttx/configs/lm3s6965-ek/ostest/Make.defs
new file mode 100644
index 000000000..74eed679e
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s6965-ek/ostest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s6965-ek/ostest/appconfig b/nuttx/configs/lm3s6965-ek/ostest/appconfig
new file mode 100644
index 000000000..dabf1f2b4
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lm3s6965-ek/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig
new file mode 100755
index 000000000..1ef498dd8
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig
@@ -0,0 +1,340 @@
+############################################################################
+# configs/lm3s6965-ek/ostest/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S=y
+CONFIG_ARCH_CHIP_LM3S6965=y
+CONFIG_ARCH_BOARD="lm3s6965-ek"
+CONFIG_ARCH_BOARD_LM3S6965EK=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S6965 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S6965 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S6965 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s6965-ek/ostest/ld.script b/nuttx/configs/lm3s6965-ek/ostest/ld.script
new file mode 100755
index 000000000..e330f35ae
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/ostest/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s6965-ek/ostest/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S6965 has 256Kb of FLASH beginning at address 0x0000:0000 and 64Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s6965-ek/ostest/setenv.sh b/nuttx/configs/lm3s6965-ek/ostest/setenv.sh
new file mode 100755
index 000000000..6e907ae7a
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s6965-ek/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s6965-ek/src/Makefile b/nuttx/configs/lm3s6965-ek/src/Makefile
new file mode 100644
index 000000000..90833fc31
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/Makefile
@@ -0,0 +1,90 @@
+############################################################################
+# configs/lm3s6965-ek/src/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_ethernet.c up_ssi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_NX_LCDDRIVER),y)
+CSRCS += up_oled.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lm3s6965-ek/src/README.txt b/nuttx/configs/lm3s6965-ek/src/README.txt
new file mode 100644
index 000000000..c392911de
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Stellaris LM3S6965 Evaluation Kit.
diff --git a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h
new file mode 100644
index 000000000..621f00148
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/lm3s6965-ek/src/lm3s6965ek_internal.h
+ * arch/arm/src/board/lm3s6965ek_internal.n
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_LM3S6965_EK_SRC_LM3S6965EK_INTERNAL_H
+#define __CONFIGS_LM3S6965_EK_SRC_LM3S6965EK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S6965 supports 1 SSI
+ * module (others may support more than 2 -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#elif LM3S_NSSI == 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#endif
+
+/* LM3S6965 Eval Kit ***************************************************************/
+
+/* GPIO Usage
+ *
+ * PIN SIGNAL EVB Function
+ * --- ----------- ---------------------------------------
+ * 26 PA0/U0RX Virtual COM port receive
+ * 27 PA1/U0TX Virtual COM port transmit
+ * 10 PD0/IDX0 SD card chip select
+ * 11 PD1/PWM1 Sound
+ * 30 PA4/SSI0RX SD card data out
+ * 31 PA5/SSI0TX SD card and OLED display data in
+ * 28 PA2/SSI0CLK SD card and OLED display clock
+ * 22 PC7/PHB0 OLED display data/control select
+ * 29 PA3/SSI0FSS OLED display chip select
+ * 73 PE1/PWM5 Down switch
+ * 74 PE2/PHB1 Left switch
+ * 72 PE0/PWM4 Up switch
+ * 75 PE3/PHA1 Right switch
+ * 61 PF1/IDX1 Select switch
+ * 47 PF0/PWM0 User LED
+ * 23 PC6/CCP3 Enable +15 V
+ */
+
+/* GPIO for microSD card chip select:
+ * - PD0: SD card chip select (CARDCSn)
+ */
+
+#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTD | 0)
+
+/* GPIO for single LED:
+ * - PF0: User LED
+ */
+
+#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | 0)
+
+/* GPIOs for OLED:
+ * - PC7: OLED display data/control select (D/Cn)
+ * - PA3: OLED display chip select (CSn)
+ * - PC6: Enable +15V needed by OLED (EN+15V)
+ */
+
+#define OLEDDC_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
+ GPIO_VALUE_ONE | GPIO_PORTC | 7)
+#define OLEDCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTA | 3)
+#define OLEDEN_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
+ GPIO_VALUE_ONE | GPIO_PORTC | 6)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_LM3S6965_EK_SRC_LM3S6965EK_INTERNAL_H */
+
diff --git a/nuttx/configs/lm3s6965-ek/src/up_boot.c b/nuttx/configs/lm3s6965-ek/src/up_boot.c
new file mode 100644
index 000000000..7f887be62
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/up_boot.c
@@ -0,0 +1,92 @@
+/************************************************************************************
+ * configs/lm3s6965-ek/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s6965ek_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void lm3s_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
+
+ /* The LM3S6965 Eval Kit microSD CS and OLED are on SSI0 (Duh! There is no SSI1) */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/lm3s6965-ek/src/up_ethernet.c b/nuttx/configs/lm3s6965-ek/src/up_ethernet.c
new file mode 100644
index 000000000..4f402cae7
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/up_ethernet.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/lm3s6965-ek/src/up_ethernet.c
+ * arch/arm/src/board/up_ethernet.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <arch/board/board.h>
+#include <net/ethernet.h>
+
+#include "up_arch.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+void lm3s_ethernetmac(struct ether_addr *ethaddr)
+{
+ uint32_t user0;
+ uint32_t user1;
+
+ /* Get the current value of the user registers */
+
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
+
+ nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff);
+ DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff);
+
+ /* Re-format that MAC address the way that uIP expects to see it */
+
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
+}
+#endif
diff --git a/nuttx/configs/lm3s6965-ek/src/up_leds.c b/nuttx/configs/lm3s6965-ek/src/up_leds.c
new file mode 100644
index 000000000..933c11446
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/up_leds.c
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * configs/lm3s6965-ek/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "lm3s6965ek_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_DEBUG
+# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+static uint8_t g_nest;
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ leddbg("Initializing\n");
+
+ /* Configure Port E, Bit 1 as an output, initial value=OFF */
+
+ led_dumpgpio("up_ledinit before lm3s_configgpio()");
+ lm3s_configgpio(LED_GPIO);
+ led_dumpgpio("up_ledinit after lm3s_configgpio()");
+ g_nest = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, false);
+ led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ if (--g_nest <= 0)
+ {
+ led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, true);
+ led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
+ }
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lm3s6965-ek/src/up_nsh.c b/nuttx/configs/lm3s6965-ek/src/up_nsh.c
new file mode 100644
index 000000000..409b351f0
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/up_nsh.c
@@ -0,0 +1,159 @@
+/****************************************************************************
+ * config/lm3s6965-ek/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LM3S6965EK
+# undef NSH_HAVEUSBDEV
+# define NSH_HAVEMMCSD 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 0
+# error "The LM3S6965 Eval Kit MMC/SD is on SSI0"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 0
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The LM3S6965 Eval Kit MMC/SD is on SSI0 slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LM3s boards here */
+# error "Unrecognized lm3s board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("nsh_archinitialize: Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/lm3s6965-ek/src/up_oled.c b/nuttx/configs/lm3s6965-ek/src/up_oled.c
new file mode 100644
index 000000000..586927d53
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/up_oled.c
@@ -0,0 +1,172 @@
+/****************************************************************************
+ * config/lm3s6965-ek/src/up_oled.c
+ * arch/arm/src/board/up_oled.c
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/p14201.h>
+
+#include "lm3s_internal.h"
+#include "lm3s6965ek_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Define the CONFIG_LCD_RITDEBUG to enable detailed debug output (stuff you
+ * would never want to see unless you are debugging this file).
+ *
+ * Verbose debug must also be enabled
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_LCD_RITDEBUG
+#endif
+
+#ifdef CONFIG_LCD_RITDEBUG
+# define ritdbg(format, arg...) vdbg(format, ##arg)
+# define oleddc_dumpgpio(m) lm3s_dumpgpio(OLEDDC_GPIO, m)
+# define oledcs_dumpgpio(m) lm3s_dumpgpio(OLEDCS_GPIO, m)
+#else
+# define ritdbg(x...)
+# define oleddc_dumpgpio(m)
+# define oledcs_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_nxdrvinit
+ *
+ * Description:
+ * Called by NX initialization logic to configure the OLED.
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
+{
+ FAR struct spi_dev_s *spi;
+ FAR struct lcd_dev_s *dev;
+
+ /* Configure the OLED GPIOs */
+
+ oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup");
+ oleddc_dumpgpio("up_nxdrvinit: On entry");
+
+ lm3s_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */
+ lm3s_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */
+
+ oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup");
+
+ /* Get the SSI port (configure as a Freescale SPI port) */
+
+ spi = up_spiinitialize(0);
+ if (!spi)
+ {
+ glldbg("Failed to initialize SSI port 0\n");
+ }
+ else
+ {
+ /* Bind the SSI port to the OLED */
+
+ dev = rit_initialize(spi, devno);
+ if (!dev)
+ {
+ glldbg("Failed to bind SSI port 0 to OLED %d: %d\n", devno);
+ }
+ else
+ {
+ gllvdbg("Bound SSI port 0 to OLED %d\n", devno);
+
+ /* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */
+
+ (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
+ return dev;
+ }
+ }
+ return NULL;
+}
+
+/******************************************************************************
+ * Name: lm3s_spicmddata
+ *
+ * Description:
+ * Set or clear the SD1329 D/Cn bit to select data (true) or command
+ * (false). This function must be provided by platform-specific logic.
+ * This is an implementation of the cmddata method of the SPI
+ * interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ *
+ * Input Parameters:
+ *
+ * spi - SPI device that controls the bus the device that requires the CMD/
+ * DATA selection.
+ * devid - If there are multiple devices on the bus, this selects which one
+ * to select cmd or data. NOTE: This design restricts, for example,
+ * one one SPI display per SPI bus.
+ * cmd - true: select command; false: select data
+ *
+ * Returned Value:
+ * None
+ *
+ ******************************************************************************/
+
+int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+ if (devid == SPIDEV_DISPLAY)
+ {
+ /* Set GPIO to 1 for data, 0 for command */
+
+ lm3s_gpiowrite(OLEDDC_GPIO, !cmd);
+ return OK;
+ }
+ return -ENODEV;
+}
diff --git a/nuttx/configs/lm3s6965-ek/src/up_ssi.c b/nuttx/configs/lm3s6965-ek/src/up_ssi.c
new file mode 100644
index 000000000..16111fcda
--- /dev/null
+++ b/nuttx/configs/lm3s6965-ek/src/up_ssi.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/lm3s6965-ek/src/up_ssi.c
+ * arch/arm/src/board/up_ssi.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lm3s_internal.h"
+#include "lm3s6965ek_internal.h"
+
+/* The LM3S6965 Eval Kit microSD CS is on SSI0 */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSI_DEBUG /* Define to enable debug */
+#undef SSI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# ifdef SSI_VERBOSE
+# define ssivdbg lldbg
+# else
+# define ssivdbg(x...)
+# endif
+#else
+# undef SSI_VERBOSE
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_VERBOSE
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssi_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssi_dumpgpio("lm3s_ssiinitialize() Entry)");
+ lm3s_configgpio(SDCCS_GPIO);
+#ifdef CONFIG_NX_LCDDRIVER
+ lm3s_configgpio(OLEDCS_GPIO);
+#endif
+ ssi_dumpgpio("lm3s_ssiinitialize() Exit");
+}
+
+/****************************************************************************
+ * The external functions, lm3s_spiselect and lm3s_spistatus must be provided
+ * by board-specific logic. The are implementations of the select and status
+ * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ * All othermethods (including up_spiinitialize()) are provided by common
+ * logic. To use this common SPI logic on your board:
+ *
+ * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your
+ * board-specific logic. This function will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 2. Add a call to up_spiinitialize() in your low level initialization
+ * logic
+ * 3. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssi_dumpgpio("lm3s_spiselect() Entry");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ }
+#ifdef CONFIG_NX_LCDDRIVER
+ else if (devid == SPIDEV_DISPLAY)
+ {
+ /* Assert the CS pin to the display */
+
+ lm3s_gpiowrite(OLEDCS_GPIO, !selected);
+ }
+#endif
+ ssi_dumpgpio("lm3s_spiselect() Exit");
+}
+
+uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */
diff --git a/nuttx/configs/lm3s8962-ek/Kconfig b/nuttx/configs/lm3s8962-ek/Kconfig
new file mode 100644
index 000000000..87dc03a9d
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LM3S8962EK
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/lm3s8962-ek/README.txt b/nuttx/configs/lm3s8962-ek/README.txt
new file mode 100644
index 000000000..c1e0b9fea
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/README.txt
@@ -0,0 +1,423 @@
+README
+^^^^^^
+
+README for NuttX port to the Stellaris LMS38962 Evaluation Kit
+
+Contents
+^^^^^^^^
+
+ Stellaris LMS38962 Evaluation Kit
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ USB Device Controller Functions
+ OLED
+ Stellaris LM3S8962 Evaluation Kit Configuration Options
+ Configurations
+
+Stellaris LMS38962 Evaluation Kit
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Stellaris LM3S8962 Evaluation Board includes the following features:
+
+ o Stellaris LM3S8962 microcontroller with fully-integrated 10/100 embedded
+ Ethernet controller
+ o Simple setup; USB cable provides serial communication, debugging, and
+ power
+ o OLED graphics display with 128 x 96 pixel resolution
+ o User LED, navigation switches, and select pushbuttons
+ o Magnetic speaker
+ o LM3S8962 I/O available on labeled break-out pads
+ o Standard ARM® 20-pin JTAG debug connector with input and output modes
+ o USB interface for debugging and power supply
+ o MicroSD card slot
+
+Features of the LM3S8962 Microcontroller
+
+ o 32-bit RISC performance using ARM® Cortex™-M3 v7M architecture
+ – 50-MHz operation
+ – Hardware-division and single-cycle-multiplication
+ – Integrated Nested Vectored Interrupt Controller (NVIC)
+ – 42 interrupt channels with eight priority levels
+ o 256 KB single-cycle flash
+ o 64 KB single-cycle SRAM
+ o Four general-purpose 32-bit timers
+ o Integrated Ethernet MAC and PHY
+ o Three fully programmable 16C550-type UARTs
+ o Four 10-bit channels (inputs) when used as single-ended inputs
+ o Two independent integrated analog comparators
+ o Two I2C modules
+ o Three PWM generator blocks
+ – One 16-bit counter
+ – Two comparators
+ – Produces two independent PWM signals
+ – One dead-band generator
+ o Two QEI modules with position integrator for tracking encoder position
+ o 0 to 42 GPIOs, depending on user configuration
+ o On-chip low drop-out (LDO) voltage regulator
+
+GPIO Usage
+
+PIN SIGNAL EVB Function
+--- ----------- ---------------------------------------
+ 26 PA0/U0RX Virtual COM port receive
+ 27 PA1/U0TX Virtual COM port transmit
+ 10 PD0/IDX0 SD card chip select
+ 11 PD1/PWM1 Sound
+ 30 PA4/SSI0RX SD card data out
+ 31 PA5/SSI0TX SD card and OLED display data in
+ 28 PA2/SSI0CLK SD card and OLED display clock
+ 22 PC7/PHB0 OLED display data/control select
+ 29 PA3/SSI0FSS OLED display chip select
+ 73 PE1/PWM5 Down switch
+ 74 PE2/PHB1 Left switch
+ 72 PE0/PWM4 Up switch
+ 75 PE3/PHA1 Right switch
+ 61 PF1/IDX1 Select switch
+ 47 PF0/PWM0 User LED
+ 23 PC6/CCP3 Enable +15 V
+
+OLED
+^^^^
+
+ The Evaluation Kit includes an OLED graphics display. Features:
+
+ - RiT P14201 series display
+ - 128 columns by 96 rows
+ - 4-bit, 16-level gray scale.
+ - High-contrast (typ. 500:1)
+ - Excellent brightness (120 cd/m2)
+ - Fast 10 us response.
+
+ The OLED display has a built-in controller IC with synchronous serial and
+ parallel interfaces (SSD1329). Synchronous serial (SSI) is used on the EVB.
+ The SSI port is shared with the microSD card slot.
+
+ - PC7: OLED display data/control select (D/Cn)
+ - PA3: OLED display chip select (CSn)
+
+ NOTE: Newer versions of the LM3S8962 Evaluation Kit has an OSAM 128x64x4 OLED
+ display. Some tweaks to drivers/lcd/p14201.c would be required to support that
+ LCD.
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM, you simply need to add one of the following
+ configuration options to your .config (or defconfig) file:
+
+ CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or Linux
+ native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project. Here are a few tip before you
+ start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lm3s,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lm3s/lm3s_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lm3s8962-ek/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+USB Device Controller Functions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ Device Overview
+
+ An FT2232 device from Future Technology Devices International Ltd manages
+ USB-to-serial conversion. The FT2232 is factory configured by Luminary
+ Micro to implement a JTAG/SWD port (synchronous serial) on channel A and
+ a Virtual COM Port (VCP) on channel B. This feature allows two simultaneous
+ communications links between the host computer and the target device using
+ a single USB cable. Separate Windows drivers for each function are provided
+ on the Documentation and Software CD.
+
+ Debugging with JTAG/SWD
+
+ The FT2232 USB device performs JTAG/SWD serial operations under the control
+ of the debugger or the Luminary Flash Programmer. It also operate as an
+ In-Circuit Debugger Interface (ICDI), allowing debugging of any external
+ target board. Debugging modes:
+
+ MODE DEBUG FUNCTION USE SELECTED BY
+ 1 Internal ICDI Debug on-board LM3S8962 Default Mode
+ microcontroller over USB
+ interface.
+ 2 ICDI out to JTAG/SWD The EVB is used as a USB Connecting to an external
+ header to SWD/JTAG interface to target and starting debug
+ an external target. software. The red Debug Out
+ LED will be ON.
+ 3 In from JTAG/SWD For users who prefer an Connecting an external
+ header external debug interface debugger to the JTAG/SWD
+ (ULINK, JLINK, etc.) with header.
+ the EVB.
+
+ Virtual COM Port
+
+ The Virtual COM Port (VCP) allows Windows applications (such as HyperTerminal)
+ to communicate with UART0 on the LM3S8962 over USB. Once the FT2232 VCP
+ driver is installed, Windows assigns a COM port number to the VCP channel.
+
+Stellaris LM3S8962 Evaluation Kit Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lm3s
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LM3S8962
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=lm3s8962-ek (for the Stellaris LM3S8962 Evaluation Kit)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LM3S8962EK
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ There are configurations for disabling support for interrupts GPIO ports.
+ GPIOJ must be disabled because it does not exist on the LM3S6918.
+ Additional interrupt support can be disabled if desired to reduce memory
+ footprint.
+
+ CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOH_IRQS=n
+ CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+ LM3S6818 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ CONFIG_SSI0_DISABLE - Select to disable support for SSI0
+ CONFIG_SSI1_DISABLE - Select to disable support for SSI1
+ CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support.
+ Poll-waiting is recommended if the interrupt rate would be to
+ high in the interrupt driven case.
+ CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before
+ emptying the Rx FIFO. If the SPI frequency is high and this
+ value is large, then larger values of this setting may cause
+ Rx FIFO overrun errors. Default: half of the Tx FIFO size (4).
+
+ CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
+ to build the LM3S Ethernet driver
+ CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
+ CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide
+ a MAC address (via lm3s_ethernetmac()), then this should be selected.
+ CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation
+ CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation
+ CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding
+ CONFIG_LM3S_MULTICAST - Set to enable multicast frames
+ CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode
+ CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection.
+ CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Stellaris LM3S8962 Evaluation Kit configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh lm3s8962-ek/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+ NOTE: As it is configured now, you MUST have a network connected.
+ Otherwise, the NSH prompt will not come up because the Ethernet
+ driver is waiting for the network to come up. That is probably
+ a bug in the Ethernet driver behavior!
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+
diff --git a/nuttx/configs/lm3s8962-ek/include/README.txt b/nuttx/configs/lm3s8962-ek/include/README.txt
new file mode 100644
index 000000000..5a0ffe9e6
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Stellaris LM3S8962 Evaluation Kit.
diff --git a/nuttx/configs/lm3s8962-ek/include/board.h b/nuttx/configs/lm3s8962-ek/include/board.h
new file mode 100644
index 000000000..0b03f96f0
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/include/board.h
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* RCC settings */
+
+#define SYSCON_RCC_XTAL SYSCON_RCC_XTAL8000KHZ /* Eagle100 on-board crystall is 8.00 MHz */
+#define XTAL_FREQUENCY 8000000
+
+/* Oscillator source is the main oscillator (not internal, internal/4, 30KHz or
+ * 30KHz from hibernate module) */
+
+#define SYSCON_RCC_OSCSRC SYSCON_RCC_OSCSRC_MOSC
+#define SYSCON_RCC2_OSCSRC SYSCON_RCC2_OSCSRC2_MOSC
+#define OSCSRC_FREQUENCY XTAL_FREQUENCY
+
+/* Use system divider = 4; this corresponds to a system clock frequency
+ * of (400 / 2) / 4 = 50MHz
+ */
+
+#define LM3S_SYSDIV 4
+#define SYSCLK_FREQUENCY 50000000 /* 50MHz */
+
+/* Other RCC settings:
+ *
+ * - Main and internal oscillators enabled.
+ * - PLL and sys dividers not bypassed
+ * - PLL not powered down
+ * - No auto-clock gating reset
+ */
+
+#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV))
+
+/* RCC2 settings -- RCC2 not used. Other RCC2 settings
+ *
+ * - PLL and sys dividers not bypassed.
+ * - PLL not powered down
+ * - Not using RCC2
+ */
+
+#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV))
+
+/* LED definitions ******************************************************************/
+
+/* The LMS38962 Eval Kit has only one user LED: Port F, Bit 0. Below is the mapping of this
+ * single LED. From this single LED, we can get the following information:
+ *
+ * OFF Steady: The system has failed to boot to the point of enabling interrupts
+ * ON Steady: The systems has enabled interrupts, but none have been received
+ * Dull glow: The system is taking interrupts
+ * Slow blinking: The system has panicked
+ */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* OFF OFF */
+#define LED_IRQSENABLED 2 /* ON ON */
+#define LED_STACKCREATED 3 /* ON ON */
+#define LED_INIRQ 4 /* ON OFF */
+#define LED_SIGNAL 5 /* ON OFF */
+#define LED_ASSERTION 6 /* ON OFF */
+#define LED_PANIC 7 /* ON OFF */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+extern void lm3s_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+struct ether_addr;
+extern void lm3s_ethernetmac(struct ether_addr *ethaddr);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/lm3s8962-ek/nsh/Make.defs b/nuttx/configs/lm3s8962-ek/nsh/Make.defs
new file mode 100644
index 000000000..cd183ed15
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s8962-ek/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s8962-ek/nsh/appconfig b/nuttx/configs/lm3s8962-ek/nsh/appconfig
new file mode 100644
index 000000000..5eeb56607
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nsh/appconfig
@@ -0,0 +1,58 @@
+############################################################################
+# configs/lm3s8962-ek/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlibO
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/lm3s8962-ek/nsh/defconfig b/nuttx/configs/lm3s8962-ek/nsh/defconfig
new file mode 100755
index 000000000..439165c90
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nsh/defconfig
@@ -0,0 +1,342 @@
+############################################################################
+# configs/lm3s8962-ek/nsh/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S8962=y
+CONFIG_ARCH_BOARD="lm3s8962-ek"
+CONFIG_ARCH_BOARD_LM3S8962EK=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S8962 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S8962 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S8962 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=n
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s8962-ek/nsh/ld.script b/nuttx/configs/lm3s8962-ek/nsh/ld.script
new file mode 100755
index 000000000..fdf7c8968
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nsh/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s8962-ek/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S8962 has 256Kb of FLASH beginning at address 0x0000:0000 and 64Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s8962-ek/nsh/setenv.sh b/nuttx/configs/lm3s8962-ek/nsh/setenv.sh
new file mode 100755
index 000000000..4ed5385b6
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s8962-ek/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s8962-ek/nx/Make.defs b/nuttx/configs/lm3s8962-ek/nx/Make.defs
new file mode 100644
index 000000000..841773477
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nx/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s8962-ek/nx/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s8962-ek/nx/appconfig b/nuttx/configs/lm3s8962-ek/nx/appconfig
new file mode 100644
index 000000000..ace182b62
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lm3s8962-ek/nx/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/lm3s8962-ek/nx/defconfig b/nuttx/configs/lm3s8962-ek/nx/defconfig
new file mode 100755
index 000000000..823d62ae9
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nx/defconfig
@@ -0,0 +1,409 @@
+############################################################################
+# configs/lm3s8962-ek/nx/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S8962=y
+CONFIG_ARCH_BOARD="lm3s8962-ek"
+CONFIG_ARCH_BOARD_LM3S8962EK=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S8962 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S8962 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S8962 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General SPI interface configuration
+#
+CONFIG_SPI_CMDDATA=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_LCD_RITDEBUG=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=12
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=n
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=y
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=255
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=8
+CONFIG_NXTK_BORDERCOLOR2=4
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+# RiT P14201 OLED Driver Configuration
+#
+CONFIG_LCD_P14201=y
+CONFIG_P14201_SPIMODE=2
+CONFIG_P14201_FREQUENCY=3500000
+CONFIG_P14201_NINTERFACES=1
+CONFIG_P14201_FRAMEBUFFER=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=2
+CONFIG_EXAMPLES_NX_COLOR1=10
+CONFIG_EXAMPLES_NX_COLOR2=12
+CONFIG_EXAMPLES_NX_TBCOLOR=8
+CONFIG_EXAMPLES_NX_FONTCOLOR=0
+CONFIG_EXAMPLES_NX_BPP=4
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=y
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s8962-ek/nx/ld.script b/nuttx/configs/lm3s8962-ek/nx/ld.script
new file mode 100755
index 000000000..71f0be6c5
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nx/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s8962-ek/nx/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S8962 has 256Kb of FLASH beginning at address 0x0000:0000 and 64Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s8962-ek/nx/setenv.sh b/nuttx/configs/lm3s8962-ek/nx/setenv.sh
new file mode 100755
index 000000000..4c76fd736
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/nx/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s8962-ek/nx/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s8962-ek/ostest/Make.defs b/nuttx/configs/lm3s8962-ek/ostest/Make.defs
new file mode 100644
index 000000000..914e96eb6
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/lm3s8962-ek/ostest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LM3S_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LM3S_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LM3S_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lm3s8962-ek/ostest/appconfig b/nuttx/configs/lm3s8962-ek/ostest/appconfig
new file mode 100644
index 000000000..f7475bced
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lm3s8962-ek/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/lm3s8962-ek/ostest/defconfig b/nuttx/configs/lm3s8962-ek/ostest/defconfig
new file mode 100755
index 000000000..291f4e1f2
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/ostest/defconfig
@@ -0,0 +1,339 @@
+############################################################################
+# configs/lm3s8962-ek/ostest/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lm3s"
+CONFIG_ARCH_CHIP_LM3S8962=y
+CONFIG_ARCH_BOARD="lm3s8962-ek"
+CONFIG_ARCH_BOARD_LM3S8962EK=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LM3S_CODESOURCERYW=n
+CONFIG_LM3S_CODESOURCERYL=n
+CONFIG_LM3S_DEVKITARM=n
+CONFIG_LM3S_BUILDROOT=y
+CONFIG_LM3S_DFU=y
+
+#
+# Disable support for interrupts on GPIOH and GPIOJ which do not
+# exist on the LM3S6B96. Additional interrupt support can be
+# disabled if desired to reduce memory footprint.
+CONFIG_LM3S_DISABLE_GPIOA_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOB_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOC_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOD_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOE_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOF_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOG_IRQS=n
+CONFIG_LM3S_DISABLE_GPIOH_IRQS=y
+CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y
+
+#
+# LM3S8962 specific serial device driver settings
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# LM3S8962 specific SSI device driver settings
+#
+CONFIG_SSI0_DISABLE=n
+CONFIG_SSI1_DISABLE=y
+CONFIG_SSI_POLLWAIT=y
+#CONFIG_SSI_TXLIMIT=4
+
+#
+# LM3S8962 specific serial device driver settings
+#
+CONFIG_LM3S_ETHERNET=n
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+CONFIG_LM3S_ETHHDUPLEX=n
+CONFIG_LM3S_ETHNOAUTOCRC=n
+CONFIG_LM3S_ETHNOPAD=n
+CONFIG_LM3S_MULTICAST=n
+CONFIG_LM3S_PROMISCUOUS=n
+CONFIG_LM3S_BADCRC=n
+CONFIG_LM3S_DUMPPACKET=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lm3s8962-ek/ostest/ld.script b/nuttx/configs/lm3s8962-ek/ostest/ld.script
new file mode 100755
index 000000000..6aa9f5f37
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/ostest/ld.script
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/lm3s8962-ek/ostest/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LM3S8962 has 256Kb of FLASH beginning at address 0x0000:0000 and 64Kb
+ * of SRAM beginning at 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lm3s8962-ek/ostest/setenv.sh b/nuttx/configs/lm3s8962-ek/ostest/setenv.sh
new file mode 100755
index 000000000..b5ee8be31
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/lm3s8962-ek/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lm3s8962-ek/src/Makefile b/nuttx/configs/lm3s8962-ek/src/Makefile
new file mode 100644
index 000000000..2d44db56c
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/Makefile
@@ -0,0 +1,90 @@
+############################################################################
+# configs/lm3s8962-ek/src/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_ethernet.c up_ssi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_NX_LCDDRIVER),y)
+CSRCS += up_oled.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lm3s8962-ek/src/README.txt b/nuttx/configs/lm3s8962-ek/src/README.txt
new file mode 100644
index 000000000..a84733cc0
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Stellaris LM3S8962 Evaluation Kit.
diff --git a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h
new file mode 100644
index 000000000..3b6175661
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/lm3s8962ek_internal.h
+ * arch/arm/src/board/lm3s8962ek_internal.n
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H
+#define __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S8962 supports 1 SSI
+ * module (others may support more than 2 -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#elif LM3S_NSSI == 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#endif
+
+/* LM3S8962 Eval Kit ***************************************************************/
+
+/* GPIO Usage
+ *
+ * PIN SIGNAL EVB Function
+ * --- ----------- ---------------------------------------
+ * 26 PA0/U0RX Virtual COM port receive
+ * 27 PA1/U0TX Virtual COM port transmit
+ * 10 PD0/IDX0 SD card chip select
+ * 11 PD1/PWM1 Sound
+ * 30 PA4/SSI0RX SD card data out
+ * 31 PA5/SSI0TX SD card and OLED display data in
+ * 28 PA2/SSI0CLK SD card and OLED display clock
+ * 22 PC7/PHB0 OLED display data/control select
+ * 29 PA3/SSI0FSS OLED display chip select
+ * 73 PE1/PWM5 Down switch
+ * 74 PE2/PHB1 Left switch
+ * 72 PE0/PWM4 Up switch
+ * 75 PE3/PHA1 Right switch
+ * 61 PF1/IDX1 Select switch
+ * 47 PF0/PWM0 User LED
+ * 23 PC6/CCP3 Enable +15 V
+ */
+
+/* GPIO for microSD card chip select:
+ * - PD0: SD card chip select (CARDCSn)
+ */
+
+#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTD | 0)
+
+/* GPIO for single LED:
+ * - PF0: User LED
+ */
+
+#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | 0)
+
+/* GPIOs for OLED:
+ * - PC7: OLED display data/control select (D/Cn)
+ * - PA3: OLED display chip select (CSn)
+ * - PC6: Enable +15V needed by OLED (EN+15V)
+ */
+
+#define OLEDDC_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
+ GPIO_VALUE_ONE | GPIO_PORTC | 7)
+#define OLEDCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTA | 3)
+#define OLEDEN_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
+ GPIO_VALUE_ONE | GPIO_PORTC | 6)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S8962 Eval Kit.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H */
+
diff --git a/nuttx/configs/lm3s8962-ek/src/up_boot.c b/nuttx/configs/lm3s8962-ek/src/up_boot.c
new file mode 100644
index 000000000..0a976e857
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_boot.c
@@ -0,0 +1,92 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_boardinitialize
+ *
+ * Description:
+ * All LM3S architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void lm3s_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
+
+ /* The LM3S8962 Eval Kit microSD CS and OLED are on SSI0 (Duh! There is no SSI1) */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/lm3s8962-ek/src/up_ethernet.c b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c
new file mode 100644
index 000000000..2cad50bef
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/up_ethernet.c
+ * arch/arm/src/board/up_ethernet.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <arch/board/board.h>
+#include <net/ethernet.h>
+
+#include "up_arch.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ethernetmac
+ *
+ * Description:
+ * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile
+ * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function
+ * will obtain the MAC address from these registers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LM3S_BOARDMAC
+void lm3s_ethernetmac(struct ether_addr *ethaddr)
+{
+ uint32_t user0;
+ uint32_t user1;
+
+ /* Get the current value of the user registers */
+
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
+
+ nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff);
+ DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff);
+
+ /* Re-format that MAC address the way that uIP expects to see it */
+
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
+}
+#endif
diff --git a/nuttx/configs/lm3s8962-ek/src/up_leds.c b/nuttx/configs/lm3s8962-ek/src/up_leds.c
new file mode 100644
index 000000000..bff920434
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_leds.c
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * configs/lm3s8962-ek/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "lm3s_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_DEBUG
+# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+static uint8_t g_nest;
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ leddbg("Initializing\n");
+
+ /* Configure Port E, Bit 1 as an output, initial value=OFF */
+
+ led_dumpgpio("up_ledinit before lm3s_configgpio()");
+ lm3s_configgpio(LED_GPIO);
+ led_dumpgpio("up_ledinit after lm3s_configgpio()");
+ g_nest = 0;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, false);
+ led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ if (--g_nest <= 0)
+ {
+ led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
+ lm3s_gpiowrite(LED_GPIO, true);
+ led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
+ }
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lm3s8962-ek/src/up_nsh.c b/nuttx/configs/lm3s8962-ek/src/up_nsh.c
new file mode 100644
index 000000000..693862184
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_nsh.c
@@ -0,0 +1,159 @@
+/****************************************************************************
+ * config/lm3s8962-ek/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LM3S8962EK
+# undef NSH_HAVEUSBDEV
+# define NSH_HAVEMMCSD 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 0
+# error "The LM3S8962 Eval Kit MMC/SD is on SSI0"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 0
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The LM3S8962 Eval Kit MMC/SD is on SSI0 slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LM3s boards here */
+# error "Unrecognized lm3s board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("nsh_archinitialize: Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/lm3s8962-ek/src/up_oled.c b/nuttx/configs/lm3s8962-ek/src/up_oled.c
new file mode 100644
index 000000000..761187279
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_oled.c
@@ -0,0 +1,172 @@
+/****************************************************************************
+ * config/lm3s8962-ek/src/up_oled.c
+ * arch/arm/src/board/up_oled.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/p14201.h>
+
+#include "lm3s_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Define the CONFIG_LCD_RITDEBUG to enable detailed debug output (stuff you
+ * would never want to see unless you are debugging this file).
+ *
+ * Verbose debug must also be enabled
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_LCD_RITDEBUG
+#endif
+
+#ifdef CONFIG_LCD_RITDEBUG
+# define ritdbg(format, arg...) vdbg(format, ##arg)
+# define oleddc_dumpgpio(m) lm3s_dumpgpio(OLEDDC_GPIO, m)
+# define oledcs_dumpgpio(m) lm3s_dumpgpio(OLEDCS_GPIO, m)
+#else
+# define ritdbg(x...)
+# define oleddc_dumpgpio(m)
+# define oledcs_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_nxdrvinit
+ *
+ * Description:
+ * Called NX initialization logic to configure the OLED.
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
+{
+ FAR struct spi_dev_s *spi;
+ FAR struct lcd_dev_s *dev;
+
+ /* Configure the OLED GPIOs */
+
+ oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup");
+ oleddc_dumpgpio("up_nxdrvinit: On entry");
+
+ lm3s_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */
+ lm3s_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */
+
+ oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup");
+
+ /* Get the SSI port (configure as a Freescale SPI port) */
+
+ spi = up_spiinitialize(0);
+ if (!spi)
+ {
+ glldbg("Failed to initialize SSI port 0\n");
+ }
+ else
+ {
+ /* Bind the SSI port to the OLED */
+
+ dev = rit_initialize(spi, devno);
+ if (!dev)
+ {
+ glldbg("Failed to bind SSI port 0 to OLED %d: %d\n", devno);
+ }
+ else
+ {
+ gllvdbg("Bound SSI port 0 to OLED %d\n", devno);
+
+ /* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */
+
+ (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
+ return dev;
+ }
+ }
+ return NULL;
+}
+
+/******************************************************************************
+ * Name: lm3s_spicmddata
+ *
+ * Description:
+ * Set or clear the SD1329 D/Cn bit to select data (true) or command
+ * (false). This function must be provided by platform-specific logic.
+ * This is an implementation of the cmddata method of the SPI
+ * interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ *
+ * Input Parameters:
+ *
+ * spi - SPI device that controls the bus the device that requires the CMD/
+ * DATA selection.
+ * devid - If there are multiple devices on the bus, this selects which one
+ * to select cmd or data. NOTE: This design restricts, for example,
+ * one one SPI display per SPI bus.
+ * cmd - true: select command; false: select data
+ *
+ * Returned Value:
+ * None
+ *
+ ******************************************************************************/
+
+int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+ if (devid == SPIDEV_DISPLAY)
+ {
+ /* Set GPIO to 1 for data, 0 for command */
+
+ lm3s_gpiowrite(OLEDDC_GPIO, !cmd);
+ return OK;
+ }
+ return -ENODEV;
+}
diff --git a/nuttx/configs/lm3s8962-ek/src/up_ssi.c b/nuttx/configs/lm3s8962-ek/src/up_ssi.c
new file mode 100644
index 000000000..00e07c85d
--- /dev/null
+++ b/nuttx/configs/lm3s8962-ek/src/up_ssi.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/lm3s8962-ek/src/up_ssi.c
+ * arch/arm/src/board/up_ssi.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lm3s_internal.h"
+#include "lm3s8962ek_internal.h"
+
+/* The LM3S8962 Eval Kit microSD CS is on SSI0 */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSI_DEBUG /* Define to enable debug */
+#undef SSI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# ifdef SSI_VERBOSE
+# define ssivdbg lldbg
+# else
+# define ssivdbg(x...)
+# endif
+#else
+# undef SSI_VERBOSE
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_VERBOSE
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssi_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S8962 Eval Kit.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssi_dumpgpio("lm3s_ssiinitialize() Entry)");
+ lm3s_configgpio(SDCCS_GPIO);
+#ifdef CONFIG_NX_LCDDRIVER
+ lm3s_configgpio(OLEDCS_GPIO);
+#endif
+ ssi_dumpgpio("lm3s_ssiinitialize() Exit");
+}
+
+/****************************************************************************
+ * The external functions, lm3s_spiselect and lm3s_spistatus must be provided
+ * by board-specific logic. The are implementations of the select and status
+ * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ * All othermethods (including up_spiinitialize()) are provided by common
+ * logic. To use this common SPI logic on your board:
+ *
+ * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your
+ * board-specific logic. This function will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 2. Add a call to up_spiinitialize() in your low level initialization
+ * logic
+ * 3. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssi_dumpgpio("lm3s_spiselect() Entry");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ }
+#ifdef CONFIG_NX_LCDDRIVER
+ else if (devid == SPIDEV_DISPLAY)
+ {
+ /* Assert the CS pin to the display */
+
+ lm3s_gpiowrite(OLEDCS_GPIO, !selected);
+ }
+#endif
+ ssi_dumpgpio("lm3s_spiselect() Exit");
+}
+
+uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */
diff --git a/nuttx/configs/lpc4330-xplorer/Kconfig b/nuttx/configs/lpc4330-xplorer/Kconfig
new file mode 100644
index 000000000..82597636d
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LPC4330_XPLORER
+endif
diff --git a/nuttx/configs/lpc4330-xplorer/README.txt b/nuttx/configs/lpc4330-xplorer/README.txt
new file mode 100644
index 000000000..cc15746d4
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/README.txt
@@ -0,0 +1,949 @@
+README
+======
+
+README for NuttX port to the LPC4330-Xplorer board from NGX Technologies
+featuring the NXP LPC4330FET100 MCU
+
+Contents
+========
+
+ - LPC4330-Xplorer development board
+ - Status
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - Code Red IDE/Tools
+ Booting the LPCLink
+ Using GDB
+ Troubleshooting
+ Command Line Flash Programming
+ Executing from SPIFI
+ USB DFU Booting
+ - NuttX buildroot Toolchain
+ - Serial Console
+ - FPU
+ - LPC4330-Xplorer Configuration Options
+ - Configurations
+
+LPC4330-Xplorer board
+=====================
+
+ Memory Map
+ ----------
+
+ Block Start Length
+ Name Address
+ --------------------- ---------- ------
+ RAM 0x10000000 128K
+ RAM2 0x10080000 72K
+ RAMAHB 0x20000000 32K
+ RAMAHB2 0x20008000 16K
+ RAMAHB3 0x2000c000 16K
+ SPIFI flash 0x1e000000 4096K
+
+ GPIO Usage:
+ -----------
+
+ GPIO PIN SIGNAL NAME
+ -------------------------------- ------- --------------
+ gpio1[12] - LED D2 J10-20 LED1
+ gpio1[11] - LED D3 J10-17 LED2
+ gpio0[7] - User Button SW2 J8-25 BTN1
+
+ Console
+ -------
+
+ The LPC4330-Xplorer default console is the USB1 virtual COM port (VCOM).
+
+Status
+======
+
+ This is the current status of the LPC43xx port:
+
+ - The basic OS test configuration and the basic NSH configurations
+ are present and fully verified. This includes: SYSTICK system time,
+ pin and GPIO configuration, and serial console support. A SPIFI
+ MTD driver is also in place but requires further verification.
+
+ - The following drivers have been copied from the LPC17xx port, but
+ require integration into the LPC43xx. This integration should
+ consist of:
+
+ - Remove LPC17xx power, clocking, and pin configuration logic.
+ - Adding of clock source and frequency to the board.h file.
+ - Adding of LPC43 clock connection and pin configuration logic.
+
+ Within any luck, these drivers should come up very quickly:
+
+ - lpc43_adc.c,
+ - lpc43_dac.c,
+ - lpc43_gpdma.c,
+ - lpc43_i2c.c,
+ - lpc43_spi.c, and
+ - lpc43_ssp.c
+
+ These LPC17xx drivers were not brought into the LPC43xx port because
+ it appears the these peripherals have been completely redesigned:
+
+ - CAN,
+ - Ethernet,
+ - USB device, and
+ - USB host.
+
+ The following LPC43xx peripherals are unsupported. Some may be
+ compatible with the LPC17xx, but there is no LPC17xx driver to be
+ ported:
+
+ - SD/MMC,
+ - EMC,
+ - USB0,
+ - USB1,
+ - Ethernet,
+ - LCD,
+ - SCT,
+ - Timers 0-3
+ - MCPWM,
+ - QEI,
+ - Alarm timer,
+ - WWDT,
+ - RTC,
+ - Event monitor, and
+ - CAN,
+
+ For the missing drivers some of these can be leveraged from other
+ MCUs that appear to support the same peripheral IP.
+
+ - USB0 appears to be the same as the USB OTG peripheral for the
+ LPC31xx. It should be possible to drop in the LPC31xx driver
+ with a small porting effort.
+
+ - The Ethernet block looks to be based on the same IP as the
+ STM32 Ethernet and, as a result, it should be possible to leverage
+ the STM32 Ethernet driver with a little more effort.
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+=====================
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The Code Red GNU toolchain,
+ 2. The CodeSourcery GNU toolchain,
+ 3. The Atollic Toolchain,
+ 4. The devkitARM GNU toolchain,
+ 5. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM toolchain, you simply need add one of the
+ following configuration options to your .config (or defconfig) file:
+
+ CONFIG_LPC43_CODEREDW=y : Code Red "RedSuite" under Windows
+ CONFIG_LPC43_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC43_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC43_ATOLLIC_LITE=y : The free, "Lite" version of Atollic toolchain under Windows
+ CONFIG_LPC43_ATOLLIC_PRO=y : The paid, "Pro" version of Atollic toolchain under Windows
+ CONFIG_LPC43_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC43_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC43_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the Code Red, CodeSourcery (for Windows), Atollic and devkitARM toolchains
+ are Windows native toolchains. The CodeSourcery (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ The CodeSourcery Toolchain (2009q1)
+ -----------------------------------
+ The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ The Atollic "Pro" and "Lite" Toolchain
+ --------------------------------------
+ One problem that I had with the Atollic toolchains is that the provide a gcc.exe
+ and g++.exe in the same bin/ file as their ARM binaries. If the Atollic bin/ path
+ appears in your PATH variable before /usr/bin, then you will get the wrong gcc
+ when you try to build host executables. This will cause to strange, uninterpretable
+ errors build some host binaries in tools/ when you first make.
+
+ Also, the Atollic toolchains are the only toolchains that have built-in support for
+ the FPU in these configurations. If you plan to use the Cortex-M4 FPU, you will
+ need to use the Atollic toolchain for now. See the FPU section below for more
+ information.
+
+ The Atollic "Lite" Toolchain
+ ----------------------------
+ The free, "Lite" version of the Atollic toolchain does not support C++ nor
+ does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
+ toolchain, you will have to set:
+
+ CONFIG_HAVE_CXX=n
+
+ In order to compile successfully. Otherwise, you will get errors like:
+
+ "C++ Compiler only available in TrueSTUDIO Professional"
+
+ The make may then fail in some of the post link processing because of some of
+ the other missing tools. The Make.defs file replaces the ar and nm with
+ the default system x86 tool versions and these seem to work okay. Disable all
+ of the following to avoid using objcopy:
+
+ CONFIG_RRLOAD_BINARY=n
+ CONFIG_INTELHEX_BINARY=n
+ CONFIG_MOTOROLA_SREC=n
+ CONFIG_RAW_BINARY=n
+
+ devkitARM
+ ---------
+ The devkitARM toolchain includes a version of MSYS make. Make sure that the
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project .
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc43xx,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/common/up_vectors.S.
+
+Code Red IDE/Tools
+^^^^^^^^^^^^^^^^^^
+
+ Booting the LPCLink
+ -------------------
+
+ The first step is to activate the LPCLink's boot mode. Some general
+ instructions to do this are provided here:
+
+ http://support.code-red-tech.com/CodeRedWiki/BootingLPCLink
+
+ For my RedSuite installation path, that can be done using the following
+ steps in a Cygwin bash shell:
+
+ $ /cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin/Scripts/bootLPCXpresso.cmd winusb
+ Booting LPC-Link with LPCXpressoWIN.enc
+ Press any key to continue . . .
+
+ The same file logic can be found the less restrictive LPCXpresso package at:
+
+ /cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin
+
+ (The "free" RedSuite version has a download limit of 8K; the "free" LPCXpresso
+ version has a download limit of 128K).
+
+ NOTE that the following alias is defined in the setenv.sh file and
+ can be used to enter the boot mode with a simpler command:
+
+ alias lpc43xx='${SCRIPT_BIN}/Scripts/bootLPCXpresso.cmd winusb'
+
+ Be default, the setenv.sh scripts uses the LPCXpresso path shown above.
+ Once setenv.sh has been sources, then entering boot mode becomes simply:
+
+ $ lpc43xx
+ Booting LPC-Link with LPCXpressoWIN.enc
+ Press any key to continue . . .
+
+ Using GDB
+ ---------
+
+ The underlying debugger within Red Suite/LPCXpresso is GDB. That GDB
+ used from the command line. The GDB configuration details for command
+ line use are on Code Red Wiki:
+
+ http://support.code-red-tech.com/CodeRedWiki/UsingGDB
+
+ and is also summarized here (see the full Wiki for additional details
+ and options).
+
+ The Code Red Debug Driver implements the GDB "remote" protocol to allow
+ connection to debug targets. To start a debug session using GDB, use
+ following steps:
+
+ arm-none-eabi-gdb executable.axf : Start GDB and name the debug image
+ target extended-remote | <debug driver> <options> : Start debug driver, connect to target
+ load : Load image and download to target
+
+ The where <debug driver> is crt_emu_lpc18_43_nxp for LPC18xx and LPC43xx.
+ Your PATH variable should be set up so that the debug driver executable
+ can be found. For my installation, the driver for the LPC18xx and LPC43xx
+ is located at:
+
+ /cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin/crt_emu_lpc18_43_nxp.exe, OR
+ /cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin/crt_emu_lpc18_43_nxp.exe
+
+ And <options> are:
+
+ -n set information level for the debug driver. n should be 2, 3 or 4.
+ 2 should be sufficient in most circumstances
+
+ -p<part> is the target device to connect to and you should use
+ <part>=LPC4330.
+
+ -wire=<probe> specifies the debug probe. For LPCLink on Windows 7 use
+ <probe>=winusb. The 128K free version only supports the LPC-Link
+ and RedProbe debug probes. Other JTAG interfaces are supported in
+ the full version.
+
+ Thus the correct invocation for the LPC4330 under Windows7 would be:
+
+ target extended-remote | crt_emu_lpc18_43_nxp -2 -pLPC4330 -wire=winusb
+
+ DDD. This command can be used to start GDB under the graphics front-end
+ DDD:
+
+ $ ddd --debugger arm-none-eabi-gdb nuttx &
+
+ NOTE 1: Don't forget to put the LPCLink in boot mode as described above
+ before starting GDB. So a typical session might look like this:
+
+ $ lpc43xx
+ Booting LPC-Link with LPCXpressoWIN.enc
+ Press any key to continue . . .
+
+ $ arm-none-eabi-gdb nuttx
+ (gdb) target extended-remote | crt_emu_lpc18_43_nxp -2 -pLPC4330 -wire=winusb
+ (gdb) load
+ (gdb) r
+ (gdb) c
+
+ NOTE 2: Don't forget to enable CONFIG_DEBUG_SYMBOLS=y in your NuttX
+ configuration file when you build NuttX. That option is necessary to build
+ in debugging symbols.
+
+ NOTE 3: There are few things that NuttX has to do differently if you
+ are using a debugger. Make sure that you also set CONFIG_DEBUG=y. Nothing
+ also is needed and no debug output will be generated; but NuttX will
+ use CONFIG_DEBUG=y to mean that a debugger is attached and will deal
+ with certain resets and debug controls appropriately.
+
+ So you should have:
+
+ CONFIG_DEBUG=y
+ CONFIG_DEBUG_SYMBOLS=y
+
+ NOTE 4: Every time that you control-C out of the command line GDB, you
+ leave a copy of the Code Red debugger (crt_emu_lpc18_43_nxp) running. I
+ have found that if you have these old copies of the debugger running,
+ hen strange things can happen when start yet another copy of the
+ debugger (I suspect that GDB may be talking with the wrong debugger).
+
+ If you exit GDB with quit (not control-C), it seems to clean-up okay.
+ But I have taken to keeping a Process Explorer window open all of the
+ time to keep track of how many of these bad processes have been created.
+
+ NOTE 5: There is also a certain function that is causing some problems.
+ The very first thing that the start-up logic does is call a function
+ called lpc43_softreset() which resets most of the peripherals. But it
+ also causes some crashes... I think because the resets are causing some
+ interrupts.
+
+ I put a big delay in the soft reset logic between resetting and clearing
+ pending interrupts and that seems to help some but I am not confident
+ that that is a fix. I think that the real fix might be to just eliminated
+ this lpc43_softreset() function if we determine that it is not needed.
+
+ If you step over lpc43_softreset() after loading the coding (using the 'n'
+ command), then everything seems work okay.
+
+ Troubleshooting
+ ---------------
+
+ This page provides some troubleshooting information that you can use to
+ verify that the LPCLink is working correctly:
+
+ http://support.code-red-tech.com/CodeRedWiki/LPCLinkDiagnostics
+
+ Command Line Flash Programming
+ ------------------------------
+
+ The LPC18xx/LPC43xx debug driver can also be used to program the LPC43xx
+ flash directly from the command line. The script flash.sh that may be
+ found in the configs/lpc4330-xplorer/scripts directory can do that with
+ a single command line command.
+
+ Executing from SPIFI
+ --------------------
+
+ By default, the configurations here assume that you are executing directly
+ from SRAM.
+
+ CONFIG_BOOT_SRAM=y : Executing in SRAM
+ CONFIG_LPC43_CODEREDW=y : Code Red under Windows
+
+ To execute from SPIFI, you would need to set:
+
+ CONFIG_BOOT_SPIFI=y : Executing from SPIFI
+ CONFIG_DRAM_SIZE=(128*1024) : SRAM Bank0 size
+ CONFIG_DRAM_START=0x10000000 : SRAM Bank0 base address
+ CONFIG_SPIFI_OFFSET=(512*1024) : SPIFI file system offset
+
+ To boot the LPC4330-Xplorer from SPIFI the DIP switches should be 1-OFF,
+ 2-ON, 3-ON, 4-ON (LOW LOW LOW HIGH in Table 19, MSB to LSB).
+
+ If the code in flash hard faults after reset and crt_emu_lpc18_43_nxp
+ can't reset the MCU, an alternative is to temporarily change switch 1
+ to ON and press the reset button so it enters UART boot mode. Then
+ change it back to OFF and reset to boot again from flash.
+
+ # Use -wire to specify the debug probe in use:
+ # (empty) Red Probe+
+ # -wire=winusb LPC-Link on Windows XP
+ # -wire=hid LPC-Link on Windows Vista/ Windows 7
+ # Add -g -4 for verbose output
+
+ crt_emu_lpc18_43_nxp -wire=hid -pLPC4330 -load-base=0x14000000
+ -flash-load-exec=nuttx.bin -flash-driver=LPC1850A_4350A_SPIFI.cfx
+
+ USB DFU Booting
+ ---------------
+
+ To be provided.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lpc4330-xplorer/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+Serial Console
+==============
+
+The LPC4330 Xplorer does not have RS-232 drivers or serial connectors on board.
+USART0 and UART1 are available on J8 as follows:
+
+ ------ ------ -----------------------
+ SIGNAL J8 PIN LPC4330FET100 PIN
+ (TFBGA100 package)
+ ------ ------ -----------------------
+ U0_TXD pin 9 F6 P6_4 U0_TXD=Alt 2
+ U0_RXD pin 10 F9 P6_5 U0_RXD=Alt 2
+ U1_TXD pin 13 H8 P1_13 U1_TXD=Alt 1
+ U1_RXD pin 14 J8 P1_14 U1_RXD=Alt 1
+ ------ ------ -----------------------
+
+ GND is available on J8 pin 1
+ 5V is available on J8 pin 2
+ VBAT is available on J8 pin 3
+
+FPU
+===
+
+FPU Configuration Options
+-------------------------
+
+There are two version of the FPU support built into the most NuttX Cortex-M4
+ports. The current LPC43xx port support only one of these options, the "Non-
+Lazy Floating Point Register Save". As a consequence, CONFIG_ARMV7M_CMNVECTOR
+must be defined in *all* LPC43xx configuration files.
+
+1. Lazy Floating Point Register Save.
+
+ This is an untested implementation that saves and restores FPU registers
+ only on context switches. This means: (1) floating point registers are
+ not stored on each context switch and, hence, possibly better interrupt
+ performance. But, (2) since floating point registers are not saved,
+ you cannot use floating point operations within interrupt handlers.
+
+ This logic can be enabled by simply adding the following to your .config
+ file:
+
+ CONFIG_ARCH_FPU=y
+
+2. Non-Lazy Floating Point Register Save
+
+ Mike Smith has contributed an extensive re-write of the ARMv7-M exception
+ handling logic. This includes verified support for the FPU. These changes
+ have not yet been incorporated into the mainline and are still considered
+ experimental. These FPU logic can be enabled with:
+
+ CONFIG_ARCH_FPU=y
+ CONFIG_ARMV7M_CMNVECTOR=y
+
+ You will probably also changes to the ld.script in if this option is selected.
+ This should work:
+
+ -ENTRY(_stext)
+ +ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
+ +EXTERN(_vectors) /* Force the vectors to be included in the output */
+
+CFLAGS
+------
+
+Only the Atollic toolchain has built-in support for the Cortex-M4 FPU. You will see
+the following lines in each Make.defs file:
+
+ ifeq ($(CONFIG_LPC43_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ ...
+ ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+ else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ endif
+ endif
+
+If you are using a toolchain other than the Atollic toolchain, then to use the FPU
+you will also have to modify the CFLAGS to enable compiler support for the ARMv7-M
+FPU. As of this writing, there are not many GCC toolchains that will support the
+ARMv7-M FPU.
+
+As a minimum you will need to add CFLAG options to (1) enable hardware floating point
+code generation, and to (2) select the FPU implementation. You might try the same
+options as used with the Atollic toolchain in the Make.defs file:
+
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+
+Configuration Changes
+---------------------
+
+Below are all of the configuration changes that I had to make to configs/stm3240g-eval/nsh2
+in order to successfully build NuttX using the Atollic toolchain WITH FPU support:
+
+ -CONFIG_ARCH_FPU=n : Enable FPU support
+ +CONFIG_ARCH_FPU=y
+
+ -CONFIG_LPC43_CODESOURCERYW=y : Disable the CodeSourcery toolchain
+ +CONFIG_LPC43_CODESOURCERYW=n
+
+ -CONFIG_LPC43_ATOLLIC_LITE=n : Enable *one* the Atollic toolchains
+ CONFIG_LPC43_ATOLLIC_PRO=n
+ -CONFIG_LPC43_ATOLLIC_LITE=y : The "Lite" version, OR
+ CONFIG_LPC43_ATOLLIC_PRO=y : The "Pro" version (not both)
+
+ -CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
+ +CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_HAVE_CXX=y : Suppress generation of C++ code
+ +CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
+
+See the section above on Toolchains, NOTE 2, for explanations for some of
+the configuration settings. Some of the usual settings are just not supported
+by the "Lite" version of the Atollic toolchain.
+
+LPC4330-Xplorer Configuration Options
+=====================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc43xx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LPC4330=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=lpc4330-xplorer (for the LPC4330-Xplorer board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LPC4330_XPLORER=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x10000000
+
+ CONFIG_ARCH_IRQPRIO - The LPC43xx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_FPU - The LPC43xxx supports a floating point unit (FPU)
+
+ CONFIG_ARCH_FPU=y
+
+ CONFIG_BOOT_xxx - The startup code needs to know if the code is running
+ from internal FLASH, external FLASH, SPIFI, or SRAM in order to
+ initialize properly. Note that a boot device is not specified for
+ cases where the code is copied into SRAM; those cases are all covered
+ by CONFIG_BOOT_SRAM.
+
+ CONFIG_BOOT_SRAM=y : Running from SRAM (0x1000:0000)
+ CONFIG_BOOT_SPIFI=y : Running from QuadFLASH (0x1400:0000)
+ CONFIG_BOOT_FLASHA=y : Running in internal FLASHA (0x1a00:0000)
+ CONFIG_BOOT_FLASHB=y : Running in internal FLASHA (0x1b00:0000)
+ CONFIG_BOOT_CS0FLASH=y : Running in external FLASH CS0 (0x1c00:0000)
+ CONFIG_BOOT_CS1FLASH=y : Running in external FLASH CS1 (0x1d00:0000)
+ CONFIG_BOOT_CS2FLASH=y : Running in external FLASH CS2 (0x1e00:0000)
+ CONFIG_BOOT_CS3FLASH=y : Running in external FLASH CS3 (0x1f00:0000)
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_LPC43_ADC0=y
+ CONFIG_LPC43_ADC1=y
+ CONFIG_LPC43_ATIMER=y
+ CONFIG_LPC43_CAN1=y
+ CONFIG_LPC43_CAN2=y
+ CONFIG_LPC43_DAC=y
+ CONFIG_LPC43_EMC=y
+ CONFIG_LPC43_ETHERNET=y
+ CONFIG_LPC43_EVNTMNTR=y
+ CONFIG_LPC43_GPDMA=y
+ CONFIG_LPC43_I2C0=y
+ CONFIG_LPC43_I2C1=y
+ CONFIG_LPC43_I2S0=y
+ CONFIG_LPC43_I2S1=y
+ CONFIG_LPC43_LCD=y
+ CONFIG_LPC43_MCPWM=y
+ CONFIG_LPC43_QEI=y
+ CONFIG_LPC43_RIT=y
+ CONFIG_LPC43_RTC=y
+ CONFIG_LPC43_SCT=y
+ CONFIG_LPC43_SDMMC=y
+ CONFIG_LPC43_SPI=y
+ CONFIG_LPC43_SPIFI=y
+ CONFIG_LPC43_SSP0=y
+ CONFIG_LPC43_SSP1=y
+ CONFIG_LPC43_TMR0=y
+ CONFIG_LPC43_TMR1=y
+ CONFIG_LPC43_TMR2=y
+ CONFIG_LPC43_TMR3=y
+ CONFIG_LPC43_USART0=y
+ CONFIG_LPC43_UART1=y
+ CONFIG_LPC43_USART2=y
+ CONFIG_LPC43_USART3=y
+ CONFIG_LPC43_USB0=y
+ CONFIG_LPC43_USB1=y
+ CONFIG_LPC43_USB1_ULPI=y
+ CONFIG_LPC43_WWDT=y
+
+ LPC43xx specific U[S]ART device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the USART0).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_USARTn_RS485MODE - Support LPC43xx USART0,2,3 RS485 mode
+ ioctls (TIOCSRS485 and TIOCGRS485) to enable and disable
+ RS-485 mode.
+
+ LPC43xx specific CAN device driver settings. These settings all
+ require CONFIG_CAN:
+
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
+ CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
+
+ LPC43xx specific PHY/Ethernet device driver settings. These setting
+ also require CONFIG_NET and CONFIG_LPC43_ETHERNET.
+
+ CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+
+ CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ LPC43xx USB Device Configuration
+
+ CONFIG_LPC43_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+ CONFIG_LPC43_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+ CONFIG_LPC43_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in SRAM.
+ CONFIG_LPC43_USBDEV_DMA
+ Enable lpc17xx-specific DMA support
+ CONFIG_LPC43_USBDEV_NOVBUS
+ Define if the hardware implementation does not support the VBUS signal
+ CONFIG_LPC43_USBDEV_NOLED
+ Define if the hardware implementation does not support the LED output
+
+ LPC43xx USB Host Configuration
+
+ CONFIG_USBHOST_OHCIRAM_SIZE
+ Total size of OHCI RAM (in AHB SRAM Bank 1)
+ CONFIG_USBHOST_NEDS
+ Number of endpoint descriptors
+ CONFIG_USBHOST_NTDS
+ Number of transfer descriptors
+ CONFIG_USBHOST_TDBUFFERS
+ Number of transfer descriptor buffers
+ CONFIG_USBHOST_TDBUFSIZE
+ Size of one transfer descriptor buffer
+ CONFIG_USBHOST_IOBUFSIZE
+ Size of one end-user I/O buffer. This can be zero if the
+ application can guarantee that all end-user I/O buffers
+ reside in AHB SRAM.
+
+Configurations
+==============
+
+Each LPC4330-Xplorer configuration is maintained in a sudirectory and can be selected
+as follow:
+
+ cd tools
+ ./configure.sh lpc4330-xplorer/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ ------
+ This configuration of this directory performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ executing directly from SRAM.
+
+ CONFIG_BOOT_SRAM=y : Executing in SRAM
+ CONFIG_LPC43_CODEREDW=y : Code Red under Windows
+
+ This configuration directory, performs a simple test of the USB host
+ HID keyboard class driver using the test logic in examples/hidkbd.
+
+ If you use the Atollic toolchain, then the FPU test can be enabled in the
+ examples/ostest by adding the following your NuttX configuration file:
+
+ -CONFIG_ARCH_FPU=n : Enable FPU support
+ +CONFIG_ARCH_FPU=y
+
+ -CONFIG_LPC43_CODESOURCERYW=y : Disable the CodeSourcery toolchain
+ +CONFIG_LPC43_CODESOURCERYW=n
+
+ -CONFIG_LPC43_ATOLLIC_LITE=n : Enable *one* the Atollic toolchains
+ CONFIG_LPC43_ATOLLIC_PRO=n
+ -CONFIG_LPC43_ATOLLIC_LITE=y : The "Lite" version, OR
+ CONFIG_LPC43_ATOLLIC_PRO=n : The "Pro" version (only one)
+
+ -CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
+ +CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_HAVE_CXX=y : Suppress generation of C++ code
+ +CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_SCHED_WAITPID=y : Enable the waitpid() API needed by the FPU test
+ +CONFIG_SCHED_WAITPID=n
+
+ The FPU test also needs to know the size of the FPU registers save area in
+ bytes (see arch/arm/include/armv7-m/irq_lazyfpu.h):
+
+ +CONFIG_EXAMPLES_OSTEST_FPUSIZE=(4*33)
+
+ nsh:
+ ----
+ This configuration is the NuttShell (NSH) example at examples/nsh/
+ examples/ostest. By default, this project assumes that you are
+ executing directly from SRAM.
+
+ CONFIG_BOOT_SRAM=y : Executing in SRAM
+ CONFIG_LPC43_CODEREDW=y : Code Red under Windows
+
+ To execute from SPIFI, you would need to set:
+
+ CONFIG_BOOT_SPIFI=y : Executing from SPIFI
+ CONFIG_DRAM_SIZE=(128*1024) : SRAM Bank0 size
+ CONFIG_DRAM_START=0x10000000 : SRAM Bank0 base address
+ CONFIG_SPIFI_OFFSET=(512*1024) : SPIFI file system offset
+
+ CONFIG_MM_REGIONS should also be increased if you want to other SRAM banks
+ to the memory pool.
+
+ This configuration has some special options that can be used to
+ create a block device on the SPIFI FLASH. NOTE: CONFIG_LPC43_SPIFI=y
+ must also be defined to enable SPIFI setup support:
+
+ SPIFI device geometry:
+
+ CONFIG_SPIFI_OFFSET - Offset the beginning of the block driver this many
+ bytes into the device address space. This offset must be an exact
+ multiple of the erase block size (CONFIG_SPIFI_BLKSIZE). Default 0.
+ CONFIG_SPIFI_BLKSIZE - The size of one device erase block. If not defined
+ then the driver will try to determine the correct erase block size by
+ examining that data returned from spifi_initialize (which sometimes
+ seems bad).
+
+ Other SPIFI options
+
+ CONFIG_SPIFI_SECTOR512 - If defined, then the driver will report a more
+ FAT friendly 512 byte sector size and will manage the read-modify-write
+ operations on the larger erase block.
+ CONFIG_SPIFI_READONLY - Define to support only read-only operations.
+ CONFIG_SPIFI_LIBRARY - Don't use the LPC43xx ROM routines but, instead,
+ use an external library implementation of the SPIFI interface.
+ CONFIG_SPIFI_VERIFY - Verify all spifi_program() operations by reading
+ from the SPI address space after each write.
+ CONFIG_DEBUG_SPIFI_DUMP - Debug option to dump read/write buffers. You
+ probably do not want to enable this unless you want to dig through a
+ *lot* of debug output! Also required CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE,
+ and CONFIG_DEBUG_FS,
+
+ In my experience, there were some missing function pointers in the LPC43xx
+ SPIFI ROM routines and the SPIFI configuration could only be built with
+ CONFIG_SPIFI_LIBRARY=y. The SPIFI library is proprietary and cannot be
+ provided within NuttX open source repository; SPIFI library binaries can
+ be found on the lpcware.com website. In this build sceneario, you must
+ also provide the patch to the external SPIFI library be defining the make
+ variable EXTRA_LIBS in the top-level Make.defs file. Good luck!
diff --git a/nuttx/configs/lpc4330-xplorer/include/board.h b/nuttx/configs/lpc4330-xplorer/include/board.h
new file mode 100644
index 000000000..bf4c355e5
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/include/board.h
@@ -0,0 +1,333 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdbool.h>
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+# include <nuttx/irq.h>
+#endif
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking ****************************************************************/
+/* NOTE: The following definitions require lpc43_cgu.h. It is not included
+ * here because the including C file may not have that file in its include
+ * path.
+ *
+ * The Xplorer board has four crystals on board:
+ *
+ * Y1 - RTC 32.768 MHz oscillator input,
+ * Y2 - 24.576 MHz input to the UDA 1380 audio codec,
+ * Y3 - 12.000 MHz LPC43xx crystal oscillator input
+ * Y4 - 50 MHz input for Ethernet
+ */
+
+#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency (Y3) */
+#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency (Y1) */
+#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
+
+/* Integer and direct modes are supported:
+ *
+ * In integer mode (Fclkout < 156000000):
+ * Fclkin = BOARD_XTAL_FREQUENCY
+ * Fclkout = Msel * FClkin / Nsel
+ * Fcco = 2 * Psel * Fclkout
+ * In direct mode (Fclkout > 156000000):
+ * Fclkin = BOARD_XTAL_FREQUENCY
+ * Fclkout = Msel * FClkin / Nsel
+ * Fcco = Fclkout
+ */
+
+#ifdef CONFIG_LPC43_72MHz
+
+/* NOTE: At 72MHz, the calibrated value of CONFIG_BOARD_LOOPSPERMSEC was
+ * determined to be:
+ *
+ * CONFIG_BOARD_LOOPSPERMSEC=7191
+ *
+ * executing from SRAM.
+ */
+
+/* Final clocking (Integer mode with no ramp-up)
+ *
+ * Fclkout = 6 * 12MHz / 1 = 72MHz
+ * Fcco = 2 * 2 * 72MHz = 216MHz
+ */
+
+# define BOARD_PLL_MSEL (6) /* Msel = 6 */
+# define BOARD_PLL_NSEL (1) /* Nsel = 1 */
+# define BOARD_PLL_PSEL (2) /* Psel = 2 */
+
+# define BOARD_FCLKOUT_FREQUENCY (72000000) /* 6 * 12,000,000 / 1 */
+# define BOARD_FCCO_FREQUENCY (244000000) /* 2 * 2 * Fclkout */
+
+#else
+
+/* NOTE: At 72MHz, the calibrated value of CONFIG_BOARD_LOOPSPERMSEC was
+ * determined to be:
+ *
+ * CONFIG_BOARD_LOOPSPERMSEC=18535
+ *
+ * executing from SRAM.
+ */
+
+/* Intermediate ramp-up clocking (Integer mode). If BOARD_PLL_RAMP_MSEL
+ * is not defined, there will be no ramp-up.
+ *
+ * Fclkout = 9 * 12MHz / 1 = 108MHz
+ * Fcco = 2 * 1 * 108MHz = 216MHz
+ */
+
+# define BOARD_PLL_RAMP_MSEL (9) /* Msel = 9 */
+# define BOARD_PLL_RAMP_NSEL (1) /* Nsel = 1 */
+# define BOARD_PLL_RAMP_PSEL (1) /* Psel = 1 */
+
+# define BOARD_RAMP_FCLKOUT (108000000) /* 9 * 12,000,000 / 1 */
+# define BOARD_RAMP_FCCO (216000000) /* 2 * 1 * Fclkout */
+
+/* Final clocking (Direct mode).
+ *
+ * Fclkout = 17 * 12MHz / 1 = 204MHz
+ * Fcco = Fclockout = 204MHz
+ */
+
+# define BOARD_PLL_MSEL (17) /* Msel = 17 */
+# define BOARD_PLL_NSEL (1) /* Nsel = 1 */
+
+# define BOARD_FCLKOUT_FREQUENCY (204000000) /* 17 * 12,000,000 / 1 */
+# define BOARD_FCCO_FREQUENCY (204000000) /* Fclockout */
+
+#endif
+
+/* This is the clock setup we configure for:
+ *
+ * SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
+ * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6
+ */
+
+#define LPC43_CCLK BOARD_FCLKOUT_FREQUENCY
+
+/* SPIFI clocking **********************************************************/
+/* The SPIFI will receive clocking from a divider per the settings provided
+ * in this file. The NuttX code will configure PLL1 as the input clock
+ * for the selected divider
+ */
+
+#undef BOARD_SPIFI_PLL1 /* No division */
+#undef BOARD_SPIFI_DIVA /* Supports division by 1-4 */
+#undef BOARD_SPIFI_DIVB /* Supports division by 1-16 */
+#undef BOARD_SPIFI_DIVC /* Supports division by 1-16 */
+#undef BOARD_SPIFI_DIVD /* Supports division by 1-16 */
+#undef BOARD_SPIFI_DIVE /* Supports division by 1-256 */
+
+#if BOARD_FCLKOUT_FREQUENCY < 20000000
+# define BOARD_SPIFI_PLL1 1 /* Use PLL1 directly */
+#else
+# define BOARD_SPIFI_DIVB 1 /* Use IDIVB */
+#endif
+
+
+/* We need to configure the divider so that its output is as close to the
+ * desired SCLK value. The peak data transfer rate will be about half of
+ * this frequency in bytes per second.
+ */
+
+#if BOARD_FCLKOUT_FREQUENCY < 20000000
+# define BOARD_SPIFI_FREQUENCY BOARD_FCLKOUT_FREQUENCY /* 72Mhz? */
+#else
+# define BOARD_SPIFI_DIVIDER (14) /* 204MHz / 14 = 14.57MHz */
+# define BOARD_SPIFI_FREQUENCY (102000000) /* 204MHz / 14 = 14.57MHz */
+#endif
+
+/* UART clocking ***********************************************************/
+/* Configure all U[S]ARTs to use the XTAL input frequency */
+
+#define BOARD_USART0_CLKSRC BASE_USART0_CLKSEL_XTAL
+#define BOARD_USART0_BASEFREQ BOARD_XTAL_FREQUENCY
+
+#define BOARD_UART1_CLKSRC BASE_UART1_CLKSEL_XTAL
+#define BOARD_UART1_BASEFREQ BOARD_XTAL_FREQUENCY
+
+#define BOARD_USART2_CLKSRC BASE_USART2_CLKSEL_XTAL
+#define BOARD_USART2_BASEFREQ BOARD_XTAL_FREQUENCY
+
+#define BOARD_USART3_CLKSRC BASE_USART3_CLKSEL_XTAL
+#define BOARD_USART3_BASEFREQ BOARD_XTAL_FREQUENCY
+
+/* LED definitions *********************************************************/
+/* The LPC4330-Xplorer has 2 user-controllable LEDs labeled D2 an D3 in the
+ * schematic and on but referred to has LED1 and LED2 here, respectively.
+ *
+ * LED1 D2 GPIO1[12]
+ * LED2 D3 GPIO1[11]
+ *
+ * LEDs are pulled high to a low output illuminates the LED.
+ *
+ * LED index values for use with lpc43_setled()
+ */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_NLEDS 2
+
+/* LED bits for use with lpc43_setleds() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+
+/* If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows
+ * for NuttX debug functionality (where NC means "No Change"). If
+ * CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
+ * control of the application. The following interfaces are then available
+ * for application control of the LEDs:
+ *
+ * void lpc43_ledinit(void);
+ * void lpc43_setled(int led, bool ledon);
+ * void lpc43_setleds(uint8_t ledset);
+ */
+ /* ON OFF */
+ /* LED1 LED2 LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF - - */
+#define LED_HEAPALLOCATE 1 /* ON OFF - - */
+#define LED_IRQSENABLED 1 /* ON OFF - - */
+#define LED_STACKCREATED 1 /* ON OFF - - */
+#define LED_INIRQ 2 /* NC ON NC OFF */
+#define LED_SIGNAL 2 /* NC ON NC OFF */
+#define LED_ASSERTION 2 /* NC ON NC OFF */
+#define LED_PANIC 2 /* NC ON NC OFF */
+
+/* UART Pins ****************************************************************/
+/* The LPC4330 Xplorer does not have RS-232 drivers or serial connectors on
+ * board. USART0 and UART1 are available on J8 as follows:
+ *
+ * ------ ------ -----------------------
+ * SIGNAL J8 PIN LPC4330FET100 PIN
+ * (TFBGA100 package)
+ * ------ ------ -----------------------
+ * U0_TXD pin 9 F6 P6_4 U0_TXD=Alt 2
+ * U0_RXD pin 10 F9 P6_5 U0_RXD=Alt 2
+ * U1_TXD pin 13 H8 P1_13 U1_TXD=Alt 1
+ * U1_RXD pin 14 J8 P1_14 U1_RXD=Alt 1
+ * ------ ------ -----------------------
+ *
+ * The following definitions must be provided so that the LPC43 serial
+ * driver can set up the U[S]ART for the serial console properly (see the
+ * file arch/arc/src/lpc43xx/lpc4310203050_pinconf.h for more info).
+ */
+
+#define PINCONF_U0_TXD PINCONF_U0_TXD_3
+#define PINCONF_U0_RXD PINCONF_U0_RXD_3
+#define PINCONF_U0_DIR PINCONF_U0_DIR_3
+
+#define PINCONF_U1_TXD PINCONF_U1_TXD_1
+#define PINCONF_U1_RXD PINCONF_U1_RXD_1
+
+#define PINCONF_U2_TXD PINCONF_U2_TXD_1
+#define PINCONF_U2_RXD PINCONF_U2_RXD_1
+#define PINCONF_U2_DIR PINCONF_U2_DIR_1
+
+#define PINCONF_U3_TXD PINCONF_U3_TXD_2
+#define PINCONF_U3_RXD PINCONF_U3_RXD_2
+#define PINCONF_U3_DIR PINCONF_U3_DIR_2
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_boardinitialize
+ *
+ * Description:
+ * All LPC43xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ****************************************************************************/
+
+EXTERN void lpc43_boardinitialize(void);
+
+/*****************************************************************************
+ * Name: lpc43_ledinit, lpc43_setled, and lpc43_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
+ * are available to control the LEDs from user applications.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void lpc43_ledinit(void);
+EXTERN void lpc43_setled(int led, bool ledon);
+EXTERN void lpc43_setleds(uint8_t ledset);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/lpc4330-xplorer/nsh/Make.defs b/nuttx/configs/lpc4330-xplorer/nsh/Make.defs
new file mode 100644
index 000000000..db7b72815
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/nsh/Make.defs
@@ -0,0 +1,219 @@
+############################################################################
+# configs/lpc4330-xplorer/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC43_CODEREDW),y)
+ # Code Red RedSuite under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_LPC43_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC43_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC43_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_LPC43_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_LPC43_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC43_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m4 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+# Setup for the kind of memory that we are executing from
+
+ifeq ($(CONFIG_BOOT_SRAM),y)
+ LDSCRIPT = ramconfig.ld
+endif
+ifeq ($(CONFIG_BOOT_SPIFI),y)
+ LDSCRIPT = spificonfig.ld
+endif
+ifeq ($(CONFIG_BOOT_FLASHA),y)
+ LDSCRIPT = flashaconfig.ld
+endif
+ifeq ($(CONFIG_BOOT_FLASHB),y)
+ LDSCRIPT = flashaconfig.ld
+endif
+ifeq ($(CONFIG_BOOT_CS0FLASH),y)
+ LDSCRIPT = cs0flash.ld
+endif
+
+# Setup for Windows vs Linux/Cygwin/OSX environments
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpc4330-xplorer/nsh/appconfig b/nuttx/configs/lpc4330-xplorer/nsh/appconfig
new file mode 100644
index 000000000..97dace19f
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/nsh/appconfig
@@ -0,0 +1,99 @@
+############################################################################
+# configs/lpc4330-xplorer/nsh2/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# FreeModBus library
+
+ifeq ($(CONFIG_MODBUS),y)
+CONFIGURED_APPS += modbus
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
+
+ifeq ($(CONFIG_MODBUS),y)
+CONFIGURED_APPS += examples/modbus
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
diff --git a/nuttx/configs/lpc4330-xplorer/nsh/defconfig b/nuttx/configs/lpc4330-xplorer/nsh/defconfig
new file mode 100644
index 000000000..b0a1f736f
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/nsh/defconfig
@@ -0,0 +1,604 @@
+############################################################################
+# configs/lpc4330-xplorer/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="lpc43xx"
+CONFIG_ARCH_CHIP_LPC43XX=y
+CONFIG_ARCH_CHIP_LPC4330FET100=y
+CONFIG_ARCH_BOARD="lpc4330-xplorer"
+CONFIG_ARCH_BOARD_LPC4330_XPLORER=y
+CONFIG_BOARD_LOOPSPERMSEC=18535
+CONFIG_DRAM_SIZE=73728
+CONFIG_DRAM_START=0x10080000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+CONFIG_ARMV7M_CMNVECTOR=y
+
+#
+# Execution address space
+#
+CONFIG_BOOT_SRAM=y
+CONFIG_BOOT_SPIFI=n
+CONFIG_BOOT_FLASHA=n
+CONFIG_BOOT_FLASHB=n
+CONFIG_BOOT_CS0FLASH=n
+CONFIG_BOOT_CS1FLASH=n
+CONFIG_BOOT_CS2FLASH=n
+CONFIG_BOOT_CS3FLASH=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC43_CODEREDW=y
+CONFIG_LPC43_CODESOURCERYW=n
+CONFIG_LPC43_CODESOURCERYL=n
+CONFIG_LPC43_ATOLLIC_LITE=n
+CONFIG_LPC43_ATOLLIC_PRO=n
+CONFIG_LPC43_DEVKITARM=n
+CONFIG_LPC43_BUILDROOT=n
+
+CONFIG_ARCH_STDARG_H=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC43_ADC0=n
+CONFIG_LPC43_ADC1=n
+CONFIG_LPC43_ATIMER=n
+CONFIG_LPC43_CAN1=n
+CONFIG_LPC43_CAN2=n
+CONFIG_LPC43_DAC=n
+CONFIG_LPC43_EMC=n
+CONFIG_LPC43_ETHERNET=n
+CONFIG_LPC43_EVNTMNTR=n
+CONFIG_LPC43_GPDMA=n
+CONFIG_LPC43_I2C0=n
+CONFIG_LPC43_I2C1=n
+CONFIG_LPC43_I2S0=n
+CONFIG_LPC43_I2S1=n
+CONFIG_LPC43_LCD=n
+CONFIG_LPC43_MCPWM=n
+CONFIG_LPC43_QEI=n
+CONFIG_LPC43_RIT=n
+CONFIG_LPC43_RTC=n
+CONFIG_LPC43_SCT=n
+CONFIG_LPC43_SDMMC=n
+CONFIG_LPC43_SPI=n
+CONFIG_LPC43_SPIFI=n
+CONFIG_LPC43_SSP0=n
+CONFIG_LPC43_SSP1=n
+CONFIG_LPC43_TMR0=n
+CONFIG_LPC43_TMR1=n
+CONFIG_LPC43_TMR2=n
+CONFIG_LPC43_TMR3=n
+CONFIG_LPC43_USART0=y
+CONFIG_LPC43_UART1=n
+CONFIG_LPC43_USART2=n
+CONFIG_LPC43_USART3=n
+CONFIG_LPC43_USB0=n
+CONFIG_LPC43_USB1=n
+CONFIG_LPC43_USB1_ULPI=n
+CONFIG_LPC43_WWDT=n
+
+#
+# LPC43xx specific serial device driver settings
+#
+CONFIG_SERIAL_TERMIOS=n
+
+CONFIG_USART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_USART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_USART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_USART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_USART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+CONFIG_USART0_RS485MODE=n
+CONFIG_USART2_RS485MODE=n
+CONFIG_USART3_RS485MODE=n
+
+#
+# LPC43xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_FS=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=11
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# The SPIFI driver has some special options that can be used to
+# create an MTD device on the SPIFI FLASH. NOTE: CONFIG_LPC43_SPIFI=y
+# must also be defined to enable SPIFI setup support:
+#
+# SPIFI device geometry:
+#
+CONFIG_SPIFI_OFFSET=0
+CONFIG_SPIFI_BLKSIZE=4096
+CONFIG_SPIFI_SECTOR512=y
+CONFIG_SPIFI_RDONLY=n
+CONFIG_SPIFI_LIBRARY=n
+CONFIG_SPIFI_VERIFY=n
+CONFIG_DEBUG_SPIFI_DUMP=n
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+CONFIG_MODBUS=n
+CONFIG_MB_ASCII_ENABLED=y
+CONFIG_MB_RTU_ENABLED=y
+CONFIG_MB_TCP_ENABLED=n
+CONFIG_MB_ASCII_TIMEOUT_SEC=1
+CONFIG_MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS=0
+CONFIG_MB_FUNC_HANDLERS_MAX=16
+CONFIG_MB_FUNC_OTHER_REP_SLAVEID_BUF=32
+CONFIG_MB_FUNC_OTHER_REP_SLAVEID_ENABLED=y
+CONFIG_MB_FUNC_READ_INPUT_ENABLED=y
+CONFIG_MB_FUNC_READ_HOLDING_ENABLED=y
+CONFIG_MB_FUNC_WRITE_HOLDING_ENABLED=y
+CONFIG_MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED=y
+CONFIG_MB_FUNC_READ_COILS_ENABLED=y
+CONFIG_MB_FUNC_WRITE_COIL_ENABLED=y
+CONFIG_MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED=y
+CONFIG_MB_FUNC_READ_DISCRETE_INPUTS_ENABLED=y
+CONFIG_MB_FUNC_READWRITE_HOLDING_ENABLED=y
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC43xx USB Configuration
+#
+CONFIG_LPC43_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC43_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC43_USBDEV_DMA=n
+CONFIG_LPC43_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC43_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=0
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=0
+CONFIG_EXAMPLE_BUTTONS_NAME1="SW2"
+
+#
+# examples/modbus
+#
+CONFIG_EXAMPLES_MODBUS_PORT=1
+CONFIG_EXAMPLES_MODBUS_BAUD=B9600
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpc4330-xplorer/nsh/setenv.sh b/nuttx/configs/lpc4330-xplorer/nsh/setenv.sh
new file mode 100755
index 000000000..64109ce38
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/nsh/setenv.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+# configs/lpc4330-xplorer/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This is the Cygwin path to the location where I installed the Code Red
+# toolchain under windows. You will have to edit this if you install the
+# Code Red toolchain in any other location or if you install a different
+# version
+export TOOLCHAIN_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/Tools/bin"
+#export SCRIPT_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
+export SCRIPT_BIN="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+#export SCRIPT_BIN=
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+#export SCRIPT_BIN=
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+#export SCRIPT_BIN=
+
+# And add the selected toolchain path[s] to the PATH variable
+
+export PATH="/sbin:/usr/sbin:${PATH_ORIG}"
+
+if [ ! -z ${SCRIPT_BIN} ]; then
+ export PATH="${SCRIPT_BIN}:${PATH}"
+fi
+
+export PATH="${TOOLCHAIN_BIN}:${PATH}"
+echo "PATH : ${PATH}"
+
+# Set an alias that can be used to put the LPC43xx in boot mode
+
+alias lpc43xx='${SCRIPT_BIN}/Scripts/bootLPCXpresso.cmd winusb'
diff --git a/nuttx/configs/lpc4330-xplorer/ostest/Make.defs b/nuttx/configs/lpc4330-xplorer/ostest/Make.defs
new file mode 100644
index 000000000..db7b72815
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/ostest/Make.defs
@@ -0,0 +1,219 @@
+############################################################################
+# configs/lpc4330-xplorer/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC43_CODEREDW),y)
+ # Code Red RedSuite under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_LPC43_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC43_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC43_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_LPC43_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_LPC43_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC43_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m4 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+# Setup for the kind of memory that we are executing from
+
+ifeq ($(CONFIG_BOOT_SRAM),y)
+ LDSCRIPT = ramconfig.ld
+endif
+ifeq ($(CONFIG_BOOT_SPIFI),y)
+ LDSCRIPT = spificonfig.ld
+endif
+ifeq ($(CONFIG_BOOT_FLASHA),y)
+ LDSCRIPT = flashaconfig.ld
+endif
+ifeq ($(CONFIG_BOOT_FLASHB),y)
+ LDSCRIPT = flashaconfig.ld
+endif
+ifeq ($(CONFIG_BOOT_CS0FLASH),y)
+ LDSCRIPT = cs0flash.ld
+endif
+
+# Setup for Windows vs Linux/Cygwin/OSX environments
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpc4330-xplorer/ostest/appconfig b/nuttx/configs/lpc4330-xplorer/ostest/appconfig
new file mode 100644
index 000000000..5bba0b354
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lpc4330-xplorer/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/lpc4330-xplorer/ostest/defconfig b/nuttx/configs/lpc4330-xplorer/ostest/defconfig
new file mode 100644
index 000000000..267d46af5
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/ostest/defconfig
@@ -0,0 +1,581 @@
+############################################################################
+# configs/lpc4330-xplorer/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="lpc43xx"
+CONFIG_ARCH_CHIP_LPC43XX=y
+CONFIG_ARCH_CHIP_LPC4330FET100=y
+CONFIG_ARCH_BOARD="lpc4330-xplorer"
+CONFIG_ARCH_BOARD_LPC4330_XPLORER=y
+CONFIG_BOARD_LOOPSPERMSEC=18535
+CONFIG_DRAM_SIZE=73728
+CONFIG_DRAM_START=0x10080000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+CONFIG_ARMV7M_CMNVECTOR=y
+
+#
+# Execution address space
+#
+CONFIG_BOOT_SRAM=y
+CONFIG_BOOT_SPIFI=n
+CONFIG_BOOT_FLASHA=n
+CONFIG_BOOT_FLASHB=n
+CONFIG_BOOT_CS0FLASH=n
+CONFIG_BOOT_CS1FLASH=n
+CONFIG_BOOT_CS2FLASH=n
+CONFIG_BOOT_CS3FLASH=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC43_CODEREDW=y
+CONFIG_LPC43_CODESOURCERYW=n
+CONFIG_LPC43_CODESOURCERYL=n
+CONFIG_LPC43_ATOLLIC_LITE=n
+CONFIG_LPC43_ATOLLIC_PRO=n
+CONFIG_LPC43_DEVKITARM=n
+CONFIG_LPC43_BUILDROOT=n
+
+CONFIG_ARCH_STDARG_H=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC43_ADC0=n
+CONFIG_LPC43_ADC1=n
+CONFIG_LPC43_ATIMER=n
+CONFIG_LPC43_CAN1=n
+CONFIG_LPC43_CAN2=n
+CONFIG_LPC43_DAC=n
+CONFIG_LPC43_EMC=n
+CONFIG_LPC43_ETHERNET=n
+CONFIG_LPC43_EVNTMNTR=n
+CONFIG_LPC43_GPDMA=n
+CONFIG_LPC43_I2C0=n
+CONFIG_LPC43_I2C1=n
+CONFIG_LPC43_I2S0=n
+CONFIG_LPC43_I2S1=n
+CONFIG_LPC43_LCD=n
+CONFIG_LPC43_MCPWM=n
+CONFIG_LPC43_QEI=n
+CONFIG_LPC43_RIT=n
+CONFIG_LPC43_RTC=n
+CONFIG_LPC43_SCT=n
+CONFIG_LPC43_SDMMC=n
+CONFIG_LPC43_SPI=n
+CONFIG_LPC43_SPIFI=n
+CONFIG_LPC43_SSP0=n
+CONFIG_LPC43_SSP1=n
+CONFIG_LPC43_TMR0=n
+CONFIG_LPC43_TMR1=n
+CONFIG_LPC43_TMR2=n
+CONFIG_LPC43_TMR3=n
+CONFIG_LPC43_USART0=y
+CONFIG_LPC43_UART1=n
+CONFIG_LPC43_USART2=n
+CONFIG_LPC43_USART3=n
+CONFIG_LPC43_USB0=n
+CONFIG_LPC43_USB1=n
+CONFIG_LPC43_USB1_ULPI=n
+CONFIG_LPC43_WWDT=n
+
+#
+# LPC43xx specific serial device driver settings
+#
+CONFIG_USART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_USART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_USART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_USART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_USART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+CONFIG_USART0_RS485MODE=n
+CONFIG_USART2_RS485MODE=n
+CONFIG_USART3_RS485MODE=n
+
+#
+# LPC43xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=11
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=n
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+CONFIG_MODBUS=n
+CONFIG_MB_ASCII_ENABLED=y
+CONFIG_MB_RTU_ENABLED=y
+CONFIG_MB_TCP_ENABLED=n
+CONFIG_MB_ASCII_TIMEOUT_SEC=1
+CONFIG_MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS=0
+CONFIG_MB_FUNC_HANDLERS_MAX=16
+CONFIG_MB_FUNC_OTHER_REP_SLAVEID_BUF=32
+CONFIG_MB_FUNC_OTHER_REP_SLAVEID_ENABLED=y
+CONFIG_MB_FUNC_READ_INPUT_ENABLED=y
+CONFIG_MB_FUNC_READ_HOLDING_ENABLED=y
+CONFIG_MB_FUNC_WRITE_HOLDING_ENABLED=y
+CONFIG_MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED=y
+CONFIG_MB_FUNC_READ_COILS_ENABLED=y
+CONFIG_MB_FUNC_WRITE_COIL_ENABLED=y
+CONFIG_MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED=y
+CONFIG_MB_FUNC_READ_DISCRETE_INPUTS_ENABLED=y
+CONFIG_MB_FUNC_READWRITE_HOLDING_ENABLED=y
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC43xx USB Configuration
+#
+CONFIG_LPC43_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC43_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC43_USBDEV_DMA=n
+CONFIG_LPC43_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC43_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=0
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=0
+CONFIG_EXAMPLE_BUTTONS_NAME1="SW2"
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpc4330-xplorer/ostest/setenv.sh b/nuttx/configs/lpc4330-xplorer/ostest/setenv.sh
new file mode 100755
index 000000000..8ac6da66b
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/ostest/setenv.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+# configs/lpc4330-xplorer/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This is the Cygwin path to the location where I installed the Code Red
+# toolchain under windows. You will have to edit this if you install the
+# Code Red toolchain in any other location or if you install a different
+# version
+export TOOLCHAIN_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/Tools/bin"
+#export SCRIPT_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
+export SCRIPT_BIN="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+#export SCRIPT_BIN=
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+#export SCRIPT_BIN=
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+#export SCRIPT_BIN=
+
+# And add the selected toolchain path[s] to the PATH variable
+
+export PATH="/sbin:/usr/sbin:${PATH_ORIG}"
+
+if [ ! -z ${SCRIPT_BIN} ]; then
+ export PATH="${SCRIPT_BIN}:${PATH}"
+fi
+
+export PATH="${TOOLCHAIN_BIN}:${PATH}"
+echo "PATH : ${PATH}"
+
+# Set an alias that can be used to put the LPC43xx in boot mode
+
+alias lpc43xx='${SCRIPT_BIN}/Scripts/bootLPCXpresso.cmd winusb'
diff --git a/nuttx/configs/lpc4330-xplorer/scripts/flash.sh b/nuttx/configs/lpc4330-xplorer/scripts/flash.sh
new file mode 100755
index 000000000..a239e9b5d
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/scripts/flash.sh
@@ -0,0 +1,153 @@
+#!/bin/bash
+####################################################################################
+# flash.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+####################################################################################
+set -x
+
+USAGE="$0 <nuttx-path>"
+
+# LPCXpresso 3.6 installed at /cygdrive/c/nxp/lpcxpresso_3.6"
+BINDIR="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
+
+# RedSuite with LPC4330 support installed at /cygdrive/c/code_red/RedSuite_4.2.3_379 "
+#BINDIR="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
+
+TARGET=LPC4330
+
+echo "############################################################################"
+echo "# Assumptions:"
+echo "#"
+echo "# - Windows 7"
+echo "# - Binaries installed at ${BINDIR}"
+echo "# - AXF image built with Code Red"
+echo "# - ${TARGET}"
+echo "#"
+echo "# You will need to edit this is any of the above are false"
+echo "#"
+echo "############################################################################"
+echo ""
+
+# This is the default install location for binaries on Windows (note that this
+# path could change with the Code Red version number)
+
+if [ ! -d "${BINDIR}" ]; then
+ echo "Directory ${BINDIR} does not exist"
+ exit 1
+fi
+
+# This is the relative path to the booLPCXpresso utility.
+
+BOOTLPC="Scripts/bootLPCXpresso.cmd"
+if [ ! -x "${BINDIR}/${BOOTLPC}" ]; then
+ echo "No executable at ${BINDIR}/${BOOTLPC}"
+ exit 1
+fi
+
+# bootLPCXpresso arguments
+
+BOOTLPC_ARG=winusb # Win7
+
+# Use the LPC18xx/LPC43xx flash utility
+
+FLASHUTIL="crt_emu_lpc18_43_nxp" # for LPC18xx/LPC43xx parts
+
+if [ ! -x "${BINDIR}/${FLASHUTIL}" ]; then
+ echo "No executable file at ${BINDIR}/${FLASHUTIL}"
+ exit 1
+fi
+
+# FLUSHUTIL arguements
+
+WIRE="-wire=winusb" # for LPC-Link on Windows Vista/Windows 7)
+
+# The nuttx directory must be provided as an argument
+
+NUTTX=$1
+if [ -z "${NUTTX}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ exit 1
+fi
+
+if [ ! -d "${NUTTX}" ]; then
+ echo "Directory ${NUTTX} does not exist"
+ echo $USAGE
+ exit 1
+fi
+
+# The binary to download:
+
+if [ ! -f "${NUTTX}/nuttx.axf" ]; then
+ if [ -f "${NUTTX}/nuttx" ]; then
+ echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
+ mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
+ fi
+else
+ if [ -f "${NUTTX}/nuttx" ]; then
+ echo "Both ${NUTTX}/nuttx ${NUTTX}/nuttx.axf exist.."
+ echo " Deleting ${NUTTX}/nuttx.axf"
+ rm -f ${NUTTX}/nuttx.axf
+ echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
+ mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
+ fi
+fi
+NUTTXPATH=`cygpath -w "${NUTTX}/nuttx.axf"`
+
+# First of all boot the LPC-Link using the script: ${BINDIR}/${BOOTLPC}
+
+cd ${BINDIR} || \
+ { echo "Failed to CD to ${BINDIR}"; exit 1; }
+./${BOOTLPC} ${BOOTLPC_ARG} || \
+ { echo "'${BOOTLPC} ${BOOTLPC_ARG}' Failed"; }
+
+echo ""
+echo "Wait a bit"
+echo "5..."
+sleep 1
+echo "4..."
+sleep 1
+echo "3..."
+sleep 1
+echo "2..."
+sleep 1
+echo "1..."
+sleep 1
+echo "0..."
+echo ""
+
+# Then program the FLASH
+
+cd ${BINDIR} || \
+ { echo "Failed to CD to ${BINDIR}"; exit 1; }
+./${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load-exec="${NUTTXPATH}"
diff --git a/nuttx/configs/lpc4330-xplorer/scripts/ramconfig.ld b/nuttx/configs/lpc4330-xplorer/scripts/ramconfig.ld
new file mode 100644
index 000000000..f44d6181e
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/scripts/ramconfig.ld
@@ -0,0 +1,144 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/scripts/ramconfig.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/*
+ * Power-Up Reset Overview
+ * -----------------------
+ *
+ * The ARM core starts executing code on reset with the program counter set
+ * to 0x0000 0000. The LPC43xx contains a shadow pointer register that
+ * allows areas of memory to be mapped to address 0x0000 0000. The default,
+ * reset value of the shadow pointer is 0x1040 0000 so that on reset code in
+ * the boot ROM is always executed first.
+ *
+ * The boot starts after reset is released. The IRC is selected as CPU clock
+ * and the Cortex-M4 starts the boot loader. By default the JTAG access to the
+ * chip is disabled at reset. The boot ROM determines the boot mode based on
+ * the OTP BOOT_SRC value or reset state pins. For flash-based parts, the part
+ * boots from internal flash by default. Otherwse, the boot ROM copies the
+ * image to internal SRAM at location 0x1000 0000, sets the ARM's shadow
+ * pointer to 0x1000 0000, and jumps to that location.
+ *
+ * However, using JTAG the executable image can be also loaded directly into
+ * and executed from SRAM.
+ */
+
+/* The LPC4330 on the LPC4330-Xplorer has the following memory resources:
+ *
+ * 1. 4096Kb of SPIFI FLASH beginning at address 0x1400:0000
+ * 2. 264KB of total SRAM:
+ * a. 128KB of SRAM in the CPU block beginning at address 0x1000:0000
+ * b. 72KB beginning at address 0x1008:0000 and
+ * c. 64KB of AHB SRAM in three banks beginning at addresses 0x2000:0000,
+ * 0x2000:8000 and 0x2000:C000.
+ * 3. No internal FLASH
+ *
+ * Here we assume that:
+ *
+ * 1. We will be running out of SRAM at 0x1000:0000, and
+ * 2. All .data and .bss will all fit into the 72KB SRAM block.
+ *
+ * NOTE: That initialized data is kept in the program memory SRAM and copied
+ * to .data SRAM. This is wasteful and unnecessary but provides a good test
+ * for future, FLASH-resident code.
+ */
+
+MEMORY
+{
+ progmem (rx) : ORIGIN = 0x10000000, LENGTH = 128K
+ datamem (rwx) : ORIGIN = 0x10080000, LENGTH = 72K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
+EXTERN(_vectors) /* Force the vectors to be included in the output */
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > progmem
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > datamem AT > progmem
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >datamem
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >datamem
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > datamem
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpc4330-xplorer/scripts/spificonfig.ld b/nuttx/configs/lpc4330-xplorer/scripts/spificonfig.ld
new file mode 100644
index 000000000..1b8df48b2
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/scripts/spificonfig.ld
@@ -0,0 +1,140 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/scripts/spificonfig.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/*
+ * Power-Up Reset Overview
+ * -----------------------
+ *
+ * The ARM core starts executing code on reset with the program counter set
+ * to 0x0000 0000. The LPC43xx contains a shadow pointer register that
+ * allows areas of memory to be mapped to address 0x0000 0000. The default,
+ * reset value of the shadow pointer is 0x1040 0000 so that on reset code in
+ * the boot ROM is always executed first.
+ *
+ * The boot starts after reset is released. The IRC is selected as CPU clock
+ * and the Cortex-M4 starts the boot loader. By default the JTAG access to the
+ * chip is disabled at reset. The boot ROM determines the boot mode based on
+ * the OTP BOOT_SRC value or reset state pins. For flash-based parts, the part
+ * boots from internal flash by default. Otherwse, the boot ROM copies the
+ * image to internal SRAM at location 0x1000 0000, sets the ARM's shadow
+ * pointer to 0x1000 0000, and jumps to that location.
+ *
+ * Of course, using JTAG the executable image can be also loaded directly
+ * into and executed from SRAM.
+ */
+
+/* The LPC4330 on the LPC4330-Xplorer has the following memory resources:
+ *
+ * 1. 4096Kb of SPIFI FLASH beginning at address 0x1400:0000
+ * 2. 264KB of total SRAM:
+ * a. 128KB of SRAM in the CPU block beginning at address 0x1000:0000
+ * b. 72KB beginning at address 0x1008:0000 and
+ * c. 64KB of AHB SRAM in three banks beginning at addresses 0x2000:0000,
+ * 0x2000:8000 and 0x2000:C000.
+ * 3. No internal FLASH
+ *
+ * Here we assume that:
+ *
+ * 1. We will be running out of SPIFI flash at 0x1400:0000, and
+ * 2. All .data and .bss will all fit into the 128KB CPU SRAM block.
+ */
+
+MEMORY
+{
+ progmem (rx) : ORIGIN = 0x14000000, LENGTH = 1024K
+ datamem (rwx) : ORIGIN = 0x10000000, LENGTH = 128K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
+EXTERN(_vectors) /* Force the vectors to be included in the output */
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > progmem
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > datamem AT > progmem
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >datamem
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >datamem
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > datamem
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpc4330-xplorer/src/Makefile b/nuttx/configs/lpc4330-xplorer/src/Makefile
new file mode 100644
index 000000000..30e429bce
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/Makefile
@@ -0,0 +1,124 @@
+############################################################################
+# configs/lpc4330-xplorer/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_ARCH_FPU),y)
+CSRCS += up_ostest.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_autoleds.c
+else
+CSRCS += up_userleds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_SPIFI_LIBRARY),y)
+CFLAGS += -DEUROBIRD
+SPIFI_LIB = spifi_lib
+CSRCS += $(SPIFI_LIB)/spifi_rom_api.c
+#CSRCS += $(SPIFI_LIB)/amic.c
+#CSRCS += $(SPIFI_LIB)/atmel.c
+#CSRCS += $(SPIFI_LIB)/chi.c
+#CSRCS += $(SPIFI_LIB)/eon.c
+#CSRCS += $(SPIFI_LIB)/esmt.c
+#CSRCS += $(SPIFI_LIB)/esmt.c
+#CSRCS += $(SPIFI_LIB)/giga.c
+#CSRCS += $(SPIFI_LIB)/macronix.c
+#CSRCS += $(SPIFI_LIB)/numonyx.c
+CSRCS += $(SPIFI_LIB)/spansion.c
+#CSRCS += $(SPIFI_LIB)/sst.c
+CSRCS += $(SPIFI_LIB)/winbond.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lpc4330-xplorer/src/up_autoleds.c b/nuttx/configs/lpc4330-xplorer/src/up_autoleds.c
new file mode 100644
index 000000000..b19e33459
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/up_autoleds.c
@@ -0,0 +1,203 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/src/up_autoleds.c
+ * arch/arm/src/board/up_autoleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "xplorer_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED definitions **********************************************************/
+/* The LPC4330-Xplorer has 2 user-controllable LEDs labeled D2 an D3 in the
+ * schematic and on but referred to has LED1 and LED2 here, respectively.
+ *
+ * LED1 D2 GPIO1[12]
+ * LED2 D3 GPIO1[11]
+ *
+ * LEDs are pulled high to a low output illuminates the LED.
+ *
+ * If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows
+ * for NuttX debug functionality (where NC means "No Change").
+ *
+ * ON OFF
+ * LED1 LED2 LED1 LED2
+ * LED_STARTED 0 OFF OFF - -
+ * LED_HEAPALLOCATE 1 ON OFF - -
+ * LED_IRQSENABLED 1 ON OFF - -
+ * LED_STACKCREATED 1 ON OFF - -
+ * LED_INIRQ 2 NC ON NC OFF
+ * LED_SIGNAL 2 NC ON NC OFF
+ * LED_ASSERTION 2 NC ON NC OFF
+ * LED_PANIC 2 NC ON NC OFF
+ *
+ * If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
+ * control of the application. The following interfaces are then available
+ * for application control of the LEDs:
+ *
+ * void lpc43_ledinit(void);
+ * void lpc43_setled(int led, bool ledon);
+ * void lpc43_setleds(uint8_t ledset);
+ */
+
+/* Debug definitions ********************************************************/
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#ifdef CONFIG_DEBUG_LED
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define LED_VERBOSE 1
+# define ledvdbg lldbg
+# else
+# undef LED_VERBOSE
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: led_dumppins
+ ****************************************************************************/
+
+#ifdef LED_VERBOSE
+static void led_dumppins(FAR const char *msg)
+{
+ lpc43_pin_dump(PINCONFIG_LED1, msg);
+ lpc43_gpio_dump(GPIO_LED2, msg);
+}
+#else
+# define led_dumppins(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure all LED pins as GPIO outputs */
+
+ led_dumppins("up_ledinit() Entry)");
+
+ /* Configure LED pins as GPIOs, then configure GPIOs as outputs */
+
+ lpc43_pin_config(PINCONFIG_LED1);
+ lpc43_gpio_config(GPIO_LED1);
+
+ lpc43_pin_config(PINCONFIG_LED2);
+ lpc43_gpio_config(GPIO_LED2);
+
+ led_dumppins("up_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ default:
+ case 0:
+ lpc43_gpio_write(GPIO_LED1, true); /* LED1 OFF */
+ lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
+ break;
+
+ case 1:
+ lpc43_gpio_write(GPIO_LED1, false); /* LED1 ON */
+ lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
+ break;
+
+ case 2:
+ lpc43_gpio_write(GPIO_LED2, false); /* LED2 ON */
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ default:
+ case 0:
+ case 1:
+ break;
+
+ case 2:
+ lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lpc4330-xplorer/src/up_boot.c b/nuttx/configs/lpc4330-xplorer/src/up_boot.c
new file mode 100644
index 000000000..8bd4e019b
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/up_boot.c
@@ -0,0 +1,81 @@
+/************************************************************************************
+ * configs/lpc4330-xplorer/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "xplorer_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc43_boardinitialize
+ *
+ * Description:
+ * All LPC43xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc43_boardinitialize(void)
+{
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/lpc4330-xplorer/src/up_buttons.c b/nuttx/configs/lpc4330-xplorer/src/up_buttons.c
new file mode 100644
index 000000000..841f52b23
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/up_buttons.c
@@ -0,0 +1,224 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/src/up_buttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include <arch/board/board.h>
+
+#include "xplorer_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
+ * the BUTTON_* and JOYSTICK_* definitions in board.h
+ */
+
+static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
+{
+ LPC4330_XPLORER_BUT1
+};
+
+/* This array defines all of the interupt handlers current attached to
+ * button events.
+ */
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+static xcpt_t g_buttonisr[BOARD_NUM_BUTTONS];
+
+/* This array provides the mapping from button ID numbers to button IRQ
+ * numbers.
+ */
+
+static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
+{
+ LPC4330_XPLORER_BUT1_IRQ
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as interrupting inputs. */
+
+ for (i = 0; i < BOARD_NUM_BUTTONS; i++)
+ {
+ lpc43_configgpio(g_buttoncfg[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons.
+ *
+ * up_buttons() may be called at any time to harvest the state of every
+ * button. The state of the buttons is returned as a bitset with one
+ * bit corresponding to each button: If the bit is set, then the button
+ * is pressed. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < BOARD_NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed. */
+
+ bool released = lpc43_gpio_read(g_buttoncfg[i]);
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_irqbutton() may be called to register button interrupt handlers.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BOARD_BUTTON_* and BOARD_JOYSTICK_* definitions in board.h for the meaning
+ * of enumeration values. The previous interrupt handler address is returned
+ * (so that it may restored, if so desired).
+ *
+ * Note that up_irqbutton() also enables button interrupts. Button
+ * interrupts will remain enabled after the interrupt handler is attached.
+ * Interrupts may be disabled (and detached) by calling up_irqbutton with
+ * irqhandler equal to NULL.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+ irqstate_t flags;
+ int irq;
+
+ /* Verify that the button ID is within range */
+
+ if ((unsigned)id < BOARD_NUM_BUTTONS)
+ {
+ /* Return the current button handler and set the new interrupt handler */
+
+ oldhandler = g_buttonisr[id];
+ g_buttonisr[id] = irqhandler;
+
+ /* Disable interrupts until we are done */
+
+ flags = irqsave();
+
+ /* Configure the interrupt. Either attach and enable the new
+ * interrupt or disable and detach the old interrupt handler.
+ */
+
+ irq = g_buttonirq[id];
+ if (irqhandler)
+ {
+ /* Attach then enable the new interrupt handler */
+
+ (void)irq_attach(irq, irqhandler);
+ up_enable_irq(irq);
+ }
+ else
+ {
+ /* Disable then then detach the the old interrupt handler */
+
+ up_disable_irq(irq);
+ (void)irq_detach(irq);
+ }
+ irqrestore(flags);
+ }
+ return oldhandler;
+}
+#endif
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/lpc4330-xplorer/src/up_nsh.c b/nuttx/configs/lpc4330-xplorer/src/up_nsh.c
new file mode 100644
index 000000000..a09acd771
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/up_nsh.c
@@ -0,0 +1,148 @@
+/****************************************************************************
+ * config/lpc4330-xplorer/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "chip.h"
+
+#ifdef CONFIG_LPC43_SPIFI
+# include <nuttx/mtd.h>
+# include "lpc43_spifi.h"
+
+# ifdef CONFIG_SPFI_NXFFS
+# include <sys/mount.h>
+# include <nuttx/fs/nxffs.h>
+# endif
+#endif
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_SPIFI_DEVNO
+# define CONFIG_SPIFI_DEVNO 0
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_spifi_initialize
+ *
+ * Description:
+ * Make the SPIFI (or part of it) into a block driver that can hold a
+ * file system.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SPIFI
+static int nsh_spifi_initialize(void)
+{
+ FAR struct mtd_dev_s *mtd;
+ int ret;
+
+ /* Initialize the SPIFI interface and create the MTD driver instance */
+
+ mtd = lpc43_spifi_initialize();
+ if (!mtd)
+ {
+ fdbg("ERROR: lpc43_spifi_initialize failed\n");
+ return -ENODEV;
+ }
+
+#ifndef CONFIG_SPFI_NXFFS
+ /* And finally, use the FTL layer to wrap the MTD driver as a block driver */
+
+ ret = ftl_initialize(CONFIG_SPIFI_DEVNO, mtd);
+ if (ret < 0)
+ {
+ fdbg("ERROR: Initializing the FTL layer: %d\n", ret);
+ return ret;
+ }
+#else
+ /* Initialize to provide NXFFS on the MTD interface */1G
+
+ ret = nxffs_initialize(mtd);
+ if (ret < 0)
+ {
+ fdbg("ERROR: NXFFS initialization failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Mount the file system at /mnt/spifi */
+
+ ret = mount(NULL, "/mnt/spifi", "nxffs", 0, NULL);
+ if (ret < 0)
+ {
+ fdbg("ERROR: Failed to mount the NXFFS volume: %d\n", errno);
+ return ret;
+ }
+#endif
+
+ return OK;
+}
+#else
+# define nsh_spifi_initialize() (OK)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ /* Initialize the SPIFI block device */
+
+ return nsh_spifi_initialize();
+}
diff --git a/nuttx/configs/lpc4330-xplorer/src/up_ostest.c b/nuttx/configs/lpc4330-xplorer/src/up_ostest.c
new file mode 100644
index 000000000..f0988337a
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/up_ostest.c
@@ -0,0 +1,114 @@
+/************************************************************************************
+ * configs/lpc4330-xplorer/src/up_ostest.c
+ * arch/arm/src/board/up_ostest.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <debug.h>
+
+#include <arch/irq.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "xplorer-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+
+#undef HAVE_FPU
+#if defined(CONFIG_ARCH_FPU) && defined(CONFIG_EXAMPLES_OSTEST_FPUSIZE) && \
+ defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_DISABLE_SIGNALS) && \
+ !defined(CONFIG_ARMV7M_CMNVECTOR)
+# define HAVE_FPU 1
+#endif
+
+#ifdef HAVE_FPU
+
+#if CONFIG_EXAMPLES_OSTEST_FPUSIZE != (4*SW_FPU_REGS)
+# error "CONFIG_EXAMPLES_OSTEST_FPUSIZE has the wrong size"
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+static uint32_t g_saveregs[XCPTCONTEXT_REGS];
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+/* Given an array of size CONFIG_EXAMPLES_OSTEST_FPUSIZE, this function will return
+ * the current FPU registers.
+ */
+
+void arch_getfpu(FAR uint32_t *fpusave)
+{
+ irqstate_t flags;
+
+ /* Take a snapshot of the thread context right now */
+
+ flags = irqsave();
+ up_saveusercontext(g_saveregs);
+
+ /* Return only the floating register values */
+
+ memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
+ irqrestore(flags);
+}
+
+/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+ * will compare them and return true if they are identical.
+ */
+
+bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
+{
+ return memcmp(fpusave1, fpusave2, (4*SW_FPU_REGS)) == 0;
+}
+
+#endif /* HAVE_FPU */
diff --git a/nuttx/configs/lpc4330-xplorer/src/up_userleds.c b/nuttx/configs/lpc4330-xplorer/src/up_userleds.c
new file mode 100644
index 000000000..e7b4b1189
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/up_userleds.c
@@ -0,0 +1,157 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/src/up_userleds.c
+ * arch/arm/src/board/up_userleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "xplorer_internal.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED definitions **********************************************************/
+/* The LPC4330-Xplorer has 2 user-controllable LEDs labeled D2 an D3 in the
+ * schematic and on but referred to has LED1 and LED2 here, respectively.
+ *
+ * LED1 D2 GPIO1[12]
+ * LED2 D3 GPIO1[11]
+ *
+ * LEDs are pulled high to a low output illuminates the LED.
+ */
+
+/* Debug definitions ********************************************************/
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#ifdef CONFIG_DEBUG_LED
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define LED_VERBOSE 1
+# define ledvdbg lldbg
+# else
+# undef LED_VERBOSE
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: led_dumppins
+ ****************************************************************************/
+
+#ifdef LED_VERBOSE
+static void led_dumppins(FAR const char *msg)
+{
+ lpc43_pin_dump(PINCONFIG_LED1, msg);
+ lpc43_gpio_dump(GPIO_LED2, msg);
+}
+#else
+# define led_dumppins(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_ledinit
+ ****************************************************************************/
+
+void lpc43_ledinit(void)
+{
+ /* Configure all LED GPIO lines */
+
+ led_dumppins("lpc43_ledinit() Entry)");
+
+ /* Configure LED pins as GPIOs, then configure GPIOs as outputs */
+
+ lpc43_pin_config(PINCONFIG_LED1);
+ lpc43_gpio_config(GPIO_LED1);
+
+ lpc43_pin_config(PINCONFIG_LED2);
+ lpc43_gpio_config(GPIO_LED2);
+
+ led_dumppins("lpc43_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: lpc43_setled
+ ****************************************************************************/
+
+void lpc43_setled(int led, bool ledon)
+{
+ uint16_t gpiocfg = (led == BOARD_LED1 ? BOARD_LED1 : BOARD_LED2);
+ lpc43_gpio_write(GPIO_LED1, !ledon);
+}
+
+/****************************************************************************
+ * Name: lpc43_setleds
+ ****************************************************************************/
+
+void lpc43_setleds(uint8_t ledset)
+{
+ lpc43_gpio_write(BOARD_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ lpc43_gpio_write(BOARD_LED2, (ledset & BOARD_LED2_BIT) == 0);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lpc4330-xplorer/src/xplorer_internal.h b/nuttx/configs/lpc4330-xplorer/src/xplorer_internal.h
new file mode 100644
index 000000000..886382c65
--- /dev/null
+++ b/nuttx/configs/lpc4330-xplorer/src/xplorer_internal.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+ * configs/lpc4330-xplorer/src/xplorer_internal.h
+ * arch/arm/src/board/xplorer_internal.n
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef _CONFIGS_LPC4330_XPLORER_SRC_XPLORER_INTERNAL_H
+#define _CONFIGS_LPC4330_XPLORER_SRC_XPLORER_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "lpc43_pinconfig.h"
+#include "lpc43_gpio.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * LEDs GPIO PIN SIGNAL NAME
+ * -------------------------------- ------- --------------
+ * gpio1[12] - LED D2 J10-20 LED1
+ * gpio1[11] - LED D3 J10-17 LED2
+ ****************************************************************************/
+
+/* Definitions to configure LED pins as GPIOs:
+ *
+ * - Floating
+ * - Normal drive
+ * - No buffering, glitch filtering, slew=slow
+ */
+
+#define PINCONFIG_LED1 PINCONF_GPIO1p12
+#define PINCONFIG_LED2 PINCONF_GPIO1p11
+
+/* Definitions to configure LED GPIOs as outputs */
+
+#define GPIO_LED1 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_LED2 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN11)
+
+/****************************************************************************
+ * Buttons GPIO PIN SIGNAL NAME
+ * -------------------------------- ------- --------------
+ * gpio0[7] - User Button SW2 J8-25 BTN1
+ ****************************************************************************/
+
+#define LPC4330_XPLORER_BUT1 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN7)
+
+/* Button IRQ numbers */
+
+#define LPC4330_XPLORER_BUT1_IRQ LPC43_IRQ_P0p23
+
+#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
+#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
+#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
+#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
+
+/* We need to redefine USB_PWRD as GPIO to get USB Host working
+ * Also remember to add 2 resistors of 15K to D+ and D- pins.
+ */
+
+#ifdef CONFIG_USBHOST
+# ifdef GPIO_USB_PWRD
+# undef GPIO_USB_PWRD
+# define GPIO_USB_PWRD (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN22)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Lincoln 80 board.
+ *
+ ****************************************************************************/
+
+extern void weak_function lpc43_sspinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_LPC4330_XPLORER_SRC_XPLORER_INTERNAL_H */
diff --git a/nuttx/configs/lpcxpresso-lpc1768/Kconfig b/nuttx/configs/lpcxpresso-lpc1768/Kconfig
new file mode 100644
index 000000000..944df07b7
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LPCXPRESSO
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/lpcxpresso-lpc1768/README.txt b/nuttx/configs/lpcxpresso-lpc1768/README.txt
new file mode 100644
index 000000000..402d52881
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/README.txt
@@ -0,0 +1,793 @@
+README
+^^^^^^
+
+README for NuttX port to the Embedded Artists' base board with the NXP
+the LPCXpresso daughter board.
+
+Contents
+^^^^^^^^
+
+ LCPXpresso LPC1768 Board
+ Embedded Artist's Base Board
+ Development Environment
+ GNU Toolchain Options
+ NuttX buildroot Toolchain
+ Code Red IDE
+ LEDs
+ LPCXpresso Configuration Options
+ Configurations
+
+LCPXpresso LPC1768 Board
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+ Pin Description Connector On Board Base Board
+ -------------------------------- --------- -------------- ---------------------
+
+ P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
+ P0[1]/TD1/RXD3/SCL J6-10 RXD3/SCL1
+ P0[2]/TXD0/AD0[7] J6-21
+ P0[3]/RXD0/AD0[6] J6-22
+ P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
+ P0[5]/I2SRX-WS/TD2/CAP2.1 J6-39 CAN_TX2
+ P0[6]/I2SRX_SDA/SSEL1/MAT2[0] J6-8 SSEL1, OLED CS
+ P0[7]/I2STX_CLK/SCK1/MAT2[1] J6-7 SCK1, OLED SCK
+ P0[8]/I2STX_WS/MISO1/MAT2[2] J6-6 MISO1
+ P0[9]/I2STX_SDA/MOSI1/MAT2[3] J6-5 MOSI1, OLED data in
+ P0[10] J6-40 TXD2/SDA2
+ P0[11] J6-41 RXD2/SCL2
+ P0[15]/TXD1/SCK0/SCK J6-13 TXD1/SCK0
+ P0[16]/RXD1/SSEL0/SSEL J6-14 RXD1/SSEL0
+ P0[17]/CTS1/MISO0/MISO J6-12 MISO0
+ P0[18]/DCD1/MOSI0/MOSI J6-11 MOSI0
+ P0[19]/DSR1/SDA1 PAD17 N/A
+ P0[20]/DTR1/SCL1 PAD18 I2C E2PROM SCL N/A
+ P0[21]/RI1/MCIPWR/RD1 J6-23
+ P0[22]/RTS1/TD1 J6-24 LED
+ P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
+ P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
+ P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
+ P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT / RGB LED
+ P0[27]/SDA0/USB_SDA J6-25
+ P0[28]/SCL0 J6-26
+ P0[29]/USB_D+ J6-37 USB_D+
+ P0[30]/USB_D- J6-36 USB_D-
+
+ P1[0]/ENET-TXD0 J6-34? TXD0 TX-(Ethernet PHY)
+ P1[1]/ENET_TXD1 J6-35? TXD1 TX+(Ethernet PHY)
+ P1[4]/ENET_TX_EN TXEN N/A
+ P1[8]/ENET_CRS CRS_DV/MODE2 N/A
+ P1[9]/ENET_RXD0 J6-32? RXD0/MODE0 RD-(Ethernet PHY)
+ P1[10]/ENET_RXD1 J6-33? RXD1/MODE1 RD+(Ethernet PHY)
+ P1[14]/ENET_RX_ER RXER/PHYAD0 N/A
+ P1[15]/ENET_REF_CLK REFCLK N/A
+ P1[16]/ENET_MDC MDC N/A
+ P1[17]/ENET_MDIO MDIO N/A
+ P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] PAD1 N/A
+ P1[19]/MC0A/USB_PPWR/N_CAP1.1 PAD2 N/A
+ P1[20]/MCFB0/PWM1.2/SCK0 PAD3 N/A
+ P1[21]/MCABORT/PWM1.3/SSEL0 PAD4 N/A
+ P1[22]/MC0B/USB-PWRD/MAT1.0 PAD5 N/A
+ P1[23]/MCFB1/PWM1.4/MISO0 PAD6 N/A
+ P1[24]/MCFB2/PWM1.5/MOSI0 PAD7 N/A
+ P1[25]/MC1A/MAT1.1 PAD8 N/A
+ P1[26]/MC1B/PWM1.6/CAP0.0 PAD9 N/A
+ P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 PAD10 N/A
+ P1[28]/MC2A/PCAP1.0/MAT0.0 PAD11 N/A
+ P1[29]/MC2B/PCAP1.1/MAT0.1 PAD12 N/A
+ P1[30]/VBUS/AD0[4] J6-19 AD0.4
+ P1[31]/SCK1/AD0[5] J6-20 AD0.5
+
+ P2[0]/PWM1.1/TXD1 J6-42 PWM1.1 / RGB LED / RS422 RX
+ P2[1]/PWM1.2/RXD1 J6-43 PWM1.2 / OLED voltage / RGB LED
+ P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
+ P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
+ P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
+ P2[5]/PWM1[6]/DTR1/TRACEDATA[0] J6-47 PWM1.6
+ P2[6]/PCAP1[0]/RI1/TRACECLK J6-48
+ P2[7]/RD2/RTS1 J6-49 OLED command/data
+ P2[8]/TD2/TXD2 J6-50
+ P2[9]/USB_CONNECT/RXD2 PAD19 USB Pullup N/A
+ P2[10]/EINT0/NMI J6-51
+ P2[11]/EINT1/I2STX_CLK J6-52
+ P2[12]/EINT2/I2STX_WS j6-53
+ P2[13]/EINT3/I2STX_SDA J6-27
+
+ P3[25]/MAT0.0/PWM1.2 PAD13 N/A
+ P3[26]/STCLK/MAT0.1/PWM1.3 PAD14 N/A
+
+ P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
+ P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
+
+Embedded Artist's Base Board
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Jumpers
+-------
+
+ There are many jumpers on the base board. A usable combination is the
+ default jumper settings WITH the two J54 jumpers both removed. Those
+ jumpers are for ISP support and will cause the board to reset.
+
+ To use the SD, J55 must be set to provide chip select PIO1_11 signal as
+ the SD slot chip select.
+
+SD Slot
+-------
+
+ Base-board J4/J6 LPC1768
+ SD Signal Pin Pin
+ --- ----------- ----- --------
+ CS PIO1_11* 55 P2.2
+ DIN PIO0_9-MOSI 5 P0.9 MOSI1
+ DOUT PIO0_8-MISO 6 P0.8 MISO1
+ CLK PIO2_11-SCK 7 P0.9 SCK1
+ CD PIO2_10 52 P2.11
+
+ These jumper settings are required:
+
+ *J55 must be set to provide chip select PIO1_11 signal as the SD slot
+ chip select.
+
+USB Device
+----------
+
+ Base-board J4/J6 LPC1768
+ Signal Pin Pin
+ ------------------- ----- --------
+ PIO0_6-USB_CONNECT* 23 P0.21
+ USB_DM 36 USB_D-
+ USB_DP 37 USB_D+
+ PIO0_3-VBUS_SENSE** 39 P0.5
+
+ These jumper settings are listed for information only. They are *not*
+ required for use with NuttX and LPCXpresso. The configurable pins
+ (P0.21 and P0.5) are not used!
+
+ *J14 must be set to permit GPIO control of the USB connect pin
+ **J12 must be set to permit GPIO control of the USB vbus sense pin
+ J23 is associated the LEDs used for USB support
+
+ Here is a more detailed pin mapping:
+
+ ---------------------------------------------+------+-----------------------------------------------
+ LPCXpresso | J4/6 | Base Board
+ ---------------------------------------------| |-----------------------------------------------
+ LPC1768 Signal | | Signal Connection
+ ------------------------------ --------------+------+------------------- ---------------------------
+ P0.29/USB-D+ P0[29]/USB-D+ | 37 | USB_DP USB D+
+ P0.30/USB-D- P0[30]/USB-D- | 36 | USB_DM USB D-
+ P1.18/USB-UP-LED/PWM1.1/CAP1.0 PAD1 | N/A | N/A N/A
+ P1.30/VBUS/AD0.4 P1[30] | 19 | PIO1_3 (Not used on board)
+ P2.9/USB-CONNECT/RXD2* PAD19 | N/A | N/A N/A
+ ------------------------------ --------------+------+------------------- ---------------------------
+ P0.21/RI1/RD1 P0[21] | 23 | PIO0_6-USB_CONNECT VBUS via J14 and transistor
+ P0.5/I2SRX-WS/TD2/CAP2.1 P0[5] | 39 | PIO0_3-VBUS_SENSE VBUS via J12
+ ------------------------------ --------------+------+------------------- ---------------------------
+
+ *P2.9 connects to a transistor driven USB-D+ pullup on the LPCXpresso board.
+
+96x64 White OLED with I2C/SPI interface
+---------------------------------------
+ The OLED display can be connected either to the SPI-bus or the I2C-bus.
+
+ Jumper Settings:
+
+ - For the SPI interface (default), insert jumpers in J42, J43, J45 pin1-2
+ and J46 pin 1-2.
+ - For I2C interface, insert jumpers in J45 pin 2-3, J46 pin 2-3 and J47.
+
+ In either case insert a jumper in J44 in order to allow PIO1_10 to control
+ the OLED-voltage.
+
+ Jumper Signal Control:
+
+ J42: Short: SPI Open: I2C (Default: inserted)
+
+ J44: Allow control of OLED voltage (Default: inserted)
+
+ PIO1_10-------->J44 ---------->FAN5331
+
+ Common Reset:
+
+ PIO0_0-RESET ---------------> RES#
+
+ J43: Select OLED chip select
+ J58: For embed (Default: not inserted)
+
+ PIO0_2--------------->J43 ---->CS#
+ PIO2_7--------->J58 ->J43 ---->D/C#
+ PIO0_8-MISO --------^
+
+ J45: Select SPI or I2C clock (Default: SPI clock)
+
+ PIO2_11-SCK---->J45 ----------> D0
+ PIO0_4-SCL------------^
+
+ J46: Select serial data input (Default: SPI MOSI)
+
+ PIO0_9-MOSI---->J46 ----------> D1
+ I2C_SDA---------------^
+
+ J47: Allow I2C bi-directional communications (Default: SPI unidirectional)
+
+ PIO0_5-SDA---->J47 ----------> D2
+
+ LPCXpresso Signals
+
+ ----------------------------+-------+-------------- ----------------------------------------
+ LPC1758 Pin | J4/6 | Base Board Description
+ ----------------------------+-------+-------------- ----------------------------------------
+ P2.1/PWM1.2/RXD1 | 43 | PIO1_10 FAN5331 Power Control (SHDN#)
+ RESET_N | 4 | PIO0_0-RESET OLED reset (RES#) -- Resets EVERYTHING
+ P0.6/I2SRX-SDA/SSEL1/MAT2.0 | 8 | PIO0_2 OLED chip select (CS#)
+ P2.7/RD2/RTS1 | 49 | PIO2_7 OLED command/data (D/C#)
+ P0.7/I2STX-CLK/SCK1/MAT2.1 | 7 | PIO2_11-SCK OLED clock (D0)
+ P0.9/I2STX-SDA/MOSI1/MAT2.3 | 5 | PIO0_9-MOSI OLED data in (D1)
+ ----------------------------+-------+-------------- ----------------------------------------
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The Code Red GNU toolchain
+ 2. The CodeSourcery GNU toolchain,
+ 3. The devkitARM GNU toolchain,
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the Code Red toolchain and the
+ make system is setup to default to use the Code Red Linux toolchain. To use
+ the other toolchain, you simply need add one of the following configuration
+ options to your .config (or defconfig) file:
+
+ CONFIG_LPC17_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC17_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC17_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC17_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+ CONFIG_LPC17_CODEREDW=n : Code Red toolchain under Windows
+ CONFIG_LPC17_CODEREDL=y : Code Red toolchain under Linux
+
+ You may also have to modify the PATH in the setenv.h file if your make cannot
+ find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Code Red (for Windoes)
+ are Windows native toolchains. The CodeSourcey (for Linux), Code Red (for Linux)
+ and NuttX buildroot toolchains are Cygwin and/or Linux native toolchains. There
+ are several limitations to using a Windows based toolchain in a Cygwin
+ environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+Code Red IDE
+^^^^^^^^^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Linux Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc17xx,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc17x/lpc17_vectors.S.
+
+ Using Code Red GNU Tools from Cygwin
+ ------------------------------------
+
+ Under Cygwin, the Code Red command line tools (e.g., arm-non-eabi-gcc) cannot
+ be executed because the they only have execut privileges for Administrators. I
+ worked around this by:
+
+ Opening a native Cygwin RXVT as Administrator (Right click, "Run as administrator"),
+ then executing 'chmod 755 *.exe' in the following directories:
+
+ /cygdrive/c/nxp/lpcxpreeso_3.6/bin, and
+ /cygdrive/c/nxp/lpcxpreeso_3.6/Tools/bin
+
+ Command Line Flash Programming
+ ------------------------------
+
+ If using LPCLink as your debug connection, first of all boot the LPC-Link using
+ the script:
+
+ bin\Scripts\bootLPCXpresso type
+
+ where type = winusb for Windows XP, or type = hid for Windows Vista / 7.
+
+ Now run the flash programming utility with the following options
+
+ flash_utility wire -ptarget -flash-load[-exec]=filename [-load-base=base_address]
+
+ Where flash_utility is one of:
+
+ crt_emu_lpc11_13 (for LPC11xx or LPC13xx parts)
+ crt_emu_cm3_nxp (for LPC17xx parts)
+ crt_emu_a7_nxp (for LPC21/22/23/24 parts)
+ crt_emu_a9_nxp (for LPC31/32 and LPC29xx parts)
+ crt_emu_cm3_lmi (for TI Stellaris LM3S parts
+
+ wire is one of:
+
+ (empty) (for Red Probe+, Red Probe, RDB1768v1, or TI Stellaris evaluation boards)
+ -wire=hid (for RDB1768v2 without upgraded firmware)
+ -wire=winusb (for RDB1768v2 with upgraded firmware)
+ -wire=winusb (for LPC-Link on Windows XP)
+ -wire=hid (for LPC-Link on Windows Vista/ Windows 7)
+
+ target is the target chip name. For example LPC1343, LPC1114/301, LPC1768 etc.
+
+ filename is the file to flash program. It may be an executable (axf) or a binary
+ (bin) file. If using a binary file, the base_address must be specified.
+
+ base_address is the base load address when flash programming a binary file. It
+ should be specified as a hex value with a leading 0x.
+
+ Note:
+ - flash-load will leave the processor in a stopped state
+ - flash-load-exec will start execution of application as soon as download has
+ completed.
+
+ Examples
+ To load the executable file app.axf and start it executing on an LPC1758
+ target using Red Probe, use the following command line:
+
+ crt_emu_cm3_nxp -pLPC1758 -flash-load-exec=app.axf
+
+ To load the binary file binary.bin to address 0x1000 to an LPC1343 target
+ using LPC-Link on Windows XP, use the following command line:
+
+ crt_emu_lpc11_13_nxp -wire=hid -pLPC1343 -flash-load=binary.bin -load-base=0x1000
+
+ tools/flash.sh
+ --------------
+
+ All of the above steps are automated in the bash script flash.sh that can
+ be found in the configs/lpcxpresso/tools directory.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/projects/nuttx/files/).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lpcxpresso-lpc1768/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+NXFLAT Toolchain
+^^^^^^^^^^^^^^^^
+
+ If you are *not* using the NuttX buildroot toolchain and you want to use
+ the NXFLAT tools, then you will still have to build a portion of the buildroot
+ tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
+ be downloaded from the NuttX SourceForge download site
+ (https://sourceforge.net/projects/nuttx/files/).
+
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh lpcxpresso-lpc1768/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-nxflat .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly builtNXFLAT binaries.
+
+LEDs
+^^^^
+
+ If CONFIG_ARCH_LEDS is defined, then support for the LPCXpresso LEDs will be
+ included in the build. See:
+
+ - configs/lpcxpresso-lpc1768/include/board.h - Defines LED constants, types and
+ prototypes the LED interface functions.
+
+ - configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h - GPIO settings for the LEDs.
+
+ - configs/lpcxpresso-lpc1768/src/up_leds.c - LED control logic.
+
+ The LPCXpresso LPC1768 has a single LEDs (there are more on the Embedded Artists
+ base board, but those are not controlled by NuttX). Usage this single LED by NuttX
+ is as follows:
+
+ - The LED is not illuminated until the LPCXpresso completes initialization.
+
+ If the LED is stuck in the OFF state, this means that the LPCXpresso did not
+ complete intialization.
+
+ - Each time the OS enters an interrupt (or a signal) it will turn the LED OFF and
+ restores its previous stated upon return from the interrupt (or signal).
+
+ The normal state, after initialization will be a dull glow. The brightness of
+ the glow will be inversely related to the proportion of time spent within interrupt
+ handling logic. The glow may decrease in brightness when the system is very
+ busy handling device interrupts and increase in brightness as the system becomes
+ idle.
+
+ Stuck in the OFF state suggests that that the system never completed
+ initialization; Stuck in the ON state would indicated that the system
+ intialialized, but is not takint interrupts.
+
+ - If a fatal assertion or a fatal unhandled exception occurs, the LED will flash
+ strongly as a slow, 2Hz rate.
+
+LPCXpresso Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc17xx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LPC1768=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LPCEXPRESSO=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x10000000
+
+ CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ CONFIG_LPC17_MAINOSC=y
+ CONFIG_LPC17_PLL0=y
+ CONFIG_LPC17_PLL1=n
+ CONFIG_LPC17_ETHERNET=n
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_LPC17_USBOTG=n
+ CONFIG_LPC17_USBDEV=n
+ CONFIG_LPC17_UART0=y
+ CONFIG_LPC17_UART1=n
+ CONFIG_LPC17_UART2=n
+ CONFIG_LPC17_UART3=n
+ CONFIG_LPC17_CAN1=n
+ CONFIG_LPC17_CAN2=n
+ CONFIG_LPC17_SPI=n
+ CONFIG_LPC17_SSP0=n
+ CONFIG_LPC17_SSP1=n
+ CONFIG_LPC17_I2C0=n
+ CONFIG_LPC17_I2C1=n
+ CONFIG_LPC17_I2S=n
+ CONFIG_LPC17_TMR0=n
+ CONFIG_LPC17_TMR1=n
+ CONFIG_LPC17_TMR2=n
+ CONFIG_LPC17_TMR3=n
+ CONFIG_LPC17_RIT=n
+ CONFIG_LPC17_PWM=n
+ CONFIG_LPC17_MCPWM=n
+ CONFIG_LPC17_QEI=n
+ CONFIG_LPC17_RTC=n
+ CONFIG_LPC17_WDT=n
+ CONFIG_LPC17_ADC=n
+ CONFIG_LPC17_DAC=n
+ CONFIG_LPC17_GPDMA=n
+ CONFIG_LPC17_FLASH=n
+
+ LPC17xx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ LPC17xx specific CAN device driver settings. These settings all
+ require CONFIG_CAN:
+
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
+ CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
+
+ LPC17xx specific PHY/Ethernet device driver settings. These setting
+ also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
+
+ CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+
+ CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ LPC17xx USB Device Configuration
+
+ CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+ CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+ CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in SRAM.
+ CONFIG_LPC17_USBDEV_DMA
+ Enable lpc17xx-specific DMA support
+ CONFIG_LPC17_USBDEV_NOVBUS
+ Define if the hardware implementation does not support the VBUS signal
+ CONFIG_LPC17_USBDEV_NOLED
+ Define if the hardware implementation does not support the LED output
+
+ LPC17xx USB Host Configuration (the LPCXpresso does not support USB Host)
+
+ CONFIG_USBHOST_OHCIRAM_SIZE
+ Total size of OHCI RAM (in AHB SRAM Bank 1)
+ CONFIG_USBHOST_NEDS
+ Number of endpoint descriptors
+ CONFIG_USBHOST_NTDS
+ Number of transfer descriptors
+ CONFIG_USBHOST_TDBUFFERS
+ Number of transfer descriptor buffers
+ CONFIG_USBHOST_TDBUFSIZE
+ Size of one transfer descriptor buffer
+ CONFIG_USBHOST_IOBUFSIZE
+ Size of one end-user I/O buffer. This can be zero if the
+ application can guarantee that all end-user I/O buffers
+ reside in AHB SRAM.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each LPCXpresso configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh lpcxpresso-lpc1768/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ dhcpd:
+ This builds the DCHP server using the apps/examples/dhcpd application
+ (for execution from FLASH.) See apps/examples/README.txt for information
+ about the dhcpd example.
+
+ Jumpers: Nothing special. Use the default base board jumper
+ settings.
+
+ nsh:
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+ Support for the board's SPI-based MicroSD card is included
+ (but not passing tests as of this writing).
+
+ NOTE: At present, the value for the SD SPI frequency is too
+ high and the SD will fail. Setting that frequency to 400000
+ removes the problem. TODO: Tune this frequency to some optimal
+ value.
+
+ Jumpers: J55 must be set to provide chip select PIO1_11 signal as
+ the SD slot chip select.
+
+ nx:
+ And example using the NuttX graphics system (NX). This example
+ uses the UG-9664HSWAG01 driver.
+
+ Jumpers: There are several jumper settings needed by the OLED.
+ All are the default settings:
+
+ J42: Close to select the SPI interface (Default: closed)
+ J43: Close to support OLED command/data select (Default: closed)
+ J44: Close to allow control of OLED voltage (Default: closed)
+ J45: Close to select SPI clock (Default: closed)
+ J46: Close SPI data input (MOSI) (Default:closed)
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ Jumpers: Nothing special. Use the default base board jumper
+ settings.
+
+ thttpd:
+ This builds the THTTPD web server example using the THTTPD and
+ the apps/examples/thttpd application.
+
+ NOTE: You will need to build the NXFLAT toolchain as described
+ above in order to use this example.
+
+ Jumpers: Nothing special. Use the default base board jumper
+ settings.
+
+ usbstorage:
+ This configuration directory exercises the USB mass storage
+ class driver at apps/examples/usbstorage. See apps/examples/README.txt
+ for more information.
+
+ NOTE: At present, the value for the SD SPI frequency is too
+ high and the SD will fail. Setting that frequency to 400000
+ removes the problem. TODO: Tune this frequency to some optimal
+ value.
+
+ Jumpers: J55 must be set to provide chip select PIO1_11 signal as
+ the SD slot chip select.
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/Make.defs b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/Make.defs
new file mode 100644
index 000000000..2c91b76b5
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/dhcpd/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+ifeq ($(CONFIG_LPC17_CODEREDW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+endif
+ifeq ($(CONFIG_LPC17_CODEREDL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/dhcpd/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/dhcpd/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/appconfig b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/appconfig
new file mode 100644
index 000000000..76a9d2e71
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/dhcpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/dhcpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/dhcpd
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig
new file mode 100755
index 000000000..c2d7fc336
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig
@@ -0,0 +1,481 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/dhcpd/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="lpcxpresso-lpc1768"
+CONFIG_ARCH_BOARD_LPCXPRESSO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+CONFIG_LPC17_CODEREDW=n
+CONFIG_LPC17_CODEREDL=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=n
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=y
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="dhcpd_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=17
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=y
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+CONFIG_LPC17_USBDEV_NOVBUS=y
+CONFIG_LPC17_USBDEV_NOLED=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/dhcpd
+#
+CONFIG_EXAMPLE_DHCPD_NOMAC=y
+CONFIG_EXAMPLE_DHCPD_IPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/ld.script b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/ld.script
new file mode 100755
index 000000000..d8f444475
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/ld.script
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/dhcpd/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/setenv.sh b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/setenv.sh
new file mode 100755
index 000000000..6bc6e10c9
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/lpcxpresso-lpc1768/dhcpd/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+# This is where the buildroot might reside on a Linux or Cygwin system
+# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the default install location for Code Red on Linux
+export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
+
+# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
+#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
+
+# This is the path to the LPCXpression tool subdirectory
+export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lpcxpresso-lpc1768/include/board.h b/nuttx/configs/lpcxpresso-lpc1768/include/board.h
new file mode 100644
index 000000000..10af5dfc1
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/include/board.h
@@ -0,0 +1,290 @@
+/************************************************************************************
+ * configs/lpcxpresso-lpc1768/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* NOTE: The following definitions require lpc17_syscon.h. It is not included here
+ * because the including C file may not have that file in its include path.
+ */
+
+#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
+#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
+#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency */
+#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
+
+/* This is the clock setup we configure for:
+ *
+ * SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
+ * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6
+ */
+
+#define LPC17_CCLK 80000000 /* 80Mhz */
+
+/* Select the main oscillator as the frequency source. SYSCLK is then the frequency
+ * of the main oscillator.
+ */
+
+#undef CONFIG_LPC17_MAINOSC
+#define CONFIG_LPC17_MAINOSC 1
+#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
+
+/* Select the main oscillator and CCLK divider. The output of the divider is CCLK.
+ * The input to the divider (PLLCLK) will be determined by the PLL output.
+ */
+
+#define BOARD_CCLKCFG_DIVIDER 6
+#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
+
+/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
+ *
+ * Source clock: Main oscillator
+ * PLL0 Multiplier value (M): 20
+ * PLL0 Pre-divider value (N): 1
+ *
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
+ */
+
+#undef CONFIG_LPC17_PLL0
+#define CONFIG_LPC17_PLL0 1
+#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
+
+#define BOARD_PLL0CFG_MSEL 20
+#define BOARD_PLL0CFG_NSEL 1
+#define BOARD_PLL0CFG_VALUE \
+ (((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
+
+/* PLL1 -- Not used. */
+
+#undef CONFIG_LPC17_PLL1
+#define BOARD_PLL1CFG_MSEL 36
+#define BOARD_PLL1CFG_NSEL 1
+#define BOARD_PLL1CFG_VALUE \
+ (((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
+
+/* USB divider. This divider is used when PLL1 is not enabled to get the
+ * USB clock from PLL0:
+ *
+ * USBCLK = PLL0CLK / 10 = 48MHz
+ */
+
+#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
+
+/* FLASH Configuration */
+
+#undef CONFIG_LP17_FLASH
+#define CONFIG_LP17_FLASH 1
+#define BOARD_FLASHCFG_VALUE 0x0000303a
+
+/* Ethernet configuration */
+
+//#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV44
+#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV20
+
+/* LED definitions ******************************************************************/
+/* The LPCXpresso LPC1768 board has a single red LED (there are additional LEDs on
+ * the base board not considered here).
+ */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF ON (never happens) */
+#define LED_HEAPALLOCATE 0 /* OFF ON (never happens) */
+#define LED_IRQSENABLED 0 /* OFF ON (never happens) */
+#define LED_STACKCREATED 1 /* ON ON (never happens) */
+#define LED_INIRQ 2 /* OFF NC (momentary) */
+#define LED_SIGNAL 2 /* OFF NC (momentary) */
+#define LED_ASSERTION 2 /* OFF NC (momentary) */
+#define LED_PANIC 0 /* OFF ON (1Hz flashing) */
+
+/* Alternate pin selections *********************************************************/
+/* Pin Description Connector On Board Base Board
+ * -------------------------------- --------- -------------- ---------------------
+ * P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
+ * P0[1]/TD1/RXD3/SCL J6-10 RXD3/SCL1
+ * P0[2]/TXD0/AD0[7] J6-21
+ * P0[3]/RXD0/AD0[6] J6-22
+ * P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
+ * P0[5]/I2SRX-WS/TD2/CAP2.1 J6-39 CAN_TX2
+ * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] J6-8 SSEL1, OLED CS
+ * P0[7]/I2STX_CLK/SCK1/MAT2[1] J6-7 SCK1, OLED SCK
+ * P0[8]/I2STX_WS/MISO1/MAT2[2] J6-6 MISO1
+ * P0[9]/I2STX_SDA/MOSI1/MAT2[3] J6-5 MOSI1, OLED data in
+ * P0[10] J6-40 TXD2/SDA2
+ * P0[11] J6-41 RXD2/SCL2
+ * P0[15]/TXD1/SCK0/SCK J6-13 TXD1/SCK0
+ * P0[16]/RXD1/SSEL0/SSEL J6-14 RXD1/SSEL0
+ * P0[17]/CTS1/MISO0/MISO J6-12 MISO0
+ * P0[18]/DCD1/MOSI0/MOSI J6-11 MOSI0
+ * P0[19]/DSR1/SDA1 PAD17 N/A
+ * P0[20]/DTR1/SCL1 PAD18 I2C E2PROM SCL N/A
+ * P0[21]/RI1/MCIPWR/RD1 J6-23
+ * P0[22]/RTS1/TD1 J6-24 LED
+ * P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
+ * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
+ * P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
+ * P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT / RGB LED
+ * P0[27]/SDA0/USB_SDA J6-25
+ * P0[28]/SCL0 J6-26
+ * P0[29]/USB_D+ J6-37 USB_D+
+ * P0[30]/USB_D- J6-36 USB_D-
+ */
+
+#define GPIO_UART3_TXD GPIO_UART3_TXD_1
+#define GPIO_I2C1_SDA GPIO_I2C1_SDA_1
+#define GPIO_UART3_RXD GPIO_UART3_RXD_1
+#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
+#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1
+#define GPIO_UART2_TXD GPIO_UART2_TXD_1
+#define GPIO_UART2_RXD GPIO_UART2_RXD_1
+#define GPIO_UART1_TXD GPIO_UART1_TXD_1
+#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
+#define GPIO_UART1_RXD GPIO_UART1_RXD_1
+#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
+#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
+#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
+
+/* P1[0]/ENET-TXD0 J6-34? TXD0 TX-(Ethernet PHY)
+ * P1[1]/ENET_TXD1 J6-35? TXD1 TX+(Ethernet PHY)
+ * P1[4]/ENET_TX_EN TXEN N/A
+ * P1[8]/ENET_CRS CRS_DV/MODE2 N/A
+ * P1[9]/ENET_RXD0 J6-32? RXD0/MODE0 RD-(Ethernet PHY)
+ * P1[10]/ENET_RXD1 J6-33? RXD1/MODE1 RD+(Ethernet PHY)
+ * P1[14]/ENET_RX_ER RXER/PHYAD0 N/A
+ * P1[15]/ENET_REF_CLK REFCLK N/A
+ * P1[16]/ENET_MDC MDC N/A
+ * P1[17]/ENET_MDIO MDIO N/A
+ * P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] PAD1 N/A
+ * P1[19]/MC0A/USB_PPWR/N_CAP1.1 PAD2 N/A
+ * P1[20]/MCFB0/PWM1.2/SCK0 PAD3 N/A
+ * P1[21]/MCABORT/PWM1.3/SSEL0 PAD4 N/A
+ * P1[22]/MC0B/USB-PWRD/MAT1.0 PAD5 N/A
+ * P1[23]/MCFB1/PWM1.4/MISO0 PAD6 N/A
+ * P1[24]/MCFB2/PWM1.5/MOSI0 PAD7 N/A
+ * P1[25]/MC1A/MAT1.1 PAD8 N/A
+ * P1[26]/MC1B/PWM1.6/CAP0.0 PAD9 N/A
+ * P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 PAD10 N/A
+ * P1[28]/MC2A/PCAP1.0/MAT0.0 PAD11 N/A
+ * P1[29]/MC2B/PCAP1.1/MAT0.1 PAD12 N/A
+ * P1[30]/VBUS/AD0[4] J6-19 AD0.4
+ * P1[31]/SCK1/AD0[5] J6-20 AD0.5
+ */
+
+#define GPIO_ENET_MDC GPIO_ENET_MDC_1
+#define GPIO_ENET_MDIO GPIO_ENET_MDIO_1
+
+/* P2[0]/PWM1.1/TXD1 J6-42 PWM1.1 / RGB LED / RS422 RX
+ * P2[1]/PWM1.2/RXD1 J6-43 PWM1.2 / OLED voltage / RGB LED / RS422 RX
+ * P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
+ * P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
+ * P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
+ * P2[5]/PWM1[6]/DTR1/TRACEDATA[0] J6-47 PWM1.6
+ * P2[6]/PCAP1[0]/RI1/TRACECLK J6-48
+ * P2[7]/RD2/RTS1 J6-49 OLED command/data
+ * P2[8]/TD2/TXD2 J6-50
+ * P2[9]/USB_CONNECT/RXD2 PAD19 USB Pullup N/A
+ * P2[10]/EINT0/NMI J6-51
+ * P2[11]/EINT1/I2STX_CLK J6-52
+ * P2[12]/EINT2/I2STX_WS J6-53
+ * P2[13]/EINT3/I2STX_SDA J6-27
+ */
+
+#define GPIO_PWM1p1 GPIO_PWM1p1_2
+#define GPIO_PWM1p2 GPIO_PWM1p2_2
+#define GPIO_PWM1p3 GPIO_PWM1p3_2
+#define GPIO_PWM1p4 GPIO_PWM1p4_2
+#define GPIO_PWM1p5 GPIO_PWM1p5_2
+#define GPIO_PWM1p6 GPIO_PWM1p6_2
+
+/* P3[25]/MAT0.0/PWM1.2 PAD13 N/A
+ * P3[26]/STCLK/MAT0.1/PWM1.3 PAD14 N/A
+ *
+ * P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
+ * P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void lpc17_boardinitialize(void);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/Make.defs b/nuttx/configs/lpcxpresso-lpc1768/nsh/Make.defs
new file mode 100644
index 000000000..7a29f7043
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/nsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+ifeq ($(CONFIG_LPC17_CODEREDW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+endif
+ifeq ($(CONFIG_LPC17_CODEREDL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/appconfig b/nuttx/configs/lpcxpresso-lpc1768/nsh/appconfig
new file mode 100644
index 000000000..1b4a2e23c
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/appconfig
@@ -0,0 +1,58 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig b/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig
new file mode 100755
index 000000000..425c4134e
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig
@@ -0,0 +1,491 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/nsh/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="lpcxpresso-lpc1768"
+CONFIG_ARCH_BOARD_LPCXPRESSO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+CONFIG_LPC17_CODEREDW=n
+CONFIG_LPC17_CODEREDL=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=n
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=y
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=y
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_EMACRAM_SIZE=8192
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=12
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+# USB Host Configuration
+#
+CONFIG_USBHOST=n
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+CONFIG_LPC17_USBDEV_NOVBUS=y
+CONFIG_LPC17_USBDEV_NOLED=y
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=1536
+CONFIG_USBHOST_NEDS=2
+CONFIG_USBHOST_NTDS=3
+CONFIG_USBHOST_TDBUFFERS=3
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=512
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/ld.script b/nuttx/configs/lpcxpresso-lpc1768/nsh/ld.script
new file mode 100755
index 000000000..f37c4accb
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/ld.script
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/setenv.sh b/nuttx/configs/lpcxpresso-lpc1768/nsh/setenv.sh
new file mode 100755
index 000000000..77f745c76
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/lpcxpresso-lpc1768/nsh/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+# This is where the buildroot might reside on a Linux or Cygwin system
+# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the default install location for Code Red on Linux
+export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
+
+# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
+#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
+
+# This is the path to the LPCXpression tool subdirectory
+export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/Make.defs b/nuttx/configs/lpcxpresso-lpc1768/nx/Make.defs
new file mode 100644
index 000000000..061d4ff68
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nx/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/nx/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+ifeq ($(CONFIG_LPC17_CODEREDW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+endif
+ifeq ($(CONFIG_LPC17_CODEREDL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/appconfig b/nuttx/configs/lpcxpresso-lpc1768/nx/appconfig
new file mode 100644
index 000000000..a590ace67
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/nx/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig b/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig
new file mode 100755
index 000000000..c0289a08f
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig
@@ -0,0 +1,543 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/nx/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="lpcxpresso-lpc1768"
+CONFIG_ARCH_BOARD_LPCXPRESSO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+CONFIG_LPC17_CODEREDW=n
+CONFIG_LPC17_CODEREDL=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=n
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=y
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=y
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General SPI interface configuration
+#
+CONFIG_SPI_CMDDATA=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_LCD_UGDEBUG=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=18
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+CONFIG_LPC17_USBDEV_NOVBUS=y
+CONFIG_LPC17_USBDEV_NOLED=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=n
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=y
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=2
+CONFIG_LCD_MAXCONTRAST=255
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+CONFIG_NXTK_BORDERWIDTH=2
+CONFIG_NXTK_BORDERCOLOR1=1
+CONFIG_NXTK_BORDERCOLOR2=0
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Univision UG-9664HSWAG01 OLED Driver Configuration
+#
+# UG-9664HSWAG01 Configuration Settings:
+#
+CONFIG_LCD_UG9664HSWAG01=y
+CONFIG_UG9664HSWAG01_SPIMODE=0
+CONFIG_UG9664HSWAG01_FREQUENCY=3500000
+CONFIG_UG9664HSWAG01_NINTERFACES=1
+CONFIG_UG9664HSWAG01_POWER=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT=4
+CONFIG_EXAMPLES_NX_BGCOLOR=0
+CONFIG_EXAMPLES_NX_COLOR1=1
+CONFIG_EXAMPLES_NX_COLOR2=1
+CONFIG_EXAMPLES_NX_TBCOLOR=1
+CONFIG_EXAMPLES_NX_FONTCOLOR=0
+CONFIG_EXAMPLES_NX_BPP=1
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=y
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/ld.script b/nuttx/configs/lpcxpresso-lpc1768/nx/ld.script
new file mode 100755
index 000000000..f1a49e3aa
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nx/ld.script
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/nx/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/setenv.sh b/nuttx/configs/lpcxpresso-lpc1768/nx/setenv.sh
new file mode 100755
index 000000000..711d92ea4
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/nx/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/lpcxpresso-lpc1768/nx/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+# This is where the buildroot might reside on a Linux or Cygwin system
+# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the default install location for Code Red on Linux
+export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
+
+# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
+#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
+
+# This is the path to the LPCXpression tool subdirectory
+export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/Make.defs b/nuttx/configs/lpcxpresso-lpc1768/ostest/Make.defs
new file mode 100644
index 000000000..496c54be4
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+ifeq ($(CONFIG_LPC17_CODEREDW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+endif
+ifeq ($(CONFIG_LPC17_CODEREDL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/appconfig b/nuttx/configs/lpcxpresso-lpc1768/ostest/appconfig
new file mode 100644
index 000000000..f20cf33dc
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig b/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig
new file mode 100755
index 000000000..0c5104ca7
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig
@@ -0,0 +1,469 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/ostest/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="lpcxpresso-lpc1768"
+CONFIG_ARCH_BOARD_LPCXPRESSO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+CONFIG_LPC17_CODEREDW=n
+CONFIG_LPC17_CODEREDL=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=n
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=y
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+CONFIG_LPC17_USBDEV_NOVBUS=y
+CONFIG_LPC17_USBDEV_NOLED=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/ld.script b/nuttx/configs/lpcxpresso-lpc1768/ostest/ld.script
new file mode 100755
index 000000000..da29a1482
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/ld.script
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/setenv.sh b/nuttx/configs/lpcxpresso-lpc1768/ostest/setenv.sh
new file mode 100755
index 000000000..db976c946
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/lpcxpresso-lpc1768/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+# This is where the buildroot might reside on a Linux or Cygwin system
+# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the default install location for Code Red on Linux
+export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
+
+# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
+#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
+
+# This is the path to the LPCXpression tool subdirectory
+export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/Makefile b/nuttx/configs/lpcxpresso-lpc1768/src/Makefile
new file mode 100644
index 000000000..7384b04d4
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/Makefile
@@ -0,0 +1,96 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c up_ssp.c
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_NX_LCDDRIVER),y)
+CSRCS += up_oled.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h b/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h
new file mode 100644
index 000000000..41ec1ce11
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h
@@ -0,0 +1,236 @@
+/************************************************************************************
+ * configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h
+ * arch/arm/src/board/lpcxpresso_internal.n
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_LPCXPRESSO_LPC1768_SRC_LPCXPRESSO_INTERNAL_H
+#define _CONFIGS_LPCXPRESSO_LPC1768_SRC_LPCXPRESSO_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* LPCXpresso LPC1768 board pin usage ***********************************************/
+/* Pin Description Connector On Board Base Board
+ * -------------------------------- --------- -------------- ---------------------
+ * P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
+ * P0[1]/TD1/RXD3/SCL J6-10 RXD2/SCL1
+ * P0[2]/TXD0/AD0[7] J6-21
+ * P0[3]/RXD0/AD0[6] J6-22
+ * P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
+ * P0[5]/I2SRX-WS/TD2/CAP2.1 J6-39 CAN_TX2
+ * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] J6-8 SSEL1
+ * P0[7]/I2STX_CLK/SCK1/MAT2[1] J6-7 SCK1
+ * P0[8]/I2STX_WS/MISO1/MAT2[2] J6-6 MISO1
+ * P0[9]/I2STX_SDA/MOSI1/MAT2[3] J6-5 MOSI1
+ * P0[10] J6-40 TXD2/SDA2
+ * P0[11] J6-41 RXD2/SCL2
+ * P0[15]/TXD1/SCK0/SCK J6-13 TXD1/SCK0
+ * P0[16]/RXD1/SSEL0/SSEL J6-14 RXD1/SSEL0
+ * P0[17]/CTS1/MISO0/MISO J6-12 MISO0
+ * P0[18]/DCD1/MOSI0/MOSI J6-11 MOSI0
+ * P0[19]/DSR1/SDA1 PAD17 N/A
+ * P0[20]/DTR1/SCL1 PAD18 I2C E2PROM SCL N/A
+ * P0[21]/RI1/MCIPWR/RD1 J6-23
+ * P0[22]/RTS1/TD1 J6-24 LED
+ * P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
+ * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
+ * P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
+ * P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT
+ * P0[27]/SDA0/USB_SDA J6-25
+ * P0[28]/SCL0 J6-26
+ * P0[29]/USB_D+ J6-37 USB_D+
+ * P0[30]/USB_D- J6-36 USB_D-
+ */
+
+#define LPCXPRESSO_I2C1_EPROM_SDA GPIO_I2C1_SDA_1
+#define LPCXPRESSO_I2C1_EPROM_SDL GPIO_I2C1_SCL_2
+#define LPCXPRESSO_LED (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT0 | GPIO_PIN22)
+
+/* P1[0]/ENET-TXD0 J6-34? TXD0 TX-(Ethernet PHY)
+ * P1[1]/ENET_TXD1 J6-35? TXD1 TX+(Ethernet PHY)
+ * P1[4]/ENET_TX_EN TXEN N/A
+ * P1[8]/ENET_CRS CRS_DV/MODE2 N/A
+ * P1[9]/ENET_RXD0 J6-32? RXD0/MODE0 RD-(Ethernet PHY)
+ * P1[10]/ENET_RXD1 J6-33? RXD1/MODE1 RD+(Ethernet PHY)
+ * P1[14]/ENET_RX_ER RXER/PHYAD0 N/A
+ * P1[15]/ENET_REF_CLK REFCLK N/A
+ * P1[16]/ENET_MDC MDC N/A
+ * P1[17]/ENET_MDIO MDIO N/A
+ * P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] PAD1 N/A
+ * P1[19]/MC0A/USB_PPWR/N_CAP1.1 PAD2 N/A
+ * P1[20]/MCFB0/PWM1.2/SCK0 PAD3 N/A
+ * P1[21]/MCABORT/PWM1.3/SSEL0 PAD4 N/A
+ * P1[22]/MC0B/USB-PWRD/MAT1.0 PAD5 N/A
+ * P1[23]/MCFB1/PWM1.4/MISO0 PAD6 N/A
+ * P1[24]/MCFB2/PWM1.5/MOSI0 PAD7 N/A
+ * P1[25]/MC1A/MAT1.1 PAD8 N/A
+ * P1[26]/MC1B/PWM1.6/CAP0.0 PAD9 N/A
+ * P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 PAD10 N/A
+ * P1[28]/MC2A/PCAP1.0/MAT0.0 PAD11 N/A
+ * P1[29]/MC2B/PCAP1.1/MAT0.1 PAD12 N/A
+ * P1[30]/VBUS/AD0[4] J6-19 AD0.4
+ * P1[31]/SCK1/AD0[5] J6-20 AD0.5
+ *
+ * P2[0]/PWM1.1/TXD1 J6-42 PWM1.1
+ * P2[1]/PWM1.2/RXD1 J6-43 PWM1.2
+ * P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
+ * P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
+ * P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
+ * P2[5]/PWM1[6]/DTR1/TRACEDATA[0] J6-47 PWM1.6
+ * P2[6]/PCAP1[0]/RI1/TRACECLK J6-48
+ * P2[7]/RD2/RTS1 J6-49
+ * P2[8]/TD2/TXD2 J6-50
+ * P2[9]/USB_CONNECT/RXD2 PAD19 USB Pullup N/A
+ * P2[10]/EINT0/NMI J6-51
+ * P2[11]/EINT1/I2STX_CLK J6-52
+ * P2[12]/EINT2/I2STX_WS J6-53
+ * P2[13]/EINT3/I2STX_SDA J6-27
+ */
+
+#define LPCXPRESSO_USB_PULLUP (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN9)
+
+/* P3[25]/MAT0.0/PWM1.2 PAD13 N/A
+ * P3[26]/STCLK/MAT0.1/PWM1.3 PAD14 N/A
+ *
+ * P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
+ * P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
+ */
+
+/* SD Slot
+ *
+ * Base-board J4/J6 LPC1768
+ * SD Signal Pin Pin
+ * --- ----------- ----- --------
+ * CS PIO1_11* 55 P2.2 (See LPCXPRESSO_SD_CS)
+ * DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in lpc17_internal.h)
+ * DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in lpc17_internal.h)
+ * CLK PIO2_11-SCK 7 P0.9 SCK1 (See GPIO_SSP1_SCK in board.h)
+ * CD PIO2_10 52 P2.11 (See LPCXPRESSO_SD_CD)
+ */
+
+#define LPCXPRESSO_SD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN2)
+#ifdef CONFIG_GPIO_IRQ
+# define LPCXPRESSO_SD_CD (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11)
+#else
+# define LPCXPRESSO_SD_CD (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11)
+#endif
+
+/* USB:
+ *
+ * Base-board J4/J6 LPC1768
+ * Signal Pin Pin
+ * ------------------- ----- --------
+ * USB_DM 36 P0.30/USB-D-
+ * USB_DP 37 P0.29/USB-D+
+ * N/C N/C P1.18/USB-UP-LED/PWM1.1/CAP1.0
+ * PIO1_3 (not used) 19 P1.30/VBUS/AD0.4
+ * N/C N/C P2.9/USB-CONNECT/RXD2 (See Notes)
+ * ------------------- ----- --------
+ * PIO0_6-USB_CONNECT* 23 P0.21/RI1/RD1
+ * PIO0_3-VBUS_SENSE 39 P0.5/I2SRX-WS/TD2/CAP2.1
+ *
+ * Notes:
+ * - The standard USB CONNECT (P0.9) provides USB D+ pullup on board the
+ * LPCXpresso card; it should be un-necessary to use the based board
+ * version of the pullup.
+ * - No changes to jumper settings are required. There are few USB-
+ * related jumpers on the based board, but none are required:
+ * - J14 must be set to permit GPIO control of the base board USB
+ * connect pin. NOT USED
+ * - J12 must be set to permit GPIO control of the USB vbus sense pin
+ * - The standard VBUS (P1.30) is not connected. As a consequence, the
+ * USB driver will not correctly respond to USB insertion or removal
+ * events.
+ * - The standard USB LED (P1.18) is not connected.
+ */
+
+#define LPCXPRESSO_USB_CONNECT (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)
+#ifdef CONFIG_GPIO_IRQ
+# define LPCXPRESSO_USB_VBUSSENSE (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
+#else
+# define LPCXPRESSO_USB_VBUSSENSE (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
+#endif
+
+/* 96x64 White OLED with I2C/SPI interface
+ *
+ * ----------------------------+-------+-------------- -----------------------------
+ * LPC1758 Pin | J4/6 | Base Board Description
+ * ----------------------------+-------+-------------- -----------------------------
+ * P2.1/PWM1.2/RXD1 | 43 | PIO1_10 FAN5331 Power Control (SHDN#)
+ * P0.6/I2SRX-SDA/SSEL1/MAT2.0 | 8 | PIO0_2 OLED chip select (CS#)
+ * P2.7/RD2/RTS1 | 49 | PIO2_7 OLED command/data (D/C#)
+ * P0.7/I2STX-CLK/SCK1/MAT2.1 | 7 | PIO2_11-SCK OLED clock (D0)
+ * P0.9/I2STX-SDA/MOSI1/MAT2.3 | 5 | PIO0_9-MOSI OLED data in (D1)
+ * ----------------------------+-------+-------------- -----------------------------
+ */
+
+#define LPCXPRESSO_OLED_POWER (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN1)
+#define LPCXPRESSO_OLED_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN6)
+#define LPCXPRESSO_OLED_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN7)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LPCXpresso board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc17_sspinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_LPCXPRESSO_LPC1768_SRC_LPCXPRESSO_INTERNAL_H */
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c
new file mode 100644
index 000000000..f672c4517
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/lpcxpresso-lpc1768/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+#include "lpcxpresso_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc17_boardinitialize(void)
+{
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function lpc17_sspinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+ if (lpc17_sspinitialize)
+ {
+ lpc17_sspinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c
new file mode 100644
index 000000000..cebf3a143
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c
@@ -0,0 +1,157 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+#include "lpcxpresso_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static bool g_ncstate;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure all LED GPIO lines */
+
+ lpc17_configgpio(LPCXPRESSO_LED);
+ g_ncstate = true;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ bool off;
+
+ switch (led)
+ {
+ case 0:
+ case 2:
+ off = true;
+ break;
+
+ case 1:
+ off = false;
+ g_ncstate = false;
+ break;
+
+ default:
+ return;
+ }
+
+ lpc17_gpiowrite(LPCXPRESSO_LED, off);
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ bool off;
+
+ switch (led)
+ {
+ case 0:
+ case 1:
+ off = false;
+ break;
+
+ case 2:
+ off = g_ncstate;
+ break;
+
+ default:
+ return;
+ }
+
+ lpc17_gpiowrite(LPCXPRESSO_LED, off);
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c
new file mode 100644
index 000000000..b9c39ed16
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_nsh.c
@@ -0,0 +1,171 @@
+/****************************************************************************
+ * config/lpcxpresso-lpc1768/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LPCXPRESSO
+# define NSH_HAVEUSBDEV 1
+# ifdef CONFIG_LPC17_SSP1
+# define NSH_HAVEMMCSD 1
+# else
+# undef NSH_HAVEMMCSD
+# endif
+#else
+# error "Unrecognized board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Do we have SPI support for MMC/SD? */
+
+#ifdef NSH_HAVEMMCSD
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
+# error "The LPCXpresso MMC/SD is on SSP1"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 1
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The LPCXpresso MMC/SD has only one slot (0)"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#endif
+
+/* Can't support USB device features if USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ FAR struct spi_dev_s *ssp;
+ int ret;
+
+ /* Get the SSP port */
+
+ ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!ssp)
+ {
+ message("nsh_archinitialize: Failed to initialize SSP port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("Successfully initialized SSP port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SSP port to the slot */
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, ssp);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SSP port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("Successfuly bound SSP port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c
new file mode 100644
index 000000000..7060a92e6
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c
@@ -0,0 +1,214 @@
+/****************************************************************************
+ * config/lpcxpresso-lpc1768/src/up_oled.c
+ * arch/arm/src/board/up_oled.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ug-9664hswag01.h>
+
+#include "lpc17_internal.h"
+#include "lpcxpresso_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* This module is only built if CONFIG_NX_LCDDRIVER is selected. In this
+ * case, it would be an error if SSP1 is not also enabled.
+ */
+
+#ifndef CONFIG_LPC17_SSP1
+# error "The OLED driver requires CONFIG_LPC17_SSP1 in the configuration"
+#endif
+
+#ifndef CONFIG_UG9664HSWAG01_POWER
+# error "This logic requires CONFIG_UG9664HSWAG01_POWER in the configuration"
+#endif
+
+/* Debug ********************************************************************/
+/* Define the CONFIG_LCD_UGDEBUG to enable detailed debug output (stuff you
+ * would never want to see unless you are debugging this file).
+ *
+ * Verbose debug must also be enabled
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_LCD_UGDEBUG
+#endif
+
+#ifdef CONFIG_LCD_UGDEBUG
+# define ugdbg(format, arg...) vdbg(format, ##arg)
+# define oleddc_dumpgpio(m) lpc17_dumpgpio(LPCXPRESSO_OLED_POWER, m)
+# define oledcs_dumpgpio(m) lpc17_dumpgpio(LPCXPRESSO_OLED_CS, m)
+#else
+# define ugdbg(x...)
+# define oleddc_dumpgpio(m)
+# define oledcs_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_nxdrvinit
+ *
+ * Description:
+ * Called by NX initialization logic to configure the OLED.
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
+{
+ FAR struct spi_dev_s *spi;
+ FAR struct lcd_dev_s *dev;
+
+ /* Configure the OLED GPIOs. For the SPI interface, insert jumpers in J42,
+ * J43, J45 pin1-2 and J46 pin 1-2.
+ */
+
+ oledcs_dumpgpio("up_nxdrvinit: After OLED CS setup");
+ oleddc_dumpgpio("up_nxdrvinit: On entry");
+
+ (void)lpc17_configgpio(LPCXPRESSO_OLED_POWER); /* OLED 11V power */
+ (void)lpc17_configgpio(LPCXPRESSO_OLED_DC); /* OLED Command/Data */
+
+ oleddc_dumpgpio("up_nxdrvinit: After OLED Power/DC setup");
+
+ /* Get the SSI port (configure as a Freescale SPI port) */
+
+ spi = up_spiinitialize(1);
+ if (!spi)
+ {
+ glldbg("Failed to initialize SSI port 1\n");
+ }
+ else
+ {
+ /* Bind the SSI port to the OLED */
+
+ dev = ug_initialize(spi, devno);
+ if (!dev)
+ {
+ glldbg("Failed to bind SSI port 1 to OLED %d: %d\n", devno);
+ }
+ else
+ {
+ gllvdbg("Bound SSI port 1 to OLED %d\n", devno);
+
+ /* And turn the OLED on (dim) */
+
+ (void)dev->setpower(dev, UG_POWER_DIM);
+ return dev;
+ }
+ }
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: lpc17_ssp1cmddata
+ *
+ * Description:
+ * Set or clear the SD1329 D/Cn bit to select data (true) or command
+ * (false). This function must be provided by platform-specific logic.
+ * This is an implementation of the cmddata method of the SPI
+ * interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ *
+ * Input Parameters:
+ *
+ * spi - SPI device that controls the bus the device that requires the CMD/
+ * DATA selection.
+ * devid - If there are multiple devices on the bus, this selects which one
+ * to select cmd or data. NOTE: This design restricts, for example,
+ * one one SPI display per SPI bus.
+ * cmd - true: select command; false: select data
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+ if (devid == SPIDEV_DISPLAY)
+ {
+ /* Set GPIO to 1 for data, 0 for command */
+
+ (void)lpc17_gpiowrite(LPCXPRESSO_OLED_DC, !cmd);
+ return OK;
+ }
+ return -ENODEV;
+}
+
+/****************************************************************************
+ * Name: ug_power
+ *
+ * Description:
+ * If the hardware supports a controllable OLED a power supply, this
+ * interface should be provided. It may be called by the driver to turn
+ * the OLED power on and off as needed.
+ *
+ * Input Parameters:
+ *
+ * devno - A value in the range of 0 throuh CONFIG_UG9664HSWAG01_NINTERFACES-1.
+ * This allows support for multiple OLED devices.
+ * on - true:turn power on, false: turn power off.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_UG9664HSWAG01_POWER
+void ug_power(unsigned int devno, bool on)
+{
+ gllvdbg("power %s\n", on ? "ON" : "OFF");
+ (void)lpc17_gpiowrite(LPCXPRESSO_OLED_POWER, on);
+}
+#endif
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c
new file mode 100644
index 000000000..894404cc2
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c
@@ -0,0 +1,215 @@
+/************************************************************************************
+ * configs/lpcxpresso-lpc1768/src/up_ssp.c
+ * arch/arm/src/board/up_ssp.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lpc17_internal.h"
+#include "lpcxpresso_internal.h"
+
+/* The LM3S6965 Eval Kit microSD CS is on SSI0 */
+
+#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSP_DEBUG /* Define to enable debug */
+#undef SSP_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSP_DEBUG
+# define sspdbg lldbg
+# ifdef SSP_VERBOSE
+# define sspvdbg lldbg
+# else
+# define sspvdbg(x...)
+# endif
+#else
+# undef SSP_VERBOSE
+# define sspdbg(x...)
+# define sspvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSP_VERBOSE
+# define ssp_dumpgpio(m) lpc17_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssp_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit.
+ *
+ ************************************************************************************/
+
+void weak_function lpc17_sspinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssp_dumpgpio("lpc17_sspinitialize() Entry)");
+
+ /* Configure card detect and chip select for the SD slot. NOTE: Jumper J55 must
+ * be set correctly for the SD slot chip select.
+ */
+
+#ifdef CONFIG_LPC17_SSP1
+ (void)lpc17_configgpio(LPCXPRESSO_SD_CS);
+ (void)lpc17_configgpio(LPCXPRESSO_SD_CD);
+
+ /* Configure chip select for the OLED. For the SPI interface, insert jumpers in
+ * J42, J43, J45 pin1-2 and J46 pin 1-2.
+ */
+
+#ifdef CONFIG_NX_LCDDRIVER
+ (void)lpc17_configgpio(LPCXPRESSO_OLED_CS);
+#endif
+#endif
+
+ ssp_dumpgpio("lpc17_sspinitialize() Exit");
+}
+
+/************************************************************************************
+ * Name: lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
+ *
+ * Description:
+ * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
+ * must be provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common LPC17xx logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in lpc17_boardinitialize() to configure SPI/SSP chip select
+ * pins.
+ * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC17_SSP0
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssp_dumpgpio("lpc17_spi0select() Entry");
+
+#warning "Assert CS here (false)"
+
+ ssp_dumpgpio("lpc17_spi0select() Exit");
+}
+
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_LPC17_SSP1
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssp_dumpgpio("lpc17_spi1select() Entry");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert/de-assert the CS pin to the card */
+
+ (void)lpc17_gpiowrite(LPCXPRESSO_SD_CS, !selected);
+ }
+#ifdef CONFIG_NX_LCDDRIVER
+ else if (devid == SPIDEV_DISPLAY)
+ {
+ /* Assert the CS pin to the OLED display */
+
+ (void)lpc17_gpiowrite(LPCXPRESSO_OLED_CS, !selected);
+ }
+#endif
+ ssp_dumpgpio("lpc17_spi1select() Exit");
+}
+
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Read the state of the card-detect bit */
+
+ if (lpc17_gpioread(LPCXPRESSO_SD_CD) == 0)
+ {
+ sspdbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+ }
+ }
+
+ sspdbg("Returning zero\n");
+ return 0;
+}
+#endif
+
+#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c
new file mode 100644
index 000000000..c43028f1e
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_usbmsc.c
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/src/up_usbmsc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the LPC17xx MMC/SD SPI block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LPCXPRESSO
+# undef LPC17XX_MMCSDSPIPORTNO
+# define LPC17XX_MMCSDSPIPORTNO 1
+# undef LPC17XX_MMCSDSLOTNO
+# define LPC17XX_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new LPC17xx boards here */
+# error "Unrecognized LPC17xx board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("usbmsc_archinitialize: Initializing SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("usbmsc_archinitialize: Successfully initialized SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("usbmsc_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, LPC17XX_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("usbmsc_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("usbmsc_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/Make.defs b/nuttx/configs/lpcxpresso-lpc1768/thttpd/Make.defs
new file mode 100644
index 000000000..8f2823d0f
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/Make.defs
@@ -0,0 +1,180 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/thttpd/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+ifeq ($(CONFIG_LPC17_CODEREDW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+endif
+ifeq ($(CONFIG_LPC17_CODEREDL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script}"
+ MAXOPTIMIZATION = -O2
+ NXFLATLDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script
+ NXFLATLDSCRIPT = -T"$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld"
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) $(NXFLATLDSCRIPT) -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/appconfig b/nuttx/configs/lpcxpresso-lpc1768/thttpd/appconfig
new file mode 100644
index 000000000..b6cac656a
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/thttpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/thttpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/thttpd
diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig b/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig
new file mode 100755
index 000000000..80ff88e8b
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig
@@ -0,0 +1,508 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/thttpd/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="lpcxpresso-lpc1768"
+CONFIG_ARCH_BOARD_LPCXPRESSO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+CONFIG_LPC17_CODEREDW=n
+CONFIG_LPC17_CODEREDL=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=n
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=y
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="thttp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=15
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+CONFIG_LPC17_USBDEV_NOVBUS=y
+CONFIG_LPC17_USBDEV_NOLED=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# THTTPD settings
+#
+CONFIG_THTTPD_PORT=80
+CONFIG_THTTPD_IPADDR=0x0a000002
+CONFIG_THTTPD_SERVER_ADDRESS="http://www.nuttx.org"
+CONFIG_THTTPD_SERVER_SOFTWARE="thttpd/2.25b 29dec2003-NuttX"
+CONFIG_THTTPD_PATH="/mnt/www"
+CONFIG_THTTPD_CGI_PATH="/mnt/www/cgi-bin"
+CONFIG_THTTPD_CGI_PATTERN="/mnt/www/cgi-bin/*"
+CONFIG_THTTPD_CGI_PRIORITY=50
+CONFIG_THTTPD_CGI_STACKSIZE=1024
+CONFIG_THTTPD_CGI_BYTECOUNT=20000
+CONFIG_THTTPD_CGI_TIMELIMIT=0
+CONFIG_THTTPD_CHARSET="iso-8859-1"
+CONFIG_THTTPD_IOBUFFERSIZE=1024
+#CONFIG_THTTPD_INDEX_NAMES
+CONFIG_AUTH_FILE=n
+CONFIG_THTTPD_LISTEN_BACKLOG=8
+CONFIG_THTTPD_LINGER_MSEC=500
+CONFIG_THTTPD_OCCASIONAL_MSEC=120
+CONFIG_THTTPD_IDLE_READ_LIMIT_SEC=300
+CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC=300
+CONFIG_THTTPD_TILDE_MAP1=n
+CONFIG_THTTPD_TILDE_MAP2=n
+CONFIG_THTTPD_GENERATE_INDICES=n
+CONFIG_THTTPD_URLPATTERN=n
+
+#
+# Additional settings for examples/thttpd
+#
+CONFIG_EXAMPLE_THTTPD_NOMAC=y
+CONFIG_EXAMPLE_THTTPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_THTTPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=8192
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/ld.script b/nuttx/configs/lpcxpresso-lpc1768/thttpd/ld.script
new file mode 100755
index 000000000..37ec25532
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/ld.script
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/thttpd/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/setenv.sh b/nuttx/configs/lpcxpresso-lpc1768/thttpd/setenv.sh
new file mode 100755
index 000000000..158c8a442
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/lpcxpresso-lpc1768/thttpd/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+# This is where the buildroot might reside on a Linux or Cygwin system
+# A minimal buildroot version with the NXFLAT tools is always required
+# for this configuration in order to buildthe THTTPD CGI programs
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the default install location for Code Red on Linux
+export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
+
+# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
+#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
+
+# This is the path to the LPCXpression tool subdirectory
+export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/lpcxpresso-lpc1768/tools/flash.sh b/nuttx/configs/lpcxpresso-lpc1768/tools/flash.sh
new file mode 100755
index 000000000..4faa709ca
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/tools/flash.sh
@@ -0,0 +1,146 @@
+#!/bin/bash
+####################################################################################
+# flash.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+####################################################################################
+
+USAGE="$0 <nuttx-path>"
+
+echo "############################################################################"
+echo "# Assumptions:"
+echo "#"
+echo "# - Windows 7"
+echo "# - LPCXpresso 3.6 installed at /cygdrive/c/nxp/lpcxpresso_3.6"
+echo "# - AXF image built with Code Red"
+echo "# - LPC1768"
+echo "#"
+echo "# You will need to edit this is any of the above are false"
+echo "#"
+echo "############################################################################"
+echo ""
+
+# This is the default install location for binaries on Windows (note that this
+# path could change with the Code Red version number)
+BINDIR="/cygdrive/c/nxp/lpcxpresso_3.6/bin"
+if [ ! -d "${BINDIR}" ]; then
+ echo "Directory ${BINDIR} does not exist"
+ exit 1
+fi
+
+# This is the relative path to the booLPCXpresso utility
+BOOTLPC="Scripts/bootLPCXpresso.cmd"
+if [ ! -x "${BINDIR}/$BOOTLPC" ]; then
+ echo "No executable at ${BINDIR}/${BOOTLPC}"
+ exit 1
+fi
+
+# BOOTLPC_ARG=winusb # WinXP
+BOOTLPC_ARG=hid # Win7
+
+# FLASHUTIL="crt_emu_lpc11_13" # for LPC11xx or LPC13xx parts)
+FLASHUTIL="crt_emu_cm3_nxp" # for LPC17xx parts
+# FLASHUTIL="crt_emu_a7_nxp" # for LPC21/22/23/24 parts)
+# FLASHUTIL="crt_emu_a9_nxp" # for LPC31/32 and LPC29xx parts)
+# FLASHUTIL="crt_emu_cm3_lmi" # for TI Stellaris LM3S parts
+
+if [ ! -x "${BINDIR}/${FLASHUTIL}" ]; then
+ echo "No executable file at ${BINDIR}/${FLASHUTIL}"
+ exit 1
+fi
+
+# unset WIRE # for Red Probe+, Red Probe, RDB1768v1, or TI Stellaris evaluation boards
+# WIRE="-wire=hi" # for RDB1768v2 without upgraded firmware)
+# WIRE="-wire=winusb" # for RDB1768v2 with upgraded firmware)
+# WIRE="-wire=winusb" # for LPC-Link on Windows XP)
+WIRE="-wire=hid" # for LPC-Link on Windows Vista/Windows 7)
+
+TARGET=LPC1768
+
+# The nuttx directory must be provided as an argument
+
+NUTTX=$1
+if [ -z "${NUTTX}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ exit 1
+fi
+
+if [ ! -d "${NUTTX}" ]; then
+ echo "Directory ${NUTTX} does not exist"
+ echo $USAGE
+ exit 1
+fi
+
+# The binary to download:
+
+if [ ! -f "${NUTTX}/nuttx.axf" ]; then
+ if [ -f "${NUTTX}/nuttx" ]; then
+ echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
+ mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
+ fi
+else
+ if [ -f "${NUTTX}/nuttx" ]; then
+ echo "Both ${NUTTX}/nuttx ${NUTTX}/nuttx.axf exist.."
+ echo " Deleting ${NUTTX}/nuttx.axf"
+ rm -f ${NUTTX}/nuttx.axf
+ echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
+ mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
+ fi
+fi
+NUTTXPATH=`cygpath -w "${NUTTX}/nuttx.axf"`
+
+# First of all boot the LPC-Link using the script:
+
+cd ${BINDIR} || \
+ { echo "Failed to CD to ${BINDIR}"; exit 1; }
+./${BOOTLPC} ${BOOTLPC_ARG} || \
+ { echo "'${BOOTLPC} ${BOOTLPC_ARG}' Failed"; }
+
+echo ""
+echo "Wait a bit"
+echo "5..."
+sleep 1
+echo "4..."
+sleep 1
+echo "3..."
+sleep 1
+echo "2..."
+sleep 1
+echo "1..."
+sleep 1
+echo "0..."
+echo ""
+
+# Then program the FLASH
+
+./${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load-exec="${NUTTXPATH}"
diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/Make.defs b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/Make.defs
new file mode 100644
index 000000000..5a6037142
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/usbstorage/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+ifeq ($(CONFIG_LPC17_CODEREDW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+endif
+ifeq ($(CONFIG_LPC17_CODEREDL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/appconfig b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/appconfig
new file mode 100644
index 000000000..a562cb918
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig
new file mode 100755
index 000000000..1b1c97f59
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig
@@ -0,0 +1,465 @@
+############################################################################
+# configs/lpcxpresso-lpc1768/usbstorage/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="lpcxpresso-lpc1768"
+CONFIG_ARCH_BOARD_LPCXPRESSO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=n
+CONFIG_LPC17_CODEREDW=n
+CONFIG_LPC17_CODEREDL=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=y
+CONFIG_LPC17_UART0=n
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=y
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=y
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=15
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+CONFIG_LPC17_USBDEV_NOVBUS=y
+CONFIG_LPC17_USBDEV_NOLED=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/ld.script b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/ld.script
new file mode 100755
index 000000000..7cccb8421
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/ld.script
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/lpcxpresso-lpc1768/usbstorage/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/setenv.sh b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/setenv.sh
new file mode 100755
index 000000000..036de7aef
--- /dev/null
+++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/setenv.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# configs/lpcxpresso-lpc1768/usbstorage/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+
+# This is where the buildroot might reside on a Linux or Cygwin system
+# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the default install location for Code Red on Linux
+export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
+
+# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
+#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
+
+# This is the path to the LPCXpression tool subdirectory
+export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/m68332evb/Kconfig b/nuttx/configs/m68332evb/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/m68332evb/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/m68332evb/Make.defs b/nuttx/configs/m68332evb/Make.defs
new file mode 100644
index 000000000..a0e6aa1ea
--- /dev/null
+++ b/nuttx/configs/m68332evb/Make.defs
@@ -0,0 +1,104 @@
+############################################################################
+# configs/m68332evb/Make.defs
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ARCHCPUFLAGS = -m68332 -mcpu32
+ARCHPICFLAGS = -pic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ld.script
+
+CROSSDEV = m68k-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/m68332evb/appconfig b/nuttx/configs/m68332evb/appconfig
new file mode 100644
index 000000000..4972941a6
--- /dev/null
+++ b/nuttx/configs/m68332evb/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/m68332evb/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/m68332evb/defconfig b/nuttx/configs/m68332evb/defconfig
new file mode 100644
index 000000000..e3e8110a7
--- /dev/null
+++ b/nuttx/configs/m68332evb/defconfig
@@ -0,0 +1,212 @@
+############################################################################
+# configs/m68332evb/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="m68332evb"
+CONFIG_ARCH_M68332=y
+CONFIG_ARCH_M68332EVB=y
+CONFIG_ARCH_BOARD="m68332evb"
+CONFIG_ARCH_BOARD_M68332EVB=y
+CONFIG_DRAM_SIZE=12288
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/m68332evb/doc/m68k-defconfig b/nuttx/configs/m68332evb/doc/m68k-defconfig
new file mode 100644
index 000000000..cbe3c11cd
--- /dev/null
+++ b/nuttx/configs/m68332evb/doc/m68k-defconfig
@@ -0,0 +1,111 @@
+#
+# Automatically generated make config: don't edit
+#
+BR2_HAVE_DOT_CONFIG=y
+# BR2_alpha is not set
+# BR2_arm is not set
+# BR2_armeb is not set
+# BR2_avr32 is not set
+# BR2_cris is not set
+# BR2_i386 is not set
+BR2_m68k=y
+# BR2_mips is not set
+# BR2_mipsel is not set
+# BR2_nios2 is not set
+# BR2_powerpc is not set
+# BR2_sh is not set
+# BR2_sh64 is not set
+# BR2_sparc is not set
+# BR2_x86_64 is not set
+BR2_ARCH="m68k"
+BR2_ENDIAN="BIG"
+
+#
+# Build options
+#
+BR2_WGET="wget --passive-ftp"
+BR2_SVN="svn co"
+BR2_ZCAT="zcat"
+BR2_BZCAT="bzcat"
+BR2_TAR_OPTIONS=""
+BR2_DL_DIR="$(BASE_DIR)/../archives"
+BR2_SOURCEFORGE_MIRROR="easynews"
+BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir"
+BR2_NUTTX_DIR="$(TOPDIR)/../nuttx"
+BR2_TOPDIR_PREFIX=""
+BR2_TOPDIR_SUFFIX=""
+BR2_GNU_BUILD_SUFFIX="m68k-elf"
+BR2_GNU_TARGET_SUFFIX="elf"
+# BR2_PREFER_IMA is not set
+# BR2_DEPRECATED is not set
+
+#
+# Toolchain Options
+#
+
+#
+# Binutils Options
+#
+# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set
+# BR2_BINUTILS_VERSION_2_15 is not set
+# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set
+# BR2_BINUTILS_VERSION_2_16_1 is not set
+# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set
+# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set
+# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set
+# BR2_BINUTILS_VERSION_2_16_91_0_7 is not set
+BR2_BINUTILS_VERSION_2_17=y
+# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_7 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_8 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_9 is not set
+# BR2_BINUTILS_VERSION_2_17_50_0_10 is not set
+BR2_BINUTILS_VERSION="2.17"
+BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
+
+#
+# Gcc Options
+#
+# BR2_GCC_VERSION_3_3_5 is not set
+# BR2_GCC_VERSION_3_3_6 is not set
+# BR2_GCC_VERSION_3_4_2 is not set
+# BR2_GCC_VERSION_3_4_3 is not set
+# BR2_GCC_VERSION_3_4_4 is not set
+# BR2_GCC_VERSION_3_4_5 is not set
+BR2_GCC_VERSION_3_4_6=y
+# BR2_GCC_VERSION_4_0_0 is not set
+# BR2_GCC_VERSION_4_0_1 is not set
+# BR2_GCC_VERSION_4_0_2 is not set
+# BR2_GCC_VERSION_4_0_3 is not set
+# BR2_GCC_VERSION_4_0_4 is not set
+# BR2_GCC_VERSION_4_1_0 is not set
+# BR2_GCC_VERSION_4_1_1 is not set
+# BR2_GCC_VERSION_4_1_2 is not set
+# BR2_GCC_VERSION_4_2 is not set
+# BR2_GCC_IS_SNAP is not set
+BR2_GCC_VERSION="3.4.6"
+# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
+BR2_EXTRA_GCC_CONFIG_OPTIONS=""
+# BR2_INSTALL_LIBSTDCPP is not set
+# BR2_INSTALL_OBJC is not set
+# BR2_INSTALL_FORTRAN is not set
+
+#
+# Gdb Options
+#
+# BR2_PACKAGE_GDB is not set
+# BR2_PACKAGE_GDB_SERVER is not set
+# BR2_PACKAGE_GDB_HOST is not set
+
+#
+# Common Toolchain Options
+#
+# BR2_PACKAGE_SSTRIP_TARGET is not set
+# BR2_PACKAGE_SSTRIP_HOST is not set
+# BR2_ENABLE_MULTILIB is not set
+BR2_LARGEFILE=y
+BR2_TARGET_OPTIMIZATION="-Os -pipe"
diff --git a/nuttx/configs/m68332evb/include/README.txt b/nuttx/configs/m68332evb/include/README.txt
new file mode 100644
index 000000000..507354711
--- /dev/null
+++ b/nuttx/configs/m68332evb/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the M68322EVB.
diff --git a/nuttx/configs/m68332evb/ld.script b/nuttx/configs/m68332evb/ld.script
new file mode 100644
index 000000000..ab65751aa
--- /dev/null
+++ b/nuttx/configs/m68332evb/ld.script
@@ -0,0 +1,84 @@
+/************************************************************
+ * ld.script
+ *
+ * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x003000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.); /* See below */
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/m68332evb/setenv.sh b/nuttx/configs/m68332evb/setenv.sh
new file mode 100755
index 000000000..2882011fd
--- /dev/null
+++ b/nuttx/configs/m68332evb/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# m68322evb/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_m68k/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/m68332evb/src/Makefile b/nuttx/configs/m68332evb/src/Makefile
new file mode 100644
index 000000000..f510c2219
--- /dev/null
+++ b/nuttx/configs/m68332evb/src/Makefile
@@ -0,0 +1,74 @@
+############################################################################
+# configs/m68332evb/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS =
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/m68332evb/src/README.txt b/nuttx/configs/m68332evb/src/README.txt
new file mode 100644
index 000000000..983bf5e99
--- /dev/null
+++ b/nuttx/configs/m68332evb/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the m68332evb.
diff --git a/nuttx/configs/mbed/Kconfig b/nuttx/configs/mbed/Kconfig
new file mode 100644
index 000000000..84d7d461e
--- /dev/null
+++ b/nuttx/configs/mbed/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_MBED
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/mbed/README.txt b/nuttx/configs/mbed/README.txt
new file mode 100644
index 000000000..b64923065
--- /dev/null
+++ b/nuttx/configs/mbed/README.txt
@@ -0,0 +1,415 @@
+README
+^^^^^^
+
+README for NuttX port to the mbed.org LPC1768 board (http://mbed.org/)
+
+Contents
+^^^^^^^^
+
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ USB Device Controller Functions
+ mbed Configuration Options
+ USB Host Configuration
+ Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM toolchain, you simply need add one of the
+ following configuration options to your .config (or defconfig) file:
+
+ CONFIG_LPC17_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC17_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC17_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC17_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC17_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows)and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or
+ Linux native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc17xx,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc17x/lpc17_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh mbed/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+mbed Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc17xx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LPC1768=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=mbed (for the mbed.org board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_MBED=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x10000000
+
+ CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ CONFIG_LPC17_MAINOSC=y
+ CONFIG_LPC17_PLL0=y
+ CONFIG_LPC17_PLL1=n
+ CONFIG_LPC17_ETHERNET=n
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_LPC17_USBOTG=n
+ CONFIG_LPC17_USBDEV=n
+ CONFIG_LPC17_UART0=y
+ CONFIG_LPC17_UART1=n
+ CONFIG_LPC17_UART2=n
+ CONFIG_LPC17_UART3=n
+ CONFIG_LPC17_CAN1=n
+ CONFIG_LPC17_CAN2=n
+ CONFIG_LPC17_SPI=n
+ CONFIG_LPC17_SSP0=n
+ CONFIG_LPC17_SSP1=n
+ CONFIG_LPC17_I2C0=n
+ CONFIG_LPC17_I2C1=n
+ CONFIG_LPC17_I2S=n
+ CONFIG_LPC17_TMR0=n
+ CONFIG_LPC17_TMR1=n
+ CONFIG_LPC17_TMR2=n
+ CONFIG_LPC17_TMR3=n
+ CONFIG_LPC17_RIT=n
+ CONFIG_LPC17_PWM=n
+ CONFIG_LPC17_MCPWM=n
+ CONFIG_LPC17_QEI=n
+ CONFIG_LPC17_RTC=n
+ CONFIG_LPC17_WDT=n
+ CONFIG_LPC17_ADC=n
+ CONFIG_LPC17_DAC=n
+ CONFIG_LPC17_GPDMA=n
+ CONFIG_LPC17_FLASH=n
+
+ LPC17xx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ LPC17xx specific CAN device driver settings. These settings all
+ require CONFIG_CAN:
+
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
+ CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
+
+ LPC17xx specific PHY/Ethernet device driver settings. These setting
+ also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
+
+ CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+
+ CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ LPC17xx USB Device Configuration
+
+ CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+ CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+ CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in SRAM.
+ CONFIG_LPC17_USBDEV_DMA
+ Enable lpc17xx-specific DMA support
+ CONFIG_LPC17_USBDEV_NOVBUS
+ Define if the hardware implementation does not support the VBUS signal
+ CONFIG_LPC17_USBDEV_NOLED
+ Define if the hardware implementation does not support the LED output
+
+ LPC17xx USB Host Configuration
+
+ CONFIG_USBHOST_OHCIRAM_SIZE
+ Total size of OHCI RAM (in AHB SRAM Bank 1)
+ CONFIG_USBHOST_NEDS
+ Number of endpoint descriptors
+ CONFIG_USBHOST_NTDS
+ Number of transfer descriptors
+ CONFIG_USBHOST_TDBUFFERS
+ Number of transfer descriptor buffers
+ CONFIG_USBHOST_TDBUFSIZE
+ Size of one transfer descriptor buffer
+ CONFIG_USBHOST_IOBUFSIZE
+ Size of one end-user I/O buffer. This can be zero if the
+ application can guarantee that all end-user I/O buffers
+ reside in AHB SRAM.
+
+USB Host Configuration
+^^^^^^^^^^^^^^^^^^^^^^
+
+The mbed board can be easily modified to support a USB host interface
+(Remember to add 2 resistors of 15K to D+ and D- pins). The hidkbd
+configuration assumes that this change has been made.
+
+The NuttShell (NSH) mbed can also be modified in order to support USB
+host operations. To make these modifications, do the following:
+
+1. First configure to build the NSH configuration from the top-level
+ NuttX directory:
+
+ cd tools
+ ./configure mbed/nsh
+ cd ..
+
+2. Then edit the top-level .config file to enable USB host. Make the
+ following changes:
+
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_USBHOST=n
+ CONFIG_SCHED_WORKQUEUE=y
+
+When this change is made, NSH should be extended to support USB flash
+devices. When a FLASH device is inserted, you should see a device
+appear in the /dev (pseudo) directory. The device name should be
+like /dev/sda, /dev/sdb, etc. The USB mass storage device, is present
+it can be mounted from the NSH command line like:
+
+ ls /dev
+ mount -t vfat /dev/sda /mnt/flash
+
+Files on the connect USB flash device should then be accessible under
+the mountpoint /mnt/flash.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each mbed configuration is maintained in a sudirectory and can be selected
+as follow:
+
+ cd tools
+ ./configure.sh mbed/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ hidkbd:
+ This configuration directory, performs a simple test of the USB host
+ HID keyboard class driver using the test logic in examples/hidkbd.
+ This configuration assumes that you have modified your mbed for USB
+ host support.
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interfaces. See notes
+ above for enabling USB host support in this configuration.
diff --git a/nuttx/configs/mbed/hidkbd/Make.defs b/nuttx/configs/mbed/hidkbd/Make.defs
new file mode 100644
index 000000000..d588e12fc
--- /dev/null
+++ b/nuttx/configs/mbed/hidkbd/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/mbed/hidkbd/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hidkbd/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hidkbd/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mbed/hidkbd/appconfig b/nuttx/configs/mbed/hidkbd/appconfig
new file mode 100644
index 000000000..fa7e5e3c2
--- /dev/null
+++ b/nuttx/configs/mbed/hidkbd/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mbed/hidkbd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/hidkbd
+
diff --git a/nuttx/configs/mbed/hidkbd/defconfig b/nuttx/configs/mbed/hidkbd/defconfig
new file mode 100644
index 000000000..e65a2fd18
--- /dev/null
+++ b/nuttx/configs/mbed/hidkbd/defconfig
@@ -0,0 +1,473 @@
+############################################################################
+# configs/olimex-lpc1766stk/hidkbd/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="mbed"
+CONFIG_ARCH_BOARD_MBED=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=y
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_EMACRAM_SIZE=8192
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="hidkbd_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=y
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=y
+CONFIG_USBHOST_INT_DISABLE=n
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=1536
+CONFIG_USBHOST_NEDS=2
+CONFIG_USBHOST_NTDS=3
+CONFIG_USBHOST_TDBUFFERS=3
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=512
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mbed/hidkbd/ld.script b/nuttx/configs/mbed/hidkbd/ld.script
new file mode 100644
index 000000000..152f8bc2a
--- /dev/null
+++ b/nuttx/configs/mbed/hidkbd/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/hidkbd/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mbed/hidkbd/setenv.sh b/nuttx/configs/mbed/hidkbd/setenv.sh
new file mode 100644
index 000000000..c3ca070e3
--- /dev/null
+++ b/nuttx/configs/mbed/hidkbd/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/mbed/hidkbd/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/mbed/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mbed/include/board.h b/nuttx/configs/mbed/include/board.h
new file mode 100644
index 000000000..b2bda1f4c
--- /dev/null
+++ b/nuttx/configs/mbed/include/board.h
@@ -0,0 +1,217 @@
+/************************************************************************************
+ * configs/mbed/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* NOTE: The following definitions require lpc17_syscon.h. It is not included here
+ * because the including C file may not have that file in its include path.
+ */
+
+#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
+#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
+#define BOARD_RTCCLK_FREQUENCY (32000) /* RTC oscillator frequency */
+#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
+
+/* This is the clock setup we configure for:
+ *
+ * SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
+ * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6
+ */
+
+#define LPC17_CCLK 80000000 /* 80Mhz*/
+
+/* Select the main oscillator as the frequency source. SYSCLK is then the frequency
+ * of the main oscillator.
+ */
+
+#undef CONFIG_LPC17_MAINOSC
+#define CONFIG_LPC17_MAINOSC 1
+#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
+
+/* Select the main oscillator and CCLK divider. The output of the divider is CCLK.
+ * The input to the divider (PLLCLK) will be determined by the PLL output.
+ */
+
+#define BOARD_CCLKCFG_DIVIDER 6
+#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
+
+/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
+ *
+ * Source clock: Main oscillator
+ * PLL0 Multiplier value (M): 20
+ * PLL0 Pre-divider value (N): 1
+ *
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
+ */
+
+#undef CONFIG_LPC17_PLL0
+#define CONFIG_LPC17_PLL0 1
+#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
+
+#define BOARD_PLL0CFG_MSEL 20
+#define BOARD_PLL0CFG_NSEL 1
+#define BOARD_PLL0CFG_VALUE \
+ (((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
+
+/* PLL1 -- Not used. */
+
+#undef CONFIG_LPC17_PLL1
+#define BOARD_PLL1CFG_MSEL 36
+#define BOARD_PLL1CFG_NSEL 1
+#define BOARD_PLL1CFG_VALUE \
+ (((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
+
+/* USB divider. This divider is used when PLL1 is not enabled to get the
+ * USB clock from PLL0:
+ *
+ * USBCLK = PLL0CLK / 10 = 48MHz
+ */
+
+#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
+
+/* FLASH Configuration */
+
+#undef CONFIG_LP17_FLASH
+#define CONFIG_LP17_FLASH 1
+#define BOARD_FLASHCFG_VALUE 0x0000303a
+
+/* LED definitions ******************************************************************/
+/* The MBED has 4 LEDs along the bottom of the board. Blue or off.
+ * If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows for NuttX
+ * debug functionality (where NC means "No Change").
+ *
+ * During the boot phases. LED1 and LED2 will show boot status. LED3/4 Not used.
+ */
+ /* LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* BLUE OFF */
+#define LED_IRQSENABLED 2 /* OFF BLUE */
+#define LED_STACKCREATED 3 /* OFF OFF */
+
+/* After the system is booted, this logic will no longer use LEDs 1 & 2. They
+ * are available together with LED3 for use the application software using
+ * lpc17_led (prototyped below)
+ */
+ /* LED1 LED2 LED3 LED4 */
+#define LED_INIRQ 4 /* NC NC NC ON (momentary) */
+#define LED_SIGNAL 5 /* NC NC NC ON (momentary) */
+#define LED_ASSERTION 6 /* NC NC NC ON (momentary) */
+#define LED_PANIC 7 /* NC NC NC ON (1Hz flashing) */
+
+
+#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
+#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
+#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
+#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
+
+/* We need to redefine USB_PWRD as GPIO to get USB Host working
+ * Also remember to add 2 resistors of 15K to D+ and D- pins.
+ */
+
+#ifdef CONFIG_USBHOST
+# ifdef GPIO_USB_PWRD
+# undef GPIO_USB_PWRD
+# define GPIO_USB_PWRD (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN22)
+# endif
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void lpc17_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lpc17_led
+ *
+ * Description:
+ * Once the system has booted, these functions can be used to control LEDs 1, 2 & 3
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void lpc17_led(int lednum, int state);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/mbed/nsh/Make.defs b/nuttx/configs/mbed/nsh/Make.defs
new file mode 100644
index 000000000..dfc0a7968
--- /dev/null
+++ b/nuttx/configs/mbed/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/mbed/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mbed/nsh/appconfig b/nuttx/configs/mbed/nsh/appconfig
new file mode 100644
index 000000000..9035f8e43
--- /dev/null
+++ b/nuttx/configs/mbed/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/mbed/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/mbed/nsh/defconfig b/nuttx/configs/mbed/nsh/defconfig
new file mode 100755
index 000000000..a073c8886
--- /dev/null
+++ b/nuttx/configs/mbed/nsh/defconfig
@@ -0,0 +1,444 @@
+############################################################################
+# configs/mbed/nsh/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="mbed"
+CONFIG_ARCH_BOARD_MBED=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=y
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=20
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mbed/nsh/ld.script b/nuttx/configs/mbed/nsh/ld.script
new file mode 100755
index 000000000..d96d51dd9
--- /dev/null
+++ b/nuttx/configs/mbed/nsh/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/mbed/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mbed/nsh/setenv.sh b/nuttx/configs/mbed/nsh/setenv.sh
new file mode 100755
index 000000000..f29d97589
--- /dev/null
+++ b/nuttx/configs/mbed/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/mbed/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/mbed/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mbed/src/Makefile b/nuttx/configs/mbed/src/Makefile
new file mode 100644
index 000000000..a29ddca86
--- /dev/null
+++ b/nuttx/configs/mbed/src/Makefile
@@ -0,0 +1,90 @@
+############################################################################
+# configs/mbed/src/Makefile
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/mbed/src/mbed_internal.h b/nuttx/configs/mbed/src/mbed_internal.h
new file mode 100644
index 000000000..6b966b47a
--- /dev/null
+++ b/nuttx/configs/mbed/src/mbed_internal.h
@@ -0,0 +1,94 @@
+/************************************************************************************
+ * configs/mbed/src/mbed_internal.h
+ * arch/arm/src/board/mbed_internal.n
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_MBED_SRC_MBED_INTERNAL_H
+#define _CONFIGS_MBED_SRC_MBED_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* MBED GPIO Pin Definitions ********************************************************/
+
+#define MBED_LED1 (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN18)
+#define MBED_LED1_OFF MBED_LED1
+#define MBED_LED1_ON (MBED_LED1 | GPIO_VALUE_ONE)
+#define MBED_LED2 (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN20)
+#define MBED_LED2_OFF MBED_LED2
+#define MBED_LED2_ON (MBED_LED2 | GPIO_VALUE_ONE)
+#define MBED_LED3 (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN21)
+#define MBED_LED3_OFF MBED_LED3
+#define MBED_LED3_ON (MBED_LED3 | GPIO_VALUE_ONE)
+#define MBED_LED4 (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN23)
+#define MBED_LED4_OFF MBED_LED4
+#define MBED_LED4_ON (MBED_LED 4| GPIO_VALUE_ONE)
+
+#define MBED_HEARTBEAT MBED_LED4
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the NUCLEUS-2G board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc17_sspinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_MBED_SRC_MBED_INTERNAL_H */
+
diff --git a/nuttx/configs/mbed/src/up_boot.c b/nuttx/configs/mbed/src/up_boot.c
new file mode 100644
index 000000000..42dd54bf5
--- /dev/null
+++ b/nuttx/configs/mbed/src/up_boot.c
@@ -0,0 +1,82 @@
+/************************************************************************************
+ * configs/mbed/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+#include "mbed_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc17_boardinitialize(void)
+{
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/mbed/src/up_leds.c b/nuttx/configs/mbed/src/up_leds.c
new file mode 100644
index 000000000..bc8a87045
--- /dev/null
+++ b/nuttx/configs/mbed/src/up_leds.c
@@ -0,0 +1,222 @@
+/****************************************************************************
+ * configs/mbed/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+
+#include "mbed_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_VERBOSE
+# define led_dumpgpio(m) lpc17_dumpgpio(MBED_LED3, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* LED definitions ******************************************************************
+
+The MBED has 4 LEDs along the bottom of the board. Blue or off.
+If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows for NuttX
+debug functionality (where NC means "No Change").
+
+During the boot phases. LED1 and LED2 will show boot status. LED3/4 Not used.
+
+ LED1 LED2
+STARTED OFF OFF
+HEAPALLOCATE BLUE OFF
+IRQSENABLED OFF BLUE
+STACKCREATED OFF OFF
+
+After the system is booted, this logic will no longer use LEDs 1 & 2. They
+are available together with LED3 for use the application software using
+lpc17_led (prototyped below)
+*/
+
+static bool g_initialized;
+static int g_nestcount;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure all LED GPIO lines */
+
+ led_dumpgpio("up_ledinit() Entry)");
+
+ lpc17_configgpio(MBED_LED1);
+ lpc17_configgpio(MBED_LED2);
+ lpc17_configgpio(MBED_LED3);
+ lpc17_configgpio(MBED_LED4);
+
+ led_dumpgpio("up_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ /* We will control LED1 and LED2 not yet completed the boot sequence. */
+
+ if (!g_initialized)
+ {
+ int led1 = 0;
+ int led2 = 0;
+ switch (led)
+ {
+ case LED_STACKCREATED:
+ g_initialized = true;
+ case LED_STARTED:
+ default:
+ break;
+
+ case LED_HEAPALLOCATE:
+ led1 = 1;
+ break;
+
+ case LED_IRQSENABLED:
+ led2 = 1;
+ }
+ lpc17_led(MBED_LED1,led1);
+ lpc17_led(MBED_LED2,led2);
+ }
+
+ /* We will always control the HB LED */
+
+ switch (led)
+ {
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ lpc17_gpiowrite(MBED_HEARTBEAT, false);
+ g_nestcount++;
+
+ default:
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ /* In all states, OFF can only mean turning off the HB LED */
+
+ if (g_nestcount <= 1)
+ {
+ lpc17_led(MBED_HEARTBEAT, true);
+ g_nestcount = 0;
+ }
+ else
+ {
+ g_nestcount--;
+ }
+}
+
+/************************************************************************************
+ * Name: lpc17_led
+ *
+ * Description:
+ * Once the system has booted, these functions can be used to control the LEDs
+ *
+ ************************************************************************************/
+
+void lpc17_led(int lednum, int state)
+
+{
+ lpc17_gpiowrite(lednum, state);
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/mbed/src/up_nsh.c b/nuttx/configs/mbed/src/up_nsh.c
new file mode 100644
index 000000000..3a23ca7a5
--- /dev/null
+++ b/nuttx/configs/mbed/src/up_nsh.c
@@ -0,0 +1,102 @@
+/****************************************************************************
+ * config/mbed/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_MBED
+# define NSH_HAVEUSBDEV 1
+#else
+# error "Unrecognized board"
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ return OK;
+}
diff --git a/nuttx/configs/mcu123-lpc214x/Kconfig b/nuttx/configs/mcu123-lpc214x/Kconfig
new file mode 100644
index 000000000..e429d3d75
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_MCU123
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/mcu123-lpc214x/README.txt b/nuttx/configs/mcu123-lpc214x/README.txt
new file mode 100644
index 000000000..7c760caa2
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/README.txt
@@ -0,0 +1,395 @@
+README
+^^^^^^
+
+This README discusses issues unique to NuttX configurations for the
+MCU-123 LPC2148 development board.
+
+Contents
+--------
+
+ o Development Environment
+ o GNU Toolchain Options
+ o NuttX buildroot Toolchain
+ o Flash Tools
+ - In System Programming (ISP) Mode
+ - LPC21ISP (Linux)
+ - FlashMagic (Windows/MAC)
+ - OpenOCD
+ o ARM/LPC214X-specific Configuration Options
+ o Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The NuttX buildroot Toolchain (see below).
+ 2. The CodeSourcery GNU toolchain,
+ 3. The devkitARM GNU toolchain, or
+
+ All testing has been conducted using the NuttX buildroot toolchain. To use
+ the CodeSourcery or devkitARM GNU toolchain, you simply need to build the
+ system as follows:
+
+ make # Will build for the NuttX buildroot toolchain
+ make CROSSDEV=arm-eabi- # Will build for the devkitARM toolchain
+ make CROSSDEV=arm-none-eabi- # Will build for the CodeSourcery toolchain
+ make CROSSDEV=arm-elf- # Will build for the NuttX buildroot toolchain
+
+ Of course, hard coding this CROSS_COMPILE value in Make.defs file will save
+ some repetitive typing.
+
+ NOTE: the CodeSourcery and devkitARM toolchains are Windows native toolchains.
+ The NuttX buildroot toolchain is a Cygwin toolchain. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context; make CROSSDEV=arm-none-eabi-
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the CodeSourcery toolchain.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) may not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh eagle100/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+Flash Tools
+^^^^^^^^^^^
+
+In System Programming (ISP) Mode
+--------------------------------
+
+1. Make sure you exit minicom (or whatever terminal emulator you are
+ using). It will interfere with the download.
+
+2. On the MCU123 board, I need to put a jumper on JP3-INT. On that board,
+ JP3-INT is connected to P0.14 of LPC214x. When P0.14 is low and RTS is
+ changed from high to low, the LPC214x will enter ISP (In System
+ Programming) state.
+
+ J2-RST: When J2 is shorted, the reset pin of CPU is controlled by
+ the DTR signal of UART0. Short J2 to enable ISP automatic download.
+
+ Alternatively, you can just press the INT1 button while resetting.
+ The LEDs will be off if the LPC2148 successfully enters ISP mode.
+
+Resetting the board will enter ISP mode when the jumper is connected.
+
+LPC21ISP (Linux)
+----------------
+
+(ca. 2008)
+I use the lpc21isp tool to load NuttX into FLASH. That tool is available
+in the files section at http://tech.groups.yahoo.com/group/lpc21isp/. In
+the older version 1.60 of lpc21isp for Linux, I had to make several changes.
+This changes are shown in lpc21ips-1.60.diff.
+
+I use the script lpc21isp.sh to perform the actual download. You will
+probably have to make some changes to this script in order to use it.
+For example, the path to the built lpc21isp binary will most likely
+have to change. Then move this script to the top level NuttX
+directory and simply execute it to load NuttX onto the board (after
+entering ISP mode).
+
+Here are the detailed steps I use:
+
+1. Setup ISP (In System Programming) mode (see above).
+
+3. Start lpc21isp.sh
+
+4. Reset the board to
+
+FlashMagic (Windows/MAC)
+------------------------
+
+(ca. 2012)
+You download FlashMagic for Windows or MAC here: http://www.flashmagictool.com
+
+1. Setup ISP (In System Programming) mode (see above).
+
+2. Start FlashMagic and setup communication parameters.
+
+ Device: LPC2148
+ COM Port: (will vary with PC)
+ Baud: 38400 (I am sure it can go faster).
+ Interface: None (ISP)
+ Oscillator (MHz): 12
+
+ Check "Erase all Flash+Code Rd Prot"
+
+3. Select the nuttx.hex file
+
+4. Options: Verify after programming
+
+5. Start and reset the board to entry ISP mode. Or hold the INT1
+ button down after reset after you press start.
+
+NOTE: FlashMagic will complain if the data section overlaps
+ 0x4000000-0x400001ff.
+
+OpenOCD
+-------
+
+I have the (really old) Olimex software installed at C:/gccfd. Under
+Cygwin, I can do the following:
+
+1. Create a .cfg file:
+
+ $ cat /cygdrive/c/gccfd/openocd/lib/openocd/interface/arm-usb-ocd.cfg /cygdrive/c/gccfd/openocd/lib/openocd/target/lpc2148.cfg > lpc2148.cfg
+
+2. Start OpenOCD:
+
+ /cygdrive/c/gccfd/openocd/bin/openocd-ftd2xx.exe -f lpc2148.cfg -s . &
+
+3. Start arm-*-gdb (whichever GDB your toolchain uses).
+
+ARM/LPC214X-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ARM7TDMI=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc214x
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_LPC214X
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=mcu123-lpc214x
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_MCU123 (for the Spectrum Digital C5471 EVM)
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed RAM.
+
+ CONFIG_DRAM_START - The start address of installed RAM
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ LPC2148 specific chip initialization
+
+ These provide register setup values:
+ CONFIG_EXTMEM_MODE, CONFIG_RAM_MODE, CONFIG_CODE_BASE, CONFIG_PLL_SETUP,
+ CONFIG_MAM_SETUP, CONFIG_APBDIV_SETUP, CONFIG_EMC_SETUP, CONFIG_BCFG0_SETUP,
+ CONFIG_BCFG1_SETUP, CONFIG_BCFG2_SETUP, CONFIG_BCFG3_SETUP, CONFIG_ADC_SETUP
+
+ CONFIG_LPC214x_FIO - Enable fast GPIO (vs. legacy, "old" GPIO).
+
+ LPC214X specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART.
+
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0
+
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ LPC214X USB Configuration
+
+ CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+
+ CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+
+ CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in the 8Kb USB RAM. This is a
+ tradeoff between the number of DMA channels that can be supported vs
+ the size of the DMA buffers available.
+
+ CONFIG_LPC214X_USBDEV_DMA
+ Enable lpc214x-specific DMA support
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each NXP LPC214x configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh mcu123-lpc214x/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+composite:
+----------
+
+ A simple test of the USB Composite Device (see
+ apps/examples/README.txt and apps/examples/composite)
+
+ Default toolchain: CodeSourcery for Windows
+ Output format: ELF and Intel HEX
+
+ NOTE: I could not get this to work! Perhaps this is a
+ consequence of the last USB driver checking (r4359). But
+ backing this change out did not fix the configuration.
+
+nsh:
+----
+
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interfaces.
+
+ Default toolchain: Buildroot
+ Output format: ELF and binary
+
+ostest:
+-------
+
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+ Default toolchain: Buildroot
+ Output format: ELF and binary
+
+usbserial:
+----------
+
+ This configuration directory exercises the USB serial class
+ driver at examples/usbserial. See examples/README.txt for
+ more information.
+
+ Default toolchain: Buildroot
+ Output format: ELF and binary
+
+ NOTE: If you have problems with this configurationt, perhaps it is a
+ consequence of the last USB driver checking (r4359)
+
+usbstorage:
+-----------
+
+ This configuration directory exercises the USB mass storage
+ class driver at examples/usbstorage. See examples/README.txt for
+ more information.
+
+ Default toolchain: Buildroot
+ Output format: ELF and binary
+
+ NOTE: If you have problems with this configurationt, perhaps it is a
+ consequence of the last USB driver checking (r4359)
diff --git a/nuttx/configs/mcu123-lpc214x/composite/Make.defs b/nuttx/configs/mcu123-lpc214x/composite/Make.defs
new file mode 100644
index 000000000..9ebd1646e
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/composite/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/mcu123-lpc214x/composite/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-none-eabi-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/composite/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/composite/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mcu123-lpc214x/composite/appconfig b/nuttx/configs/mcu123-lpc214x/composite/appconfig
new file mode 100644
index 000000000..4c29b6523
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/composite/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mcu123-lpc214x/composite/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/composite
+
diff --git a/nuttx/configs/mcu123-lpc214x/composite/defconfig b/nuttx/configs/mcu123-lpc214x/composite/defconfig
new file mode 100644
index 000000000..6a6e5819c
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/composite/defconfig
@@ -0,0 +1,417 @@
+############################################################################
+# configs/mcu123-lpc214x/composite/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc214x"
+CONFIG_ARCH_CHIP_LPC2148=y
+CONFIG_ARCH_BOARD="mcu123-lpc214x"
+CONFIG_ARCH_BOARD_MCU123=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=1024
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# LPC2148 specific chip initialization
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_MAM_SETUP=y
+CONFIG_APBDIV_SETUP=y
+CONFIG_EMC_SETUP=n
+CONFIG_BCFG0_SETUP=n
+CONFIG_BCFG1_SETUP=n
+CONFIG_BCFG2_SETUP=n
+CONFIG_BCFG3_SETUP=n
+CONFIG_ADC_SETUP=y
+
+#
+# LPC214X specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="conn_main"
+#CONFIG_USER_ENTRYPOINT="disconn_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+#CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=y
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC214X USB Configuration
+#
+CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_DMA=n
+CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC214X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_COMPOSITE=y
+CONFIG_USBMSC_IFNOBASE=2
+CONFIG_USBMSC_STRBASE=4
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=4
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=y
+CONFIG_CDCACM_COMPOSITE=y
+CONFIG_CDCACM_IFNOBASE=0
+CONFIG_CDCACM_STRBASE=4
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Composite Device Configuration
+#
+CONFIG_USBDEV_COMPOSITE=y
+CONFIG_COMPOSITE_IAD=y
+#CONFIG_COMPOSITE_EP0MAXPACKET
+CONFIG_COMPOSITE_VENDORID=0x03eb
+CONFIG_COMPOSITE_PRODUCTID=0x2022
+CONFIG_COMPOSITE_VENDORSTR="NuttX"
+CONFIG_COMPOSITE_PRODUCTSTR="Composite Device"
+CONFIG_COMPOSITE_SERIALSTR="12345"
+CONFIG_COMPOSITE_CONFIGSTR="examples/composite"
+CONFIG_COMPOSITE_VERSIONNO=0x0101
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=y
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=y
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=y
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/composite
+#
+CONFIG_EXAMPLES_COMPOSITE_DEBUGMM=n
+CONFIG_EXAMPLES_COMPOSITE_NLUNS=1
+CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1=0
+CONFIG_EXAMPLES_COMPOSITE_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_COMPOSITE_TTYUSB=0
+CONFIG_EXAMPLES_COMPOSITE_SERDEV="/dev/ttyUSB0"
+CONFIG_EXAMPLES_COMPOSITE_BUFSIZE=256
+CONFIG_EXAMPLES_COMPOSITE_TRACEINIT=n
+CONFIG_EXAMPLES_COMPOSITE_TRACECLASS=n
+CONFIG_EXAMPLES_COMPOSITE_TRACETRANSFERS=n
+CONFIG_EXAMPLES_COMPOSITE_TRACECONTROLLER=n
+CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mcu123-lpc214x/composite/ld.script b/nuttx/configs/mcu123-lpc214x/composite/ld.script
new file mode 100644
index 000000000..4065f2991
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/composite/ld.script
@@ -0,0 +1,120 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/composite/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* FLASH:
+ * The lpc2148 has 512Kb of non-volatile memory beginning at address
+ * 0x00000000. The OS entry point is via the reset vector at address
+ * 0x00000000 (default MEMMAP mode assumed)
+ *
+ * SRAM:
+ * The lpc2148 has 32Kb of on-chip static RAM beginning at address
+ * 0x40000000. The first 512 bytes of RAM are reserved for used by
+ * the bootloader. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
+ sram (rw) : ORIGIN = 0x40000200, LENGTH = 32K - 512 - 32
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mcu123-lpc214x/composite/setenv.sh b/nuttx/configs/mcu123-lpc214x/composite/setenv.sh
new file mode 100755
index 000000000..f2fb6cb4c
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/composite/setenv.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# configs/mcu123-lpc2148/composite/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the Cygwin path to the configuration scripts directory
+
+export LPC214XSCRIPTS="$WD/configs/mcu123-lpc214x/scripts"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${LPC214XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mcu123-lpc214x/include/README.txt b/nuttx/configs/mcu123-lpc214x/include/README.txt
new file mode 100644
index 000000000..4a18c4011
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the MCU123 LPC2148 board.
diff --git a/nuttx/configs/mcu123-lpc214x/include/board.h b/nuttx/configs/mcu123-lpc214x/include/board.h
new file mode 100644
index 000000000..aa2b68957
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/include/board.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/include/board.h
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+/* Oscillator frequency */
+
+#define LPC214X_FOSC 12000000
+
+/* PLL0 settings CCLK = PLL_M * FOSC PCLK = CCLK/APBDIV */
+
+#define LPC214X_PLL_M 5
+#define LPC214X_PLL_P 2
+#define LPC214X_APB_DIV 1
+
+/* USB Pll settings -- 48 MHz needed. FUSB = PLL_M FOSC */
+
+#define LPC214X_USBPLL_M 4
+#define LPC214X_USBPLL_P 2
+
+/* LED definitions **********************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/mcu123-lpc214x/lpc21isp-1.60.diff b/nuttx/configs/mcu123-lpc214x/lpc21isp-1.60.diff
new file mode 100644
index 000000000..277b21921
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/lpc21isp-1.60.diff
@@ -0,0 +1,102 @@
+diff -rub lpc21isp-1.60/lpc21isp.c lpc21isp-Linux//lpc21isp.c
+--- lpc21isp-1.60/lpc21isp.c 2008-07-21 15:17:06.000000000 -0600
++++ lpc21isp-Linux//lpc21isp.c 2008-09-16 09:21:20.000000000 -0600
+@@ -22,6 +22,7 @@
+ #include "adprog.h"
+ #include "lpcprog.h"
+ #include "lpcterm.h"
++#include "errno.h"
+
+ /*
+ Change-History:
+@@ -319,10 +320,7 @@
+
+ if (IspEnvironment->fdCom < 0)
+ {
+- int* p_err = __error();
+- int err;
+- if (p_err) { err = *p_err; }
+- DebugPrintf(1, "Can't open COM-Port %s ! (Error: %dd (0x%X))\n", IspEnvironment->serial_port, err, err);
++ DebugPrintf(1, "Can't open COM-Port %s ! (Error: %dd (0x%X))\n", IspEnvironment->serial_port, errno, errno);
+ exit(2);
+ }
+
+diff -rub lpc21isp-1.60/lpc21isp.h lpc21isp-Linux//lpc21isp.h
+--- lpc21isp-1.60/lpc21isp.h 2008-05-10 17:35:00.000000000 -0600
++++ lpc21isp-Linux//lpc21isp.h 2008-09-16 09:18:42.000000000 -0600
+@@ -165,6 +165,7 @@
+ #endif
+
+ unsigned serial_timeout_count; /**< Local used to track timeouts on serial port read. */
++ unsigned char DoNotStart; /* Do not start Code if this is set*/
+
+ } ISP_ENVIRONMENT;
+
+@@ -173,7 +174,6 @@
+ #define DebugPrintf(in, ...)
+
+ #else
+-extern int debug_level;
+
+ #if defined INTEGRATED_IN_WIN_APP
+
+@@ -191,7 +191,6 @@
+
+ #else
+ void DebugPrintf(int level, const char *fmt, ...);
+-//#define DebugPrintf(level, ...) if (level <= debug_level) { TRACE( __VA_ARGS__ ); }
+ #endif
+
+ void ClearSerialPortBuffers(ISP_ENVIRONMENT *IspEnvironment);
+diff -rub lpc21isp-1.60/lpcprog.c lpc21isp-Linux//lpcprog.c
+--- lpc21isp-1.60/lpcprog.c 2008-07-21 14:39:50.000000000 -0600
++++ lpc21isp-Linux//lpcprog.c 2008-09-16 08:52:46.000000000 -0600
+@@ -1062,15 +1062,16 @@
+ }
+ else
+ {
++ if (IspEnvironment->DoNotStart == 0)
++ {
+ DebugPrintf(2, "Now launching the brand new code\n");
+ fflush(stdout);
+-
+ if (IspEnvironment->HalfDuplex == 0)
+ sprintf(tmpString, "G %ld A\r\n", IspEnvironment->StartAddress);
+ else
+ sprintf(tmpString, "G %ld A\n", IspEnvironment->StartAddress);
+-
+ SendComPort(IspEnvironment, tmpString); //goto 0 : run this fresh new downloaded code code
++
+ if (IspEnvironment->BinaryOffset < LPC_RAMSTART)
+ { // Skip response on G command - show response on Terminal instead
+ ReceiveComPort(IspEnvironment, Answer, sizeof(Answer)-1, &realsize, 2, 5000);
+@@ -1099,6 +1100,7 @@
+ return (FAILED_RUN + GetAndReportErrorNumber(Answer));
+ }
+ }
++ }
+
+ fflush(stdout);
+ }
+Only in lpc21isp-Linux/: lpcprog.c.orig
+diff -rub lpc21isp-1.60/Makefile lpc21isp-Linux//Makefile
+--- lpc21isp-1.60/Makefile 2008-04-07 00:23:00.000000000 -0600
++++ lpc21isp-Linux//Makefile 2008-09-16 09:23:02.000000000 -0600
+@@ -3,9 +3,9 @@
+ GLOBAL_DEP = adprog.h lpc21isp.h lpcprog.h lpcterm.h
+ CC = gcc
+
+-ifneq ($findstring("freebsd", $(OSTYPE)),"")
+-CFLAGS+=-D__FREEBSD__
+-endif
++#ifneq ($findstring("freebsd", $(OSTYPE)),"")
++#CFLAGS+=-D__FREEBSD__
++#endif
+
+ adprog.o: adprog.c $(GLOBAL_DEP)
+ $(CC) $(CDEBUG) $(CFLAGS) -c -o adprog.o adprog.c
+@@ -21,3 +21,4 @@
+
+ clean:
+ $(RM) adprog.o lpcprog.o lpcterm.o lpc21isp
++ $(RM) *~
diff --git a/nuttx/configs/mcu123-lpc214x/nsh/Make.defs b/nuttx/configs/mcu123-lpc214x/nsh/Make.defs
new file mode 100644
index 000000000..85b8bf890
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/nsh/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/mcu123-lpc214x/nsh/Make.defs
+#
+# Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mcu123-lpc214x/nsh/appconfig b/nuttx/configs/mcu123-lpc214x/nsh/appconfig
new file mode 100644
index 000000000..f8e2d5165
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/mcu123-lpc214x/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/mcu123-lpc214x/nsh/defconfig b/nuttx/configs/mcu123-lpc214x/nsh/defconfig
new file mode 100644
index 000000000..7a514163c
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/nsh/defconfig
@@ -0,0 +1,342 @@
+############################################################################
+# configs/mcu123-lpc214x/nsh/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc214x"
+CONFIG_ARCH_CHIP_LPC2148=y
+CONFIG_ARCH_BOARD="mcu123-lpc214x"
+CONFIG_ARCH_BOARD_MCU123=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# LPC2148 specific chip initialization
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_MAM_SETUP=y
+CONFIG_APBDIV_SETUP=y
+CONFIG_EMC_SETUP=n
+CONFIG_BCFG0_SETUP=n
+CONFIG_BCFG1_SETUP=n
+CONFIG_BCFG2_SETUP=n
+CONFIG_BCFG3_SETUP=n
+CONFIG_ADC_SETUP=y
+
+#
+# LPC214X specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+#CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC214X USB Configuration
+#
+CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_DMA=n
+CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC214X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mcu123-lpc214x/nsh/ld.script b/nuttx/configs/mcu123-lpc214x/nsh/ld.script
new file mode 100644
index 000000000..d6128621b
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/nsh/ld.script
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/nsh/ld.script
+ *
+ * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* FLASH:
+ * The lpc2148 has 512Kb of non-volatile memory beginning at address
+ * 0x00000000. The OS entry point is via the reset vector at address
+ * 0x00000000 (default MEMMAP mode assumed)
+ *
+ * SRAM:
+ * The lpc2148 has 32Kb of on-chip static RAM beginning at address
+ * 0x40000000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
+ sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mcu123-lpc214x/nsh/setenv.sh b/nuttx/configs/mcu123-lpc214x/nsh/setenv.sh
new file mode 100755
index 000000000..97295dbd7
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/mcu123-lpc2148/nsh/setenv.sh
+#
+# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export LPC214XSCRIPTS="$WD/configs/mcu123-lpc214x/scripts"
+export PATH="${BUILDROOT_BIN}:${LPC214XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mcu123-lpc214x/ostest/Make.defs b/nuttx/configs/mcu123-lpc214x/ostest/Make.defs
new file mode 100644
index 000000000..04d444c5d
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/ostest/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/mcu123-lpc214x/ostest/Make.defs
+#
+# Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mcu123-lpc214x/ostest/appconfig b/nuttx/configs/mcu123-lpc214x/ostest/appconfig
new file mode 100644
index 000000000..33846aafb
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mcu123-lpc214x/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/mcu123-lpc214x/ostest/defconfig b/nuttx/configs/mcu123-lpc214x/ostest/defconfig
new file mode 100644
index 000000000..724459e80
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/ostest/defconfig
@@ -0,0 +1,336 @@
+############################################################################
+# configs/mcu123-lpc214x/ostest/defconfig
+#
+# Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc214x"
+CONFIG_ARCH_CHIP_LPC2148=y
+CONFIG_ARCH_BOARD="mcu123-lpc214x"
+CONFIG_ARCH_BOARD_MCU123=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# LPC2148 specific chip initialization
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_MAM_SETUP=y
+CONFIG_APBDIV_SETUP=y
+CONFIG_EMC_SETUP=n
+CONFIG_BCFG0_SETUP=n
+CONFIG_BCFG1_SETUP=n
+CONFIG_BCFG2_SETUP=n
+CONFIG_BCFG3_SETUP=n
+CONFIG_ADC_SETUP=y
+
+#
+# LPC214X specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+#CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC214X USB Configuration
+#
+CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_DMA=n
+CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC214X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mcu123-lpc214x/ostest/ld.script b/nuttx/configs/mcu123-lpc214x/ostest/ld.script
new file mode 100644
index 000000000..590e490eb
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/ostest/ld.script
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/ostest/ld.script
+ *
+ * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* FLASH:
+ * The lpc2148 has 512Kb of non-volatile memory beginning at address
+ * 0x00000000. The OS entry point is via the reset vector at address
+ * 0x00000000 (default MEMMAP mode assumed)
+ *
+ * SRAM:
+ * The lpc2148 has 32Kb of on-chip static RAM beginning at address
+ * 0x40000000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
+ sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mcu123-lpc214x/ostest/setenv.sh b/nuttx/configs/mcu123-lpc214x/ostest/setenv.sh
new file mode 100755
index 000000000..67d8b5d65
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/ostest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/mcu123-lpc2148/ostest/setenv.sh
+#
+# Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export LPC214XSCRIPTS="$WD/configs/mcu123-lpc214x/scripts"
+export PATH="${BUILDROOT_BIN}:${LPC214XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mcu123-lpc214x/scripts/lpc21isp.sh b/nuttx/configs/mcu123-lpc214x/scripts/lpc21isp.sh
new file mode 100755
index 000000000..6dae9b704
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/scripts/lpc21isp.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+#############################################################################
+# configs/mcu123-lpc214x/lpc21isp.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#############################################################################
+#set -x
+
+# The path to the built lpc21isp binary
+
+lpc21isp=../lpc2148/lpc21isp/lpc21isp
+
+# lpc21ips options
+
+options="-bin -control -verify"
+
+# The path to the NuttX raw binary format binary
+
+hxfile=nuttx.bin
+
+# The TTY to use for the download
+
+tty=/dev/ttyS0
+
+# The BAUD rate supported by the lpc214x board
+
+baud=38400
+
+# The LPC214X crystal frequency in KHz
+
+osckhz=12000
+
+# Do it!
+
+sudo $lpc21isp $options $hxfile $tty $baud $osckhz
+
diff --git a/nuttx/configs/mcu123-lpc214x/src/Makefile b/nuttx/configs/mcu123-lpc214x/src/Makefile
new file mode 100644
index 000000000..21838bf39
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/Makefile
@@ -0,0 +1,97 @@
+############################################################################
+# configs/mcu123-lpc214x/src/Makefile
+#
+# Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/sched}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
+endif
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_spi.c up_leds.c
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
+CSRCS += up_composite.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/mcu123-lpc214x/src/README.txt b/nuttx/configs/mcu123-lpc214x/src/README.txt
new file mode 100644
index 000000000..767045c18
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/README.txt
@@ -0,0 +1,2 @@
+This directory contains drivers unique to the MCU123 LPC2148 board.
+
diff --git a/nuttx/configs/mcu123-lpc214x/src/up_composite.c b/nuttx/configs/mcu123-lpc214x/src/up_composite.c
new file mode 100644
index 000000000..3540cdb8a
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/up_composite.c
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/src/up_composite.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the LPC214x MMC/SD SPI block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+#include <nuttx/usb/composite.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1
+# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0
+#endif
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_MCU123
+# undef LPC214X_MMCSDSPIPORTNO
+# define LPC214X_MMCSDSPIPORTNO 1
+# undef LPC214X_MMCSDSLOTNO
+# define LPC214X_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new LPC214x boards here */
+# error "Unrecognized LPC214x board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: composite_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int composite_archinitialize(void)
+{
+ /* If examples/composite is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ *
+ * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH
+ * was built.
+ */
+
+#ifndef CONFIG_NSH_BUILTIN_APPS
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("composite_archinitialize: Initializing SPI port %d\n",
+ LPC214X_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(LPC214X_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("composite_archinitialize: Failed to initialize SPI port %d\n",
+ LPC214X_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("composite_archinitialize: Successfully initialized SPI port %d\n",
+ LPC214X_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("composite_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1, LPC214X_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("composite_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("composite_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
+
+#endif /* CONFIG_NSH_BUILTIN_APPS */
+
+ return OK;
+}
diff --git a/nuttx/configs/mcu123-lpc214x/src/up_leds.c b/nuttx/configs/mcu123-lpc214x/src/up_leds.c
new file mode 100644
index 000000000..9d399c8cc
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/up_leds.c
@@ -0,0 +1,115 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/src/up_leds.c
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* P1.16-P1.23 control LEDS 1-8 */
+
+#define LEDBIT(led) (0x00010000 << (led))
+#define ALLLEDS (0x00ff0000)
+
+#ifdef CONFIG_LPC214x_FIO
+# define putled(v,r) putreg32((v),(LPC214X_FIO1_BASE+(r)))
+# define CLRLEDS putled(ALLLEDS,LPC214X_FIO_SET_OFFSET)
+
+# define LED_SET_OFFSET LPC214X_FIO_SET_OFFSET
+# define LED_CLR_OFFSET LPC214X_FIO_CLR_OFFSET
+# define LED_DIR_OFFSET LPC214X_FIO_DIR_OFFSET
+
+#else
+# define putled(v,r) putreg32((v),(LPC214X_GPIO1_BASE+(r)))
+# define CLRLEDS putled(ALLLEDS,LPC214X_GPIO_SET_OFFSET)
+
+# define LED_SET_OFFSET LPC214X_GPIO_SET_OFFSET
+# define LED_CLR_OFFSET LPC214X_GPIO_CLR_OFFSET
+# define LED_DIR_OFFSET LPC214X_GPIO_DIR_OFFSET
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Funtions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Initilize GIOs P1.16-P1.23 */
+
+ putled(ALLLEDS,LED_DIR_OFFSET);
+ putled(ALLLEDS,LED_SET_OFFSET);
+ putled(LEDBIT(0),LED_CLR_OFFSET);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ putled(LEDBIT(led),LED_CLR_OFFSET);
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ putled(LEDBIT(led),LED_SET_OFFSET);
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/mcu123-lpc214x/src/up_nsh.c b/nuttx/configs/mcu123-lpc214x/src/up_nsh.c
new file mode 100644
index 000000000..14b5d7d97
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/up_nsh.c
@@ -0,0 +1,159 @@
+/****************************************************************************
+ * config/mcu123-lpc214x/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_MCU123
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
+# error "The LPC214x MMC/SD is on SPI1"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 1
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The LPC214x MMC/SD is on SPI1"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new LPC214x boards here */
+# error "Unrecognized LPC214x board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("nsh_archinitialize: Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/mcu123-lpc214x/src/up_spi.c b/nuttx/configs/mcu123-lpc214x/src/up_spi.c
new file mode 100644
index 000000000..b58c8d667
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/up_spi.c
@@ -0,0 +1,602 @@
+/****************************************************************************
+ * config/mcu123-lpc214x/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * One the mcu123.com lpc214x board, the MMC slot is connect via SPI with the
+ * following SPI mode pinout:
+ *
+ * 1 CS: Chip select (low) - SSEL1 5 SCLK: Clock - SCK1
+ * 2 DI: Data input - MOSI1 6 Vss2: Supply Voltage- GRND
+ * 3 Vss: Supply Voltage - GRND 7 DO: Data Output - MISO1
+ * 4 Vdd: Power Supply - Vcc 8 - N/C
+ *
+ * The LPC214x supports one SPI port (SPI0) and one SSP port (SPI1). SPI1
+ * is used to interface with the MMC connect
+ *
+ * SCK1 - pin 47, P0.17/CAP1.2/SCK1/MAT1.2
+ * MISO1 - pin 53, P0.18/CAP1.3/MISO1/MAT1.3
+ * MOSI1 - pin 54, P0.19/MAT1.2/MOSI1/CAP1.2
+ * SSEL1 - pin 55, P0.20/MAT1.3/SSEL1/EINT3
+ *
+ * SPI0 is available on the mcu123.com board (pins 27, 29, 30, and 31).
+ * Pin 27 is dedicated to a chip select, pins 30 and 31 connect to keys, nd
+ * pin 29 is unconnected.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+
+#include "up_internal.h"
+#include "up_arch.h"
+
+#include "chip.h"
+#include "lpc214x_power.h"
+#include "lpc214x_pinsel.h"
+#include "lpc214x_spi.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/* Clocking */
+
+#define LPC214X_CCLKFREQ (LPC214X_FOSC*LPC214X_PLL_M)
+#define LPC214X_PCLKFREQ (LPC214X_CCLKFREQ/LPC214X_APB_DIV)
+
+/* Use either FIO or legacy GPIO */
+
+#ifdef CONFIG_LPC214x_FIO
+# define CS_SET_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_SET_OFFSET)
+# define CS_CLR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_CLR_OFFSET)
+# define CS_DIR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_DIR_OFFSET)
+#else
+# define CS_SET_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_SET_OFFSET)
+# define CS_CLR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_CLR_OFFSET)
+# define CS_DIR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_DIR_OFFSET)
+#endif
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+#ifndef CONFIG_SPI_OWNBUS
+static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
+#endif
+static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+#ifdef CONFIG_SPI_CMDDATA
+static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+#endif
+static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t ch);
+static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords);
+static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct spi_ops_s g_spiops =
+{
+#ifndef CONFIG_SPI_OWNBUS
+ .lock = spi_lock,
+#endif
+ .select = spi_select,
+ .setfrequency = spi_setfrequency,
+ .status = spi_status,
+#ifdef CONFIG_SPI_CMDDATA
+ .cmddata = spi_cmddata,
+#endif
+ .send = spi_send,
+ .sndblock = spi_sndblock,
+ .recvblock = spi_recvblock,
+ .registercallback = 0, /* Not implemented */
+};
+
+static struct spi_dev_s g_spidev = { &g_spiops };
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: spi_lock
+ *
+ * Description:
+ * On SPI busses where there are multiple devices, it will be necessary to
+ * lock SPI to have exclusive access to the busses for a sequence of
+ * transfers. The bus should be locked before the chip is selected. After
+ * locking the SPI bus, the caller should then also call the setfrequency,
+ * setbits, and setmode methods to make sure that the SPI is properly
+ * configured for the device. If the SPI buss is being shared, then it
+ * may have been left in an incompatible state.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * lock - true: Lock spi bus, false: unlock SPI bus
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_SPI_OWNBUS
+static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
+{
+ /* Not implemented */
+
+ return -ENOSYS;
+}
+#endif
+
+/****************************************************************************
+ * Name: spi_select
+ *
+ * Description:
+ * Enable/disable the SPI slave select. The implementation of this method
+ * must include handshaking: If a device is selected, it must hold off
+ * all other attempts to select the device until the device is deselecte.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * devid - Identifies the device to select
+ * selected - true: slave selected, false: slave de-selected
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ uint32_t bit = 1 << 20;
+
+ if (selected)
+ {
+ /* Enable slave select (low enables) */
+
+ spidbg("CD asserted\n");
+ putreg32(bit, CS_CLR_REGISTER);
+ }
+ else
+ {
+ /* Disable slave select (low enables) */
+
+ spidbg("CD de-asserted\n");
+ putreg32(bit, CS_SET_REGISTER);
+
+ /* Wait for the TX FIFO not full indication */
+
+ while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF));
+ putreg16(0xff, LPC214X_SPI1_DR);
+
+ /* Wait until TX FIFO and TX shift buffer are empty */
+
+ while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_BSY);
+
+ /* Wait until RX FIFO is not empty */
+
+ while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE));
+
+ /* Then read and discard bytes until the RX FIFO is empty */
+
+ do
+ {
+ (void)getreg16(LPC214X_SPI1_DR);
+ }
+ while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE);
+ }
+}
+
+/****************************************************************************
+ * Name: spi_setfrequency
+ *
+ * Description:
+ * Set the SPI frequency.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * frequency - The SPI frequency requested
+ *
+ * Returned Value:
+ * Returns the actual frequency selected
+ *
+ ****************************************************************************/
+
+static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
+{
+ uint32_t divisor = LPC214X_PCLKFREQ / frequency;
+
+ if (divisor < 2)
+ {
+ divisor = 2;
+ }
+ else if (divisor > 254)
+ {
+ divisor = 254;
+ }
+
+ divisor = (divisor + 1) & ~1;
+ putreg8(divisor, LPC214X_SPI1_CPSR);
+
+ spidbg("Frequency %d->%d\n", frequency, LPC214X_PCLKFREQ / divisor);
+ return LPC214X_PCLKFREQ / divisor;
+}
+
+/****************************************************************************
+ * Name: spi_status
+ *
+ * Description:
+ * Get SPI/MMC status
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * devid - Identifies the device to report status on
+ *
+ * Returned Value:
+ * Returns a bitset of status values (see SPI_STATUS_* defines
+ *
+ ****************************************************************************/
+
+static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ /* I don't think there is anyway to determine these things on the mcu123.com
+ * board.
+ */
+
+ spidbg("Return SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+
+/****************************************************************************
+ * Name: spi_cmddata
+ *
+ * Description:
+ * Some devices require and additional out-of-band bit to specify if the
+ * next word sent to the device is a command or data. This is typical, for
+ * example, in "9-bit" displays where the 9th bit is the CMD/DATA bit.
+ * This function provides selection of command or data.
+ *
+ * This "latches" the CMD/DATA state. It does not have to be called before
+ * every word is transferred; only when the CMD/DATA state changes. This
+ * method is required if CONFIG_SPI_CMDDATA is selected in the NuttX
+ * configuration
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * cmd - TRUE: The following word is a command; FALSE: the following words
+ * are data.
+ *
+ * Returned Value:
+ * OK unless an error occurs. Then a negated errno value is returned
+ *
+ ****************************************************************************/
+
+ #ifdef CONFIG_SPI_CMDDATA
+static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+# error "spi_cmddata not implemented"
+ return -ENOSYS;
+}
+#endif
+
+/****************************************************************************
+ * Name: spi_send
+ *
+ * Description:
+ * Exchange one word on SPI
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * wd - The word to send. the size of the data is determined by the
+ * number of bits selected for the SPI interface.
+ *
+ * Returned Value:
+ * response
+ *
+ ****************************************************************************/
+
+static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
+{
+ register uint16_t regval;
+
+ /* Wait while the TX FIFO is full */
+
+ while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF));
+
+ /* Write the byte to the TX FIFO */
+
+ putreg16((uint8_t)wd, LPC214X_SPI1_DR);
+
+ /* Wait for the RX FIFO not empty */
+
+ while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE));
+
+ /* Get the value from the RX FIFO and return it */
+
+ regval = getreg16(LPC214X_SPI1_DR);
+ spidbg("%04x->%04x\n", wd, regval);
+ return regval;
+}
+
+/*************************************************************************
+ * Name: spi_sndblock
+ *
+ * Description:
+ * Send a block of data on SPI
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * buffer - A pointer to the buffer of data to be sent
+ * nwords - the length of data to send from the buffer in number of words.
+ * The wordsize is determined by the number of bits-per-word
+ * selected for the SPI interface. If nbits <= 8, the data is
+ * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords)
+{
+ FAR const uint8_t *ptr = (FAR const uint8_t *)buffer;
+ uint8_t sr;
+
+ /* Loop while thre are bytes remaining to be sent */
+
+ spidbg("nwords: %d\n", nwords);
+ while (nwords > 0)
+ {
+ /* While the TX FIFO is not full and there are bytes left to send */
+
+ while ((getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF) && nwords)
+ {
+ /* Send the data */
+
+ putreg16((uint16_t)*ptr, LPC214X_SPI1_DR);
+ ptr++;
+ nwords--;
+ }
+ }
+
+ /* Then discard all card responses until the RX & TX FIFOs are emptied. */
+
+ spidbg("discarding\n");
+ do
+ {
+ /* Is there anything in the RX fifo? */
+
+ sr = getreg8(LPC214X_SPI1_SR);
+ if ((sr & LPC214X_SPI1SR_RNE) != 0)
+ {
+ /* Yes.. Read and discard */
+
+ (void)getreg16(LPC214X_SPI1_DR);
+ }
+
+ /* There is a race condition where TFE may go true just before
+ * RNE goes true and this loop terminates prematurely. The nasty little
+ * delay in the following solves that (it could probably be tuned
+ * to improve performance).
+ */
+
+ else if ((sr & LPC214X_SPI1SR_TFE) != 0)
+ {
+ up_udelay(100);
+ sr = getreg8(LPC214X_SPI1_SR);
+ }
+ }
+ while ((sr & LPC214X_SPI1SR_RNE) != 0 || (sr & LPC214X_SPI1SR_TFE) == 0);
+}
+
+/****************************************************************************
+ * Name: spi_recvblock
+ *
+ * Description:
+ * Revice a block of data from SPI
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * buffer - A pointer to the buffer in which to recieve data
+ * nwords - the length of data that can be received in the buffer in number
+ * of words. The wordsize is determined by the number of bits-per-word
+ * selected for the SPI interface. If nbits <= 8, the data is
+ * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords)
+{
+ FAR uint8_t *ptr = (FAR uint8_t*)buffer;
+ uint32_t rxpending = 0;
+
+ /* While there is remaining to be sent (and no synchronization error has occurred) */
+
+ spidbg("nwords: %d\n", nwords);
+ while (nwords || rxpending)
+ {
+ /* Fill the transmit FIFO with 0xff...
+ * Write 0xff to the data register while (1) the TX FIFO is
+ * not full, (2) we have not exceeded the depth of the TX FIFO,
+ * and (3) there are more bytes to be sent.
+ */
+
+ spivdbg("TX: rxpending: %d nwords: %d\n", rxpending, nwords);
+ while ((getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF) &&
+ (rxpending < LPC214X_SPI1_FIFOSZ) && nwords)
+ {
+ putreg16(0xff, LPC214X_SPI1_DR);
+ nwords--;
+ rxpending++;
+ }
+
+ /* Now, read the RX data from the RX FIFO while the RX FIFO is not empty */
+
+ spivdbg("RX: rxpending: %d\n", rxpending);
+ while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE)
+ {
+ *ptr++ = (uint8_t)getreg16(LPC214X_SPI1_DR);
+ rxpending--;
+ }
+ }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_spiinitialize
+ *
+ * Description:
+ * Initialize the selected SPI port
+ *
+ * Input Parameter:
+ * Port number (for hardware that has mutiple SPI interfaces)
+ *
+ * Returned Value:
+ * Valid SPI device structre reference on succcess; a NULL on failure
+ *
+ ****************************************************************************/
+
+FAR struct spi_dev_s *up_spiinitialize(int port)
+{
+ uint32_t regval32;
+ uint8_t regval8;
+ int i;
+
+ /* Only the SPI1 interface is supported */
+
+#ifdef CONFIG_DEBUG
+ if (port != 1)
+ {
+ return NULL;
+ }
+#endif
+
+ /* Configure multiplexed pins as connected on the mcu123.com board:
+ *
+ * PINSEL1 P0.17/CAP1.2/SCK1/MAT1.2 Bits 2-3=10 for SCK1
+ * PINSEL1 P0.18/CAP1.3/MISO1/MAT1.3 Bits 4-5=10 for MISO1
+ * PINSEL1 P0.19/MAT1.2/MOSI1/CAP1.2 Bits 6-7=10 for MOSI1
+ * PINSEL1 P0.20/MAT1.3/SSEL1/EINT3 Bits 8-9=10 for P0.20 (we'll control it via GPIO or FIO)
+ */
+
+ regval32 = getreg32(LPC214X_PINSEL1);
+ regval32 &= ~(LPC214X_PINSEL1_P017_MASK|LPC214X_PINSEL1_P018_MASK|
+ LPC214X_PINSEL1_P019_MASK|LPC214X_PINSEL1_P020_MASK);
+ regval32 |= (LPC214X_PINSEL1_P017_SCK1|LPC214X_PINSEL1_P018_MISO1|
+ LPC214X_PINSEL1_P019_MOSI1|LPC214X_PINSEL1_P020_GPIO);
+ putreg32(regval32, LPC214X_PINSEL1);
+
+ /* Disable chip select using P0.20 (SSEL1) (low enables) */
+
+ regval32 = 1 << 20;
+ putreg32(regval32, CS_SET_REGISTER);
+ regval32 |= getreg32(CS_DIR_REGISTER);
+ putreg32(regval32, CS_DIR_REGISTER);
+
+ /* Enable peripheral clocking to SPI1 */
+
+ regval32 = getreg32(LPC214X_PCON_PCONP);
+ regval32 |= LPC214X_PCONP_PCSPI1;
+ putreg32(regval32, LPC214X_PCON_PCONP);
+
+ /* Configure 8-bit SPI mode */
+
+ putreg16(LPC214X_SPI1CR0_DSS8BIT|LPC214X_SPI1CR0_FRFSPI, LPC214X_SPI1_CR0);
+
+ /* Disable the SSP and all interrupts (we'll poll for all data) */
+
+ putreg8(0, LPC214X_SPI1_CR1);
+ putreg8(0, LPC214X_SPI1_IMSC);
+
+ /* Set the initial clock frequency for indentification mode < 400kHz */
+
+ spi_setfrequency(NULL, 400000);
+
+ /* Enable the SPI */
+
+ regval8 = getreg8(LPC214X_SPI1_CR1);
+ putreg8(regval8 | LPC214X_SPI1CR1_SSE, LPC214X_SPI1_CR1);
+
+ for (i = 0; i < 8; i++)
+ {
+ (void)getreg16(LPC214X_SPI1_DR);
+ }
+
+ return &g_spidev;
+}
diff --git a/nuttx/configs/mcu123-lpc214x/src/up_usbmsc.c b/nuttx/configs/mcu123-lpc214x/src/up_usbmsc.c
new file mode 100644
index 000000000..79d9344a4
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/src/up_usbmsc.c
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/src/up_usbmsc.c
+ *
+ * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the LPC214x MMC/SD SPI block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_MCU123
+# undef LPC214X_MMCSDSPIPORTNO
+# define LPC214X_MMCSDSPIPORTNO 1
+# undef LPC214X_MMCSDSLOTNO
+# define LPC214X_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new LPC214x boards here */
+# error "Unrecognized LPC214x board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("usbmsc_archinitialize: Initializing SPI port %d\n",
+ LPC214X_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(LPC214X_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SPI port %d\n",
+ LPC214X_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("usbmsc_archinitialize: Successfully initialized SPI port %d\n",
+ LPC214X_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("usbmsc_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, LPC214X_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("usbmsc_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("usbmsc_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs b/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs
new file mode 100644
index 000000000..a5163d882
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbserial/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/mcu123-lpc214x/usbserial/Make.defs
+#
+# Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/appconfig b/nuttx/configs/mcu123-lpc214x/usbserial/appconfig
new file mode 100644
index 000000000..31ecbf24e
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbserial/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mcu123-lpc214x/usbserial/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbserial
+
diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig
new file mode 100644
index 000000000..c746c5732
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig
@@ -0,0 +1,345 @@
+############################################################################
+# configs/mcu123-lpc214x/usbserial/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc214x"
+CONFIG_ARCH_CHIP_LPC2148=y
+CONFIG_ARCH_BOARD="mcu123-lpc214x"
+CONFIG_ARCH_BOARD_MCU123=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=1024
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# LPC2148 specific chip initialization
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_MAM_SETUP=y
+CONFIG_APBDIV_SETUP=y
+CONFIG_EMC_SETUP=n
+CONFIG_BCFG0_SETUP=n
+CONFIG_BCFG1_SETUP=n
+CONFIG_BCFG2_SETUP=n
+CONFIG_BCFG3_SETUP=n
+CONFIG_ADC_SETUP=y
+
+#
+# LPC214X specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="usbserial_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+#CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC214X USB Configuration
+#
+CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_DMA=n
+CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC214X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=y
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+CONFIG_NXFLAT=n
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/ld.script b/nuttx/configs/mcu123-lpc214x/usbserial/ld.script
new file mode 100644
index 000000000..c73d9bda5
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbserial/ld.script
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/usbserial/ld.script
+ *
+ * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* FLASH:
+ * The lpc2148 has 512Kb of non-volatile memory beginning at address
+ * 0x00000000. The OS entry point is via the reset vector at address
+ * 0x00000000 (default MEMMAP mode assumed)
+ *
+ * SRAM:
+ * The lpc2148 has 32Kb of on-chip static RAM beginning at address
+ * 0x40000000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
+ sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/setenv.sh b/nuttx/configs/mcu123-lpc214x/usbserial/setenv.sh
new file mode 100755
index 000000000..8661ee0cb
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbserial/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/mcu123-lpc2148/usbserial/setenv.sh
+#
+# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export LPC214XSCRIPTS="$WD/configs/mcu123-lpc214x/scripts"
+export PATH="${BUILDROOT_BIN}:${LPC214XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs b/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs
new file mode 100644
index 000000000..421af0ba3
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbstorage/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/mcu123-lpc214x/usbstorage/Make.defs
+#
+# Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/appconfig b/nuttx/configs/mcu123-lpc214x/usbstorage/appconfig
new file mode 100644
index 000000000..1ed11ca5e
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mcu123-lpc214x/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig
new file mode 100644
index 000000000..d46ab7c3c
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig
@@ -0,0 +1,358 @@
+############################################################################
+# configs/mcu123-lpc214x/usbstorage/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc214x"
+CONFIG_ARCH_CHIP_LPC2148=y
+CONFIG_ARCH_BOARD="mcu123-lpc214x"
+CONFIG_ARCH_BOARD_MCU123=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=1024
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# LPC2148 specific chip initialization
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_MAM_SETUP=y
+CONFIG_APBDIV_SETUP=y
+CONFIG_EMC_SETUP=n
+CONFIG_BCFG0_SETUP=n
+CONFIG_BCFG1_SETUP=n
+CONFIG_BCFG2_SETUP=n
+CONFIG_BCFG3_SETUP=n
+CONFIG_ADC_SETUP=y
+
+#
+# LPC214X specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+#CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=y
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC214X USB Configuration
+#
+CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC214X_USBDEV_DMA=n
+CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC214X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=y
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=y
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=y
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script b/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script
new file mode 100644
index 000000000..41404fa6e
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbstorage/ld.script
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * configs/mcu123-lpc214x/usbstorage/ld.script
+ *
+ * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* FLASH:
+ * The lpc2148 has 512Kb of non-volatile memory beginning at address
+ * 0x00000000. The OS entry point is via the reset vector at address
+ * 0x00000000 (default MEMMAP mode assumed)
+ *
+ * SRAM:
+ * The lpc2148 has 32Kb of on-chip static RAM beginning at address
+ * 0x40000000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K
+ sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/setenv.sh b/nuttx/configs/mcu123-lpc214x/usbstorage/setenv.sh
new file mode 100755
index 000000000..f27530656
--- /dev/null
+++ b/nuttx/configs/mcu123-lpc214x/usbstorage/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/mcu123-lpc2148/usbstorage/setenv.sh
+#
+# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export LPC214XSCRIPTS="$WD/configs/mcu123-lpc214x/scripts"
+export PATH="${BUILDROOT_BIN}:${LPC214XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/micropendous3/Kconfig b/nuttx/configs/micropendous3/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/micropendous3/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/micropendous3/README.txt b/nuttx/configs/micropendous3/README.txt
new file mode 100644
index 000000000..e7b2041aa
--- /dev/null
+++ b/nuttx/configs/micropendous3/README.txt
@@ -0,0 +1,530 @@
+README
+^^^^^
+
+This is the README file for the port of NuttX to the Micropendous 3 board.
+This board is develepmend by http://code.google.com/p/opendous/. The
+Micropendous 3 is based on an Atmel AT90USB646, 647, 1286 or 1287 MCU.
+NuttX was ported using the AT90USB647 version. As of this writing,
+documentation for the Micropendous board is available here:
+http://code.google.com/p/micropendous/wiki/Micropendous3
+
+Contents
+^^^^^^^^
+
+ o Micropendous3 Features
+ o Pin Usage
+ o Atmel AVRISP mkII Connection
+ o DFU Bootloader
+ o Serial Console
+ o Toolchains
+ o Windows Native Toolchains
+ o NuttX buildroot Toolchain
+ o avr-libc
+ o Micropendous3 Configuration Options
+ o Configurations
+
+Micropendous3 Features
+^^^^^^^^^^^^^^^^^^^^^^
+
+ o Based on the 64-pin USB AVR Microcontrollers: AT90USB646, AT90USB647,
+ AT90USB1286, or AT90USB1287.
+ o USB Full Speed (12Mbit/s)
+ o USB Device Mode (Host mode supported with AT90USBxx7 devices)
+ o 60kb (AT90USB64) or 120kb (AT90USB128) of available FLASH memory for
+ your programs (4kb(AT90USB64)/8kb(AT90USB128) used by USB bootloader -
+ stock Atmel or LUFA)
+ o 4 kbytes SRAM and 2 kbytes of EEPROM (AT90USB64) or 8 kbytes SRAM and 4
+ kbytes of EEPROM (AT90USB128)
+ o External SRAM is possible. Layout for CY7C1019D 1-Mbit SRAM (unpopulated)
+ o USB powered
+ o 16MHz crystal
+ o 48 General Purpose IO Pins (47 with external SRAM)
+ o Vcc=VBUS jumper selects whether USB VBUS or an external supply is used
+ to power the board
+ o RESET and HWB buttons to enable firmware loading over USB (no external
+ programmer required)
+ o HWB can be used as a user button
+ o USB-A Plug
+ o JTAG header
+ o Size LxWxH (including headers): 3.15" x 0.8" x 0.6" =~ 8cm x 2cm x 1.5cm
+ o Completely OpenHardware Design
+
+Pin Usage
+^^^^^^^^^
+
+ AT90USB90128/64 TQFP64
+ -- ------------------------ ---------------------------------------------
+ PIN SIGNAL BOARD CONNECTION
+ -- ------------------------ ---------------------------------------------
+ (left)
+ 1 (INT.6/AIN.0) PE6 J3-25 E6, CY7C1019D ^CE (Unpopulated)
+ 2 (INT.7/AIN.1/UVcon) PE7 J3-26 E7, CY7C1019D A16 (Unpopulated)
+ 3 UVcc
+ 4 D- USB DP
+ 5 D+ USB DM
+ 6 UGnd GND
+ 7 UCap GND (via cap)
+ 8 VBus USB VBUS
+ 9 (IUID) PE3 J3-22 E3
+ 10 (SS/PCINT0) PB0 J3-28 B0
+ 11 (PCINT1/SCLK) PB1 J3-29 B1
+ 12 (PDI/PCINT2/MOSI) PB2 J3-30 B2
+ 13 (PDO/PCINT3/MISO) PB3 J3-31 B3
+ 14 (PCINT4/OC.2A) PB4 J3-32 B4
+ 15 (PCINT5/OC.1A) PB5 J3-33 B5
+ 16 (PCINT6/OC.1B) PB6 J3-34 B6
+ (bottom)
+ 17 (PCINT7/OC.0A/OC.1C) PB7 J3-35 B7
+ 18 (INT4/TOSC1) PE4 J3-23 E4
+ 19 (INT.5/TOSC2) PE5 J3-24 E5
+ 20 RESET SW1
+ 21 VCC VCC
+ 22 GND GND
+ 23 XTAL2 X1
+ 24 XTAL1 X1
+ 25 (OC0B/SCL/INT0) PD0 J3-36 D0
+ 26 (OC2B/SDA/INT1) PD1 J3-37 D1
+ 27 (RXD1/INT2) PD2 J3-38 D2
+ 28 (TXD1/INT3) PD3 J3-39 D3
+ 29 (ICP1) PD4 J3-40 D4
+ 30 (XCK1) PD5 J3-41 D5
+ 31 (T1) PD6 J3-42 D6
+ 32 (T0) PD7 J3-43 D7
+ (right)
+ 48 PA3 (AD3) J3-14 A3, 74AHC573 D3, CY7C1019D |O3 (Unpopulated)
+ 47 PA4 (AD4) J3-15 A4, 74AHC573 D4, CY7C1019D |O4 (Unpopulated)
+ 46 PA5 (AD5) J3-16 A5, 74AHC573 D5, CY7C1019D |O5 (Unpopulated)
+ 45 PA6 (AD6) J3-17 A6, 74AHC573 D6, CY7C1019D |O6 (Unpopulated)
+ 44 PA7 (AD7) J3-18 A7, 74AHC573 D7, CY7C1019D |O7 (Unpopulated)
+ 43 PE2 (ALE/HWB) SW-2 (pulled-up), J3-21 E2, 74AHC573 Cp
+ 42 PC7 (A15/IC.3/CLKO) J3-51 C7, CY7C1019D A15 (Unpopulated)
+ 41 PC6 (A14/OC.3A) J3-50 C6, CY7C1019D A14 (Unpopulated)
+ 40 PC5 (A13/OC.3B) J3-49 C5, CY7C1019D A13 (Unpopulated)
+ 39 PC4 (A12/OC.3C) J3-48 C4, CY7C1019D A12 (Unpopulated)
+ 38 PC3 (A11/T.3) J3-47 C3, CY7C1019D A11 (Unpopulated)
+ 37 PC2 (A10) J3-46 C2, CY7C1019D A10 (Unpopulated)
+ 36 PC1 (A9) J3-45 C1, CY7C1019D A9 (Unpopulated)
+ 35 PC0 (A8) J3-44 C0, CY7C1019D A8 (Unpopulated)
+ 34 PE1 (RD) J3-20 E1, CY7C1019D ^OE (Unpopulated)
+ 33 PE0 (WR) J3-19 E0, CY7C1019D ^WE (Unpopulated)
+ (top)
+ 64 AVCC (Power circuitry)
+ 63 GND GND
+ 62 AREF J3-2 AREF, (Power circuitry)
+ 61 PF0 (ADC0) J3-3 F0
+ 60 PF1 (ADC1) J3-4 F1
+ 59 PF2 (ADC2) J3-5 F2
+ 58 PF3 (ADC3) J3-6 F3
+ 57 PF4 (ADC4/TCK) J3-7 F4, JTAG TCK
+ 56 PF5 (ADC5/TMS) J3-8 F5, JTAG TMS
+ 55 PF6 (ADC6/TDO) J3-9 F6, JTAG TD0
+ 54 PF7 (ADC7/TDI) J3-20 F7, JTAG TDI
+ 53 GND GND
+ 52 VCC VCC
+ 51 PA0 (AD0) J3-11 A0, 74AHC573 D0, CY7C1019D |O0 (Unpopulated)
+ 50 PA1 (AD1) J3-12 A1, 74AHC573 D1, CY7C1019D |O1 (Unpopulated)
+ 49 PA2 (AD2) J3-13 A2, 74AHC573 D2, CY7C1019D |O2 (Unpopulated)
+
+Atmel AVRISP mkII Connection
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ ISP6PIN Header
+ --------------
+
+ 1 2
+ MISO o o VCC
+ SCK o o MOSI
+ RESET o o GND
+
+ Micropendous 3 JTAG (JTAG10PIN Connector)
+ ------------------- ---------------------
+
+ 1 2 1 2
+ TCK o o GND TCK o o GND
+ TDO o o VCC TDO o o VTref
+ TMS o o RESET TMS o o nSRST
+ VCC o o N/C o o (nTRST)
+ TDI o o GND TDI o o GND
+
+ JTAGICE mkII Connection to 10-pin Header
+ ------------------------------------------
+ 10PIN Header 6PIN Header
+ -------------------- ---------------------
+ Pin 1 TCK Pin 3 SCK
+ Pin 2 GND Pin 6 GND
+ Pin 3 TDO Pin 1 MISO
+ Pin 4 VTref Pin 2 Vcc
+ Pin 6 nSRT Pin 5 Reset
+ Pin 9 TDI Pin 4 MOSI
+
+DFU Bootloader
+^^^^^^^^^^^^^^
+
+There is also an DFU bootloader that resides in the upper 8Kb of FLASH
+(unless you ERASE the flash with with ICE). You can enter this bootloader
+(if it is in FLASH) by:
+
+Holding both the SW1 (RESET) and SW2, then releasing SW1 while continuing
+to hold SW2. SW2 connects to the PE2/HWB signal and causes a reset into
+the bootloader memory region.
+
+Then you can use FLIP to load code into FLASH (available at the Atmel Web
+Site). The DFU USB driver for the DFU bootload is available in the usb
+subdirectory in the FLIP installation location.
+
+Serial Console
+^^^^^^^^^^^^^^
+
+ A serial console is supported on an external MAX232/MAX3232 Connected
+ on PD2 and PD3:
+
+ Port D, Bit 2: RXD1, Receive Data (Data input pin for the USART1). When
+ the USART1 receiver is enabled this pin is configured as an input
+ regardless of the value of DDD2. When the USART forces this pin to
+ be an input, the pull-up can still be controlled by the PORTD2 bit.
+ Port D, Bit 3: TXD1, Transmit Data (Data output pin for the USART1).
+ When the USART1 Transmitter is enabled, this pin is configured as
+ an output regardless of the value of DDD3.
+
+ AT90USB90128/64 TQFP64
+ -- ------------------------ ---------------------------------------------
+ PIN SIGNAL BOARD CONNECTION
+ -- ------------------------ ---------------------------------------------
+ 27 (RXD1/INT2) PD2 J3-38 D2
+ 28 (TXD1/INT3) PD3 J3-39 D3
+
+Toolchains
+^^^^^^^^^^
+
+There are several toolchain options. However, testing has been performed
+using *only* the NuttX buildroot toolchain described below. Therefore,
+the NuttX buildroot toolchain is the recommended choice:
+
+Buildroot:
+
+ There is a DIY buildroot version for the AVR boards here:
+ http://sourceforge.net/projects/nuttx/files/buildroot/. See the
+ following section for details on building this toolchain.
+
+ It is assumed in some places that buildroot toolchain is available
+ at ../misc/buildroot/build_avr. Edit the setenv.sh file if
+ this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT=y is set in your
+ .config file.
+
+WinAVR:
+
+ For Cygwin development environment on Windows machines, you can use
+ WinAVR: http://sourceforge.net/projects/winavr/files/
+
+ It is assumed in some places that WinAVR is installed at C:/WinAVR. Edit the
+ setenv.sh file if this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_WINAVR=y is set in your
+ .config file.
+
+ WARNING: There is an incompatible version of cygwin.dll in the WinAVR/bin
+ directory! Make sure that the path to the correct cygwin.dll file precedes
+ the path to the WinAVR binaries!
+
+Linux:
+
+ For Linux, there are widely available avr-gcc packages. On Ubuntu, use:
+ sudo apt-get install gcc-avr gdb-avr avr-libc
+
+ After configuring NuttX, make sure that CONFIG_AVR_LINUXGCC=y is set in your
+ .config file.
+
+Windows Native Toolchains
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ The WinAVR toolchain is a Windows native toolchain. There are several
+ limitations to using a Windows native toolchain in a Cygwin environment.
+ The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath'
+ utility but you might easily find some new path problems. If so, check
+ out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic
+ links are used in Nuttx (e.g., include/arch). The make system works
+ around these problems for the Windows tools by copying directories
+ instead of linking them. But this can also cause some confusion for
+ you: For example, you may edit a file in a "linked" directory and find
+ that your changes had no effect. That is because you are building the
+ copy of the file in the "fake" symbolic directory. If you use a
+ Windows toolchain, you should get in the habit of making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This
+ is because the dependencies are generated using Windows pathes which do
+ not work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native
+ toolchains. That support can be enabled by modifying your Make.defs
+ file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are
+ not building on C:), then you may need to modify tools/mkdeps.sh
+
+ An additional issue with the WinAVR toolchain, in particular, is that it
+ contains an incompatible version of the Cygwin DLL in its bin/ directory.
+ You must take care that the correct Cygwin DLL is used.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ If NuttX buildroot toolchain source tarball cne can be downloaded from the
+ NuttX SourceForge download site (https://sourceforge.net/projects/nuttx/files/).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh micropendous3/<sub-dir>
+
+ NOTE: you also must copy avr-libc header files into the NuttX include
+ directory with command perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/avr-defconfig-4.5.2 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a toolchain for Cygwin under Windows.
+
+avr-libc
+^^^^^^^^
+
+Header Files
+
+ In any case, header files from avr-libc are required: http://www.nongnu.org/avr-libc/.
+ A snapshot of avr-lib is included in the WinAVR installation. For Linux
+ development platforms, avr-libc package is readily available (and would
+ be installed in the apt-get command shown above). But if you are using
+ the NuttX buildroot configuration on Cygwin, then you will have to build
+ get avr-libc from binaries.
+
+Header File Installation
+
+ The NuttX build will required that the AVR header files be available via
+ the NuttX include directory. This can be accomplished by either copying
+ the avr-libc header files into the NuttX include directory:
+
+ cp -a <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+ Or simply using a symbolic link:
+
+ ln -s <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+Build Notes:
+
+ It may not necessary to have a built version of avr-lib; only header files
+ are required. Bu if you choose to use the optimized libraru functions of
+ the flowing point library, then you may have to build avr-lib from sources.
+ Below are instructions for building avr-lib from fresh sources:
+
+ 1. Download the avr-libc package from:
+
+ http://savannah.nongnu.org/projects/avr-libc/
+
+ I am using avr-lib-1.7.1.tar.bz2
+
+ 2. Upack the tarball and cd into the
+
+ tar jxf avr-lib-1.7.1.tar.bz2
+ cd avr-lib-1.7.1
+
+ 3. Configure avr-lib. Assuming that WinAVR is installed at the following
+ location:
+
+ export PATH=/cygdrive/c/WinAVR/bin:$PATH
+ ./configure --build=`./config.guess` --host=avr
+
+ This takes a *long* time.
+
+ 4. Make avr-lib.
+
+ make
+
+ This also takes a long time because it generates variants for nearly
+ all AVR chips.
+
+ 5. Install avr-lib.
+
+ make install
+
+Micropendous3 Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=avr
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_AVR=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_AT90USB=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=at90usb
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip. This should be exactly one of
+
+ CONFIG_ARCH_CHIP_AT90USB646=y
+ CONFIG_ARCH_CHIP_AT90USB647=y
+ CONFIG_ARCH_CHIP_AT90USB1286=y
+ CONFIG_ARCH_CHIP_AT90USB1287=y
+
+ Depending on which Micropendous3 version you have.
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=micropendous3
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_MICROPENOUS3=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM. One of:
+
+ CONFIG_DRAM_SIZE=(4*1024) - (4Kb)
+ CONFIG_DRAM_SIZE=(8*1024) - (8Kb)
+
+ CONFIG_DRAM_START - The start address of installed SRAM
+
+ CONFIG_DRAM_START=0x800100
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_AVR_INT0=n
+ CONFIG_AVR_INT1=n
+ CONFIG_AVR_INT2=n
+ CONFIG_AVR_INT3=n
+ CONFIG_AVR_INT4=n
+ CONFIG_AVR_INT5=n
+ CONFIG_AVR_INT6=n
+ CONFIG_AVR_INT7=n
+ CONFIG_AVR_USBHOST=n
+ CONFIG_AVR_USBDEV=n
+ CONFIG_AVR_WDT=n
+ CONFIG_AVR_TIMER0=n
+ CONFIG_AVR_TIMER1=n
+ CONFIG_AVR_TIMER2=n
+ CONFIG_AVR_TIMER3=n
+ CONFIG_AVR_SPI=n
+ CONFIG_AVR_USART1=y
+ CONFIG_AVR_ANACOMP=n
+ CONFIG_AVR_ADC=n
+ CONFIG_AVR_TWI=n
+
+ If the watchdog is enabled, this specifies the initial timeout. Default
+ is maximum supported value.
+
+ CONFIG_WDTO_15MS
+ CONFIG_WDTO_30MS
+ CONFIG_WDTO_60MS
+ CONFIG_WDTO_120MS
+ CONFIG_WDTO_1250MS
+ CONFIG_WDTO_500MS
+ CONFIG_WDTO_1S
+ CONFIG_WDTO_2S
+ CONFIG_WDTO_4S
+ CONFIG_WDTO_8S
+
+ AT90USB specific device driver settings
+
+ CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
+ console and ttys0 (default is no serial console).
+ CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
+ CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_USARTn_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Micropendous3 configuration is maintained in a sudirectory and can
+be selected as follow:
+
+ cd tools
+ ./configure.sh micropendous3/<subdir>
+ cd -
+ . ./setenv.sh
+
+NOTE: You must also copy avr-libc header files, perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+Where <subdir> is one of the following:
+
+ hello:
+ The simple apps/examples/hello "Hello, World!" example.
+
+ FLASH/SRAM Requirements (as of 6/16/2011):
+
+ $ avr-elf-size nuttx
+ text data bss dec hex filename
+ 24816 978 308 26102 65f6 nuttx
+
+ Strings are in SRAM.
diff --git a/nuttx/configs/micropendous3/hello/Make.defs b/nuttx/configs/micropendous3/hello/Make.defs
new file mode 100644
index 000000000..b974894ed
--- /dev/null
+++ b/nuttx/configs/micropendous3/hello/Make.defs
@@ -0,0 +1,150 @@
+############################################################################
+# configs/micropendous3/hello/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR_WINAVR),y)
+ # WinAVR toolchain under Windows/Cygwin
+ CROSSDEV = avr-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb647
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_LINUXGCC),y)
+ # GCC toolchain under Linux
+ CROSSDEV = avr-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb647
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_BUILDROOT),y)
+ # NuttX buildroot GCC toolchain under Linux or Cygwin
+ CROSSDEV = avr-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb647
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/micropendous3/hello/appconfig b/nuttx/configs/micropendous3/hello/appconfig
new file mode 100644
index 000000000..334bdaa1a
--- /dev/null
+++ b/nuttx/configs/micropendous3/hello/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/micropendous3/hello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/hello
+
diff --git a/nuttx/configs/micropendous3/hello/defconfig b/nuttx/configs/micropendous3/hello/defconfig
new file mode 100644
index 000000000..091e9147e
--- /dev/null
+++ b/nuttx/configs/micropendous3/hello/defconfig
@@ -0,0 +1,411 @@
+############################################################################
+# configs/micropendous3/hello/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_AT90USB=y
+CONFIG_ARCH_CHIP="at90usb"
+CONFIG_ARCH_CHIP_AT90USB647=y
+CONFIG_ARCH_BOARD="micropendous3"
+CONFIG_ARCH_BOARD_MICROPENDOUS3=y
+CONFIG_BOARD_LOOPSPERMSEC=864
+CONFIG_DRAM_SIZE=4096
+CONFIG_DRAM_START=0x800100
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_AVR_WINAVR=n
+CONFIG_AVR_LINUXGCC=n
+CONFIG_AVR_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_AVR_INT0=n
+CONFIG_AVR_INT1=n
+CONFIG_AVR_INT2=n
+CONFIG_AVR_INT3=n
+CONFIG_AVR_INT4=n
+CONFIG_AVR_INT5=n
+CONFIG_AVR_INT6=n
+CONFIG_AVR_INT7=n
+CONFIG_AVR_USBHOST=n
+CONFIG_AVR_USBDEV=n
+CONFIG_AVR_WDT=n
+CONFIG_AVR_TIMER0=n
+CONFIG_AVR_TIMER1=n
+CONFIG_AVR_TIMER2=n
+CONFIG_AVR_TIMER3=n
+CONFIG_AVR_SPI=n
+CONFIG_AVR_USART1=y
+CONFIG_AVR_ANACOMP=n
+CONFIG_AVR_ADC=n
+CONFIG_AVR_TWI=n
+
+#
+# AT90USB specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART1_BAUD=38400
+CONFIG_USART1_BITS=8
+CONFIG_USART1_PARITY=0
+CONFIG_USART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="hello_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=16
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=4
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=4
+CONFIG_NFILE_STREAMS=4
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=1024
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/micropendous3/hello/ld.script b/nuttx/configs/micropendous3/hello/ld.script
new file mode 100644
index 000000000..1a0c4b3f4
--- /dev/null
+++ b/nuttx/configs/micropendous3/hello/ld.script
@@ -0,0 +1,211 @@
+/**************************************************************************************
+ * configs/micropendous3/hello/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/* Memory Regions *********************************************************************/
+/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * AT90USB646/7 0x0000 64Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 4Kb | 0x0000 2Kb
+ * AT90USB1286/7 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 8Kb | 0x0000 4Kb
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 8K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/micropendous3/hello/setenv.sh b/nuttx/configs/micropendous3/hello/setenv.sh
new file mode 100755
index 000000000..8e8830dc7
--- /dev/null
+++ b/nuttx/configs/micropendous3/hello/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/micropendous3/hello/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/micropendous3/include/board.h b/nuttx/configs/micropendous3/include/board.h
new file mode 100644
index 000000000..a63de7cc1
--- /dev/null
+++ b/nuttx/configs/micropendous3/include/board.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/micropendous3/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_MICROPENDOUS3_INCLUDE_BOARD_H
+#define __CONFIGS_MICROPENDOUS3_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */
+
+#define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */
+#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */
+
+/* LED definitions **********************************************************/
+/* The Micropendous 3 has no on-board LEDs */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Button definitions *******************************************************/
+/* SW1 = Connects to AT90USBxx RESET pin and is not available to software.
+ * SW2 = Connects (via a pull-up) to PE-2
+ */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MICROPENDOUS3_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/micropendous3/src/Makefile b/nuttx/configs/micropendous3/src/Makefile
new file mode 100644
index 000000000..ff1c872f0
--- /dev/null
+++ b/nuttx/configs/micropendous3/src/Makefile
@@ -0,0 +1,97 @@
+############################################################################
+# configs/micropendous3/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ASRCS =
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(CONFIG_ARCH_AVR32),y)
+ARCH_SUBDIR = avr32
+endif
+ifeq ($(CONFIG_ARCH_AVR),y)
+ARCH_SUBDIR = avr
+endif
+
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(TOPDIR)/sched}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
+else
+ CFLAGS += -I "$(TOPDIR)/sched"
+ CFLAGS += -I "$(ARCH_SRCDIR)/chip"
+ CFLAGS += -I "$(ARCH_SRCDIR)/common"
+ CFLAGS += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/micropendous3/src/micropendous3_internal.h b/nuttx/configs/micropendous3/src/micropendous3_internal.h
new file mode 100644
index 000000000..df22a265f
--- /dev/null
+++ b/nuttx/configs/micropendous3/src/micropendous3_internal.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/micropendous3/src/micropendous3-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_MICROPENDOUS3_SRC_MICROPENDOUS3_INTERNAL_H
+#define __CONFIGS_MICROPENDOUS3_SRC_MICROPENDOUS3_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: at90usb_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Micropendous3 board.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
+EXTERN void weak_function at90usb_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: at90usb_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void at90usb_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MICROPENDOUS3_SRC_MICROPENDOUS3_INTERNAL_H */
diff --git a/nuttx/configs/micropendous3/src/up_boot.c b/nuttx/configs/micropendous3/src/up_boot.c
new file mode 100644
index 000000000..912440c19
--- /dev/null
+++ b/nuttx/configs/micropendous3/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/micropendous3/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "at90usb_internal.h"
+#include "micropendous3_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All AT90USB architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void up_boardinitialize(void)
+{
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function at90usb_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
+ if (at90usb_spiinitialize)
+ {
+ at90usb_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ at90usb_ledinit();
+#endif
+}
diff --git a/nuttx/configs/mirtoo/Kconfig b/nuttx/configs/mirtoo/Kconfig
new file mode 100644
index 000000000..fe15952f3
--- /dev/null
+++ b/nuttx/configs/mirtoo/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_MIRTOO
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/mirtoo/README.txt b/nuttx/configs/mirtoo/README.txt
new file mode 100644
index 000000000..b2d0c5790
--- /dev/null
+++ b/nuttx/configs/mirtoo/README.txt
@@ -0,0 +1,1007 @@
+configs/mirtoo README
+=====================
+
+This README file discusses the port of NuttX to the DTX1-4000L "Mirtoo" module.
+This module uses MicroChip PIC32MX250F128D and the Dimitech DTX1-4000L EV-kit1
+V2. See http://www.dimitech.com/ for further information.
+
+Contents
+========
+
+ PIC32MX250F128D Pin Out
+ Toolchains
+ Loading NuttX with ICD3
+ LED Usage
+ UART Usage
+ Analog Input
+ PIC32MX Configuration Options
+ Configurations
+
+PIC32MX250F128D Pin Out
+=======================
+
+PIC32MX250F128D 44 pin package.
+
+PIN PIC32 SIGNAL(s) BOARD SIGNAL/USAGE EV-Kit1 CONNECTION
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 1 RPB9/SDA1/CTED4/PMD3/RB9 FUNC3 FUNC3, to X3, pin3
+ RPB9 Peripheral pin selection RB9
+ SDA1 I2C1 data
+ CTED4 CTMU External Edge Input 4
+ PMD3 Parallel Master Port data bit 3
+ RB9 PORTB, Pin 9
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 2 RPC6/PMA1/RC6 FUNC5 FUNC5, to X3, pin5
+ RPC6 Peripheral pin selection RC6
+ PMA1 Parallel Master Port Address bit 1
+ RC6 PORTC, Pin 6
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 3 RPC7/PMA0/RC7 PEN, PGA117 ENA pin Not available off module
+ RPC7 Peripheral pin selection RC7 Not available
+ PMA0 Parallel Master Port Address bit 0 Not available
+ RC7 PORTC, Pin 7 Used for PGA117 ENA output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 4 RPC8/PMA5/RC8 LED0 Not available off module
+ RPC8 Peripheral Selection, PORTC, Pin 8 Not available
+ PMA5 Parallel Master Port Address bit 5 Not available
+ RC8 PORTC, Pin 8 Used to drive LED0
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 5 RPC9/CTED7/PMA6/RC9 LED1 Not available off module
+ RPC9 Peripheral Selection, PORTC, Pin 9 Not available
+ CTED7 CTMU External Edge Input 7 Not available
+ PMA6 Parallel Master Port Address bit 6 Not available
+ RC9 PORTC, Pin 9 Used to drive LED1
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 6 VSS VSS Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 7 VCAP VCAP Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 8 PGED2/RPB10/D+/CTED11/RB10 FUNC0 FUNC0, to FT230XS RXD and debug port
+ PGED2 Debug Channel 2 data Used at boot time for ICD3
+ RPB10 Peripheral Selection, PORTB, Pin 10 Used for UART RXD
+ D+ USB D+ Not available
+ CTED11 CTMU External Edge Input 11 Not available
+ RB10 PORTB, Pin 10 Not available
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+ 9 PGEC2/RPB11/D-/RB11 FUNC1 FUNC1, to FT230XS TXD
+ PGEC2 Debug Channel 2 clock Used at boot time for ICD3
+ RPB11 Peripheral Selection, PORTB, Pin 11 Used for UART TXD
+ D- USB D- Not available
+ RB11 PORTB, Pin 11 Not available
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+10 VUSB3V3 3.3V (via VBAT, Pin 1)
+ VUSB3V3 USB internal transceiver supply 3.3V
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+11 AN11/RPB13/CTPLS/PMRD/RB13 ~CSM SST25VF3032B Chip Select Not available off-module
+ AN11 Analog input channel 11 Not available
+ RPB13 Peripheral Selection, PORTB, Pin 12 Not available
+ CTPLS CTMU Pulse Output Not available
+ PMRD Parallel Master Port read strobe Not available
+ RB13 PORTB, Pin 12 Used for SST25VF3032B Chip Select
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+12 PGED/TMS/PMA10/RA10 DIN5 PORT5, to X7, pin 2
+ PGED4 Debug Channel 4 data (?) (also X13, pin6)
+ TMS JTAG Test mode select pin (?)
+ PMA10 Parallel Master Port Address bit 10 Not available
+ RA10 PORTA, Pin 10 May be used as GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+13 PGEC/TCK/CTED8/PMA7/RA7 DIN2 PORT2, to X4, pin 2
+ PGEC4 Debug Channel 4 clock Not available (also X13, pin5)
+ TCK JTAG test clock input pin May be used as JTAG clock input
+ CTED8 CTMU External Edge Input 8 May be used as CTMU input
+ PMA7 Parallel Master Port Address bit 7 Not available
+ RA7 PORTA, Pin 7 May be used as GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14 FUNC5 (through resistor) FUNC5, to X3, pin5
+ CVREFOUT Comparator Voltage Reference output
+ AN10 Analog input channel 10
+ C3INB Comparator 3 Input B
+ RPB14 Peripheral Selection, PORTB, Pin 14
+ VBUSON USB Host and OTG bus power control
+ SCK1 SPI1 clock
+ CTED5 CTMU External Edge Input 5
+ RB14 PORTB, Pin 14
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15 SCK Not available off module
+ AN9 Analog input channel 9 Not available
+ C3INA Comparator 3 Input A Not available
+ RPB15 Peripheral Selection, PORTB, Pin 15 Not available
+ SCK2 SPI2 clock Used for SPI2 clock
+ CTED6 CTMU External Edge Input 6 Not available
+ PMCS1 Parallel Master Port Chip Select 1 Not available
+ RB15 PORTB, Pin 15 Not available
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+16 AVSS AVSS Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+17 AVDD AVDD Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+18 ~MCLR ~MCLR, TC2030-NL, pin 1 Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+19 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0 AIN PGA117 Vout
+ AN0 Analog input channel 0 AIN
+ RA0 PORTA, Pin 0 Not available
+ CVREF+ Comparator Voltage Reference (high) (?)
+ C3INC Comparator 3 Input C (?)
+ PMD7 Parallel Master Port data bit 7 Not available
+ CTED1 CTMU External Edge Input 1 Not available
+ PGED3 Debug Channel 3 data Not available
+ VREF+ Analog voltage reference (high) Not available
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+20 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1 SI Not available off module
+ PGEC3 Debug Channel 3 clock Not available
+ VREF- Analog voltage reference (low) Not available
+ CVREF- Comparator Voltage Reference (low) Not available
+ AN1 Analog input channel 1 Not available
+ RPA1 Peripheral Selection PORTA, Pin 1 Used for SI
+ CTED2 CTMU External Edge Input 2 Not available
+ PMD6 Parallel Master Port data bit 6 Not available
+ RA1 PORTA, Pin 1 Not available
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+21 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0 DIN6 PORT6, to X9, pin 2
+ PGED1 Debug Channel 1 data Not available (also X13, pin4)
+ AN2 Analog input channel 2 Not available (digital input only)
+ C1IND Comparator 1 Input D Not available (digital input only)
+ C2INB Comparator 2 Input B Not available (digital input only)
+ C3IND Comparator 3 Input D Not available (digital input only)
+ RPB0 Peripheral Selection PORTB, Pin 0 May be used for peripheral input
+ PMD0 Parallel Master Port data bit 0 Not available
+ RB0 PORTB, Pin 0 May be used for GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+22 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1 DIN7 PORT7, to X10, pin 2
+ PGEC1 Debug Channel 1 clock (?) (also X13, pin2)
+ AN3 Analog input channel 3 Not available (digital input only)
+ C1INC Comparator 1 Input C Not available (digital input only)
+ C2INA Comparator 2 Input A Not available (digital input only)
+ RPB1 Peripheral Selection, PORTB, Pin 1 May be used for peripheral input
+ PMD1 Parallel Master Port data bit 1 Not available
+ CTED12 CTMU External Edge Input 12 May be used as CTMU input
+ RB1 PORTB, Pin 1 May be used as GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+23 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/CNB2/RB2 DOUT0 PORT0, to X1, pin 2
+ AN4 Analog input channel 4 Not available (digital output only) (also X13, pin1)
+ C1INB Comparator 1 Input B Not available (digital output only)
+ C2IND Comparator 2 Input D Not available (digital output only)
+ RPB2 Peripheral Selection PORTB, Pin 2 May be used for peripheral output
+ SDA2 I2C2 data Not available(?)
+ CTED13 CTMU External Edge Input 13 Not available
+ PMD2 Parallel Master Port data bit 2 Not available
+ CNB2 PORTB, Pin 2 Change Notification Not available
+ RB2 PORTB, Pin 2 May be for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+24 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/CNB3/RB3 DOUT1 PORT1, to X2, pin 2
+ AN5 Analog input channel 5 Not available (digital output only) (also X13, pin3)
+ C1INA Comparator 1 Input A Not available (digital output only)
+ C2INC Comparator 2 Input C Not available (digital output only)
+ RTCC Real-Time Clock alarm output May be used for RTCC output
+ RPB3 Peripheral Selection, PORTB, Pin 3 May be used for peripheral output
+ SCL2 I2C2 clock (?)
+ PMWR Parallel Master Port write strobe Not available
+ CNB3 PORTB, Pin 3 Change Notification Not available
+ RB3 PORTB, Pin 3 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+25 AN6/RPC0/RC0 DOUT3 PORT3, to X5, pin 2
+ AN6 Analog input channel 6 Not available (digital output only) (also X13, pin7)
+ RPC0 Peripheral Selection, PORTC, Pin 0 May be used for peripheral output
+ RC0 PORTC, Pin 0 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+26 AN7/RPC1/RC1 DOUT4 PORT4, to X6, pin 2
+ AN7 Analog input channel 7 Not available (digital output only) (also X13, pin8)
+ RPC1 Peripheral Selection, PORTC, Pin 1 May be used for peripheral output
+ RC1 PORTC, Pin 1 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+27 AN8/RPC2/PMA2/RC2 DOUT5 PORT5, to X7, pin 2
+ AN8 Analog input channel 8 Not available (digital output only) (also X13, pin6)
+ RPC2 Peripheral Selection, PORTC, Pin 2 May be used for peripheral output
+ PMA2 Parallel Master Port Address bit 2 Not available
+ RC2 PORTC, Pin 2 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+28 VDD VDD Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+29 VSS VSS Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+30 OSC1/CLKI/RPA2/RA2 SO Not available off module
+ OSC1 Oscillator crystal input Not available
+ CLKI External clock source input Not available
+ RPRA2 Peripheral Selection PORTA, Pin 2 Used for SO
+ RA2 PORTA, Pin 2 Not available
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+31 OSC2/CLKO/RPA3/RA3 DIN0 PORT0, to X1, pin 2
+ OSC2 Oscillator crystal output Not available (also X13, pin1)
+ CLKO Oscillator crystal output Not available
+ RPA3 Peripheral Selection for PORTA, Pin 3 May be used for peripheral input
+ RA3 PORTA, Pin 3 May be used for GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+32 TDO/RPA8/PMA8/RA8 DIN3 PORT3, to X5, pin 2
+ TDO JTAG test data output pin Not available (also X13, pin7)
+ RPA8 PORTA, Pin 8 May be used for peripheral input
+ PMA8 Parallel Master Port Address bit 8 Not available
+ RA8 PORTA, Pin 8 May be used for GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+33 SOSCI/RPB4/RB4 DOUT2 PORT2, to X4, pin 2
+ SOSCI 32.768 kHz crystal input Not available (also X13, pin5)
+ RPB4 Peripheral Seclection, PORTB, Pin 4 May be used for peripheral output
+ RB4 PORTB, Pin 4 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+34 SOSCO/RPA4/T1CK/CTED9/RA4 DIN1 PORT1, to X2, pin 2
+ SOSCO 32.768 kHz crystal output Not available (also X13, pin3)
+ RPA4 Peripheral Selection PORTA, Pin 4 May be used for peripheral input
+ T1CK Timer1 external clock input May be used for timer 1 input
+ CTED9 CTMU External Edge Input 9 May be used for CTMU input
+ RA4 PORTA, Pin 4 May be used as GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+35 TDI/RPA9/PMA9/RA9 DIN4 PORT4, to X6, pin 2
+ TDI JTAG test data input pin May be used for JTAG input (also X13, pin8)
+ RPA9 Peripheral Selection for PORTA, Pin 9 May be used for peripheral input
+ PMA9 Parallel Master Port Address bit 9 Not available
+ RA9 PORTA, Pin 9 May be used for GPIO input
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+36 AN12/RPC3/RC3 DOUT6 PORT6, to X9, pin 2
+ AN12 Analog input channel 12 Not available (digtial output only) (also X13, pin4)
+ RPC3 Peripheral Selection, PORTC, Pin 3 May be used for peripheral output
+ RC3 PORTC, Pin 3 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+37 RPC4/PMA4/RC4 DOUT7 PORT7, to X10, pin 2
+ RPC4 Peripheral Selection, PORTC, Pin 4 May be used for peripheral output (also X13, pin2)
+ PMA4 Parallel Master Port Address bit 4 Not available
+ RC4 PORTC, Pin 4 May be used for GPIO output
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+38 RPC5/PMA3/RC5 FUNC4 FUNC4, to X3, pin4
+ RPC5 Peripheral Selection, PORTC, Pin 5
+ PMA3 Parallel Master Port Address bit 3
+ RC5 PORTC, Pin 5
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+39 VSS VSS Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+40 VDD VDD Not available off module
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+41 RPB5/USBID/RB5 FUNC3 FUNC3, to X3, pin3
+ RPB5 Peripheral Selection, PORTB, Pin 5
+ USBID 41 USB OTG ID detect
+ RB5 41 PORTB, Pin 5
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+42 VBUS FUNC2 FUNC2, to X3, pin2
+ VBUS Analog USB bus power monitor
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+43 RPB7/CTED3/PMD5/INT0/RB7 PGA117 ~CSAI Not available off module
+ RPB7 Peripheral Selection, PORTB, Pin 7
+ CTED3 CTMU External Edge Input 3
+ PMD5 Parallel Master Port data bit 5
+ INT0 External Interrupt 0
+ RB7 PORTB, Pin 7
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+44 RPB8/SCL1/CTED10/PMD4/RB8 FUNC2 FUNC2
+ RPB8 PORTB, Pin 8
+ SCL1 I2C1 clock
+ CTED10 CTMU External Edge Input 10
+ PMD4 Parallel Master Port data bit 4
+ RB8 PORTB, Pin 8
+--- ------------------------------------------------ ---------------------------------- ----------------------------------
+
+Additional signals available via Peripheral Pin Selections (PPS)
+----------------------------------------------------------------
+
+ REFCLKI Reference Input Clock
+ REFCLKO Reference Output Clock
+ IC1 Capture Inputs 1
+ IC2 Capture Inputs 2
+ IC3 Capture Inputs 3
+ IC4 Capture Inputs 4
+ IC5 Capture Inputs 5
+ OC1 Output Compare Output 1
+ OC2 Output Compare Output 2
+ OC3 Output Compare Output 3
+ OC4 Output Compare Output 4
+ OC5 Output Compare Output 5
+ OCFA Output Compare Fault A Input
+ OCFB Output Compare Fault B Input
+ INT1 External Interrupt 1
+ INT2 External Interrupt 2
+ INT3 External Interrupt 3
+ INT4 External Interrupt 4
+ T2CK Timer2 external clock input
+ T3CK Timer3 external clock input
+ T4CK Timer4 external clock input
+ T5CK Timer5 external clock input
+ U1CTS UART1 clear to send
+ U1RTS UART1 ready to send
+ U1RX UART1 receive
+ U1TX UART1 transmit
+ U2CTS UART2 clear to send
+ U2RTS UART2 ready to send
+ U2RX UART2 receive
+ U2TX UART2 transmit
+ SDI1 SPI1 data in
+ SDO1 SPI1 data out
+ SS1 SPI1 slave synchronization or frame pulse I/O
+ SDI2 SPI2 data in
+ SDO2 SPI2 data out
+ SS2 SPI2 slave synchronization or frame pulse I/O
+ C1OUT Comparator 1 Output
+ C2OUT Comparator 2 Output
+ C3OUT Comparator 3 Output
+
+Toolchains
+==========
+
+ MPLAB/C32
+ ---------
+
+ I am using the free, "Lite" version of the PIC32MX toolchain available
+ for download from the microchip.com web site. I am using the Windows
+ version. The MicroChip toolchain is the only toolchain currently
+ supported in these configurations, but it should be a simple matter to
+ adapt to other toolchains by modifying the Make.defs file include in
+ each configuration.
+
+ Toolchain Options:
+
+ CONFIG_PIC32MX_MICROCHIPW - MicroChip full toolchain for Windows (C32)
+ CONFIG_PIC32MX_MICROCHIPL - MicroChip full toolchain for Linux (C32)
+ CONFIG_PIC32MX_MICROCHIPW_LITE - MicroChip LITE toolchain for Windows (C32)
+ CONFIG_PIC32MX_MICROCHIPL_LITE - MicroChip LITE toolchain for Linux (C32)
+
+ NOTE: The "Lite" versions of the toolchain does not support C++. Also
+ certain optimization levels are not supported by the Lite toolchain.
+
+ MicrochipOpen
+ -------------
+
+ An alternative, build-it-yourself toolchain is available here:
+ http://sourceforge.net/projects/microchipopen/ . These tools were
+ last updated circa 2010. NOTE: C++ support still not available
+ in this toolchain. Use this configuration option to select the microchipopen
+ toolchain:
+
+ CONFIG_PIC32MX_MICROCHIPOPENL - microchipOpen toolchain for Linux
+
+ And set the path appropriately in the setenv.sh file.
+
+ Building MicrochipOpen (on Linux)
+ ---------------------------------
+
+ 1) Get the build script from this location:
+
+ http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
+
+ 2) Build the code using the build script, for example:
+
+ ./build.sh -b v105_freeze
+
+ This will check out the selected branch and build the tools.
+
+ 3) Binaries will then be available in a subdirectory with a name something like
+ pic32-v105-freeze-20120622/install-image/bin (depending on the current data
+ and the branch that you selected.
+
+ Note that the tools will have the prefix, mypic32- so, for example, the
+ compiler will be called mypic32-gcc.
+
+ Pinguino mips-elf Toolchain
+ ---------------------------
+
+ Another option is the mips-elf toolchain used with the Pinguino project. This
+ is a relatively current mips-elf GCC and should provide free C++ support as
+ well. This toolchain can be downloded from the Pinguino website:
+ http://wiki.pinguino.cc/index.php/Main_Page#Download . There is some general
+ information about using the Pinguino mips-elf toolchain in this thread:
+ http://tech.groups.yahoo.com/group/nuttx/message/1821
+
+ Support for the Pinguino mips-elf toolchain has been included in the Mirtoo
+ configurations. Use one of these configuration options to select the Pinguino
+ mips-elf toolchain:
+
+ CONFIG_PIC32MX_PINGUINOW - Pinguino mips-elf toolchain for Windows
+ CONFIG_PIC32MX_PINGUINOL - Pinguino mips toolchain for Linux
+
+ And set the path appropriately in the setenv.sh file. These tool configurations
+ are untested -- expect some additional integration issues. Good luck!
+
+ MPLAB/C32 vs MPLABX/X32
+ -----------------------
+
+ It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
+ it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
+ with the NuttX build scripts. Here are some of the issues that I see when trying
+ to build with XC32:
+
+ 1) Make.def changes: You have to change the tool prefix:
+
+ CROSSDEV=xc32-
+
+ 2) debug.ld/release.ld: The like expect some things that are not present in
+ the current linker scripts (or are expected with different names). Here
+ are some partial fixes:
+
+ Rename: kseg0_progmem to kseg0_program_mem
+ Rename: kseg1_datamem to kseg1_data_mem
+
+ Even then, there are more warnings from the linker and some undefined symbols
+ for non-NuttX code that resides in the unused Microchip libraries. See this
+ email thread at http://tech.groups.yahoo.com/group/nuttx/message/1458 for more
+ information. You will have to solve at least this undefined symbol problem if
+ you want to used the XC32 toolchain.
+
+ Windows Native Toolchains
+ -------------------------
+
+ NOTE: There are several limitations to using a Windows based toolchain in a
+ Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+Loading NuttX with ICD3
+========================
+
+ Intel Hex Forma Files:
+ ----------------------
+
+ When NuttX is built it will produce two files in the top-level NuttX
+ directory:
+
+ 1) nuttx - This is an ELF file, and
+ 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
+ the setting CONFIG_INTELHEX_BINARY in the .config file.
+
+ The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
+ there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
+ file to contain physical addresses. But the nuttx.hex file generated from the
+ top-level make will have address in the KSEG0 and KSEG1 regions.
+
+ tools/pic32mx/mkpichex:
+ ----------------------
+
+ There is a simple tool in the NuttX tools/pic32mx directory that can be
+ used to solve both issues with the nuttx.hex file. But, first, you must
+ build the tool:
+
+ cd tools/pic32mx
+ make
+
+ Now you will have an excecutable file call mkpichex (or mkpichex.exe on
+ Cygwin). This program will take the nutt.hex file as an input, it will
+ convert all of the KSEG0 and KSEG1 addresses to physical address, and
+ it will write the modified file, replacing the original nuttx.hex.
+
+ To use this file, you need to do the following things:
+
+ . ./setenv.sh # Source setenv.sh. Among other this, this script
+ # will add the NuttX tools/pic32mx directory to your
+ # PATH variable
+ make # Build nuttx and nuttx.hex
+ mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
+ # to the top-level build directory. It is the only
+ # required input to mkpichex.
+
+LED Usage
+=========
+
+ The Mirtoo module has 2 user LEDs labeled LED0 and LED1 in the schematics:
+
+ --- ----- --------------------------------------------------------------
+ PIN Board Notes
+ --- ----- --------------------------------------------------------------
+ RC8 LED0 Grounded, high value illuminates
+ RC9 LED1 Grounded, high value illuminates
+
+ The Dimitech DTX1-4000L EV-kit1 supports 3 more LEDs, but there are not
+ controllable from software.
+
+ If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as
+ follows:
+ ON OFF
+ ------------------------- ---- ---- ---- ----
+ LED0 LED1 LED0 LED1
+ ------------------------- ---- ---- ---- ----
+ LED_STARTED 0 OFF OFF --- ---
+ LED_HEAPALLOCATE 1 ON OFF --- ---
+ LED_IRQSENABLED 2 OFF ON --- ---
+ LED_STACKCREATED 3 ON ON --- ---
+ LED_INIRQ 4 ON N/C OFF N/C
+ LED_SIGNAL 4 ON N/C OFF N/C
+ LED_ASSERTION 4 ON N/C OFF N/C
+ LED_PANIC 4 ON N/C OFF N/C
+
+UART Usage
+==========
+
+ When mounted on the DTX1-4000L EV-kit1 board, serial output is avaiable through
+ an FT230X device via the FUNC0 and FUNC1 module outputs. If CONFIG_PIC32MX_UART2
+ is enabled, the src/up_boot will configure the UART2 pins as follows:
+
+ ---------- ------ ----- ------ -------------------------
+ BOARD MODULE PIN SIGNAL NOTES
+ ---------- ------ ----- ------ -------------------------
+ FT230X RXD FUNC0 RPB11 U2RX UART2 RX (Also PGEC2)
+ FT230X TXD FUNC1 RPB10 U2TX UART2 TX (Also PGED2)
+
+ However, since the FUNC0/1 pins are shared with the PGEC/D2, they cannot be used
+ for UART2 if you are also debugging with the ICD3. In that case, you may need
+ to switch to UART1.
+
+ If CONFIG_PIC32MX_UART1 is enabled, the src/up_boot will configure the UART
+ pins as follows. This will support communictions (via an external RS-232
+ driver) through X3 pins 4 and 5:
+
+ ---------- ------ ----- ------ -------------------------
+ BOARD MODULE PIN SIGNAL NOTES
+ ---------- ------ ----- ------ -------------------------
+ X3, pin 4 FUNC4 RPBC5 U1TX UART1 TX
+ X3, pin 5 FUNC5 RPBC6 U1RX UART1 RX
+
+ If you are not using MPLAB to debug, you may also want to change Make.defs
+ to use the release.ld linker script instead of the debug.ld link script. This
+ change will give you a little more memory by re-using the boot FLASH and SRAM
+ that would otherwise be reserved for MPLAB.
+
+Analog Input
+============
+
+ The Mirtoo features a PGA117 amplifier/multipexer that can be configured to
+ bring any analog signal from PORT0,.. PORT7 to pin 19 of the PIC32MX:
+
+ --- ------------------------------------------------ ----------------------------
+ PIN PIC32 SIGNAL(s) BOARD SIGNAL/USAGE
+ --- ------------------------------------------------ ----------------------------
+ 19 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0 AIN PGA117 Vout
+ --- ------------------------------------------------ ----------------------------
+
+ The PGA117 driver can be enabled by setting the following the the nsh
+ configuration:
+
+ CONFIG_ADC=y : Enable support for analog input devices
+ CONFIG_PIC32MX_ADC=y : Enable support the PIC32 ADC driver
+ CONFIG_SPI_OWNBUS=n : The PGA117 is *not* the only device on the bus
+ CONFIG_ADC_PGA11X=y : Enable support for the PGA117
+
+ When CONFIG_PIC32MX_ADC=y is defined, the Mirtoo boot up logic will
+ automatically configure pin 18 (AN0) as an analog input (see configs/mirtoo/src/up_adc.c).
+ To intialize and use the PGA117, you to add logic something like the
+ following in your application code:
+
+ #include <nuttx/spi.h>
+ #include <nuttx/analog/pga11x.h>
+
+ FAR struct spi_dev_s *spi;
+ PGA11X_HANDLE handle;
+
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(2);
+ if (!spi)
+ {
+ dbg("ERROR: Failed to initialize SPI port 2\n");
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the PGA117 driver */
+
+ handle = pga11x_initialize(spi);
+ if (!handle)
+ {
+ dbg("ERROR: Failed to bind SPI port 2 to the PGA117 driver\n");
+ return -ENODEV;
+ }
+
+ After that initialization is set, then one of PORT0-7 can be select as
+ an analog input to AN0 like:
+
+ struct pga11x_settings_s settings;
+ int ret;
+
+ settings.channel = PGA11X_CHAN_CH2;
+ settings.gain = PGA11X_GAIN_2;
+
+ ret = pga11x_select(handle, &settings);
+ if (ret < 0)
+ {
+ dbg("ERROR: Failed to select channel 2, gain 2\n");
+ return -EIO;
+ }
+
+ The above logic may belong in configs/mirtoo/src/up_adc.c?
+
+ There is still one missing piece to complete the analog support on the
+ Mirtoo. This is the ADC driver that collects analog data and provides
+ and ADC driver that can be used with standard open, close, read, and write
+ interfaces. To complete this driver, the following is needed:
+
+ (1) arch/mips/src/pic32mx/pic32mx-adc.c. The ADC driver that implements
+ the ADC interfaces defined in include/nuttx/analog/adc.h and must
+ be built when CONFIG_PIC32MX_ADC is defined.
+
+ (2) configs/mirtoo/up_adc.c. Add Mirtoo logic that initializes and
+ registers the ADC driver.
+
+ A complete ADC driver will be a considerable amount of work to support
+ all of the ADC features (such as timer driven sampling). If all you want
+ to do is a simple analog conversion, then in lieu of a real ADC driver,
+ you can use simple in-line logic such as you can see in the PIC32MX7 MMB
+ touchscreen driver at configs/pic32mx7mmb/src/up_touchscreen.c
+
+PIC32MX Configuration Options
+=============================
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=mips
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_MIPS=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_MIPS32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=pic32mx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_PIC32MX250F128D=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=mirtoo
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_MIRTOO=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0xa0000000
+
+ CONFIG_ARCH_IRQPRIO - The PIC32MXx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ PIC32MX Configuration
+
+ CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
+
+ Individual subsystems can be enabled:
+
+ CONFIG_PIC32MX_WDT - Watchdog timer
+ CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
+ CONFIG_PIC32MX_T3 - Timer 3
+ CONFIG_PIC32MX_T4 - Timer 4
+ CONFIG_PIC32MX_T5 - Timer 5
+ CONFIG_PIC32MX_IC1 - Input Capture 1
+ CONFIG_PIC32MX_IC2 - Input Capture 2
+ CONFIG_PIC32MX_IC3 - Input Capture 3
+ CONFIG_PIC32MX_IC4 - Input Capture 4
+ CONFIG_PIC32MX_IC5 - Input Capture 5
+ CONFIG_PIC32MX_OC1 - Output Compare 1
+ CONFIG_PIC32MX_OC2 - Output Compare 2
+ CONFIG_PIC32MX_OC3 - Output Compare 3
+ CONFIG_PIC32MX_OC4 - Output Compare 4
+ CONFIG_PIC32MX_OC5 - Output Compare 5
+ CONFIG_PIC32MX_I2C1 - I2C 1
+ CONFIG_PIC32MX_I2C2 - I2C 2
+ CONFIG_PIC32MX_SPI1 - SPI 1
+ CONFIG_PIC32MX_SPI2 - SPI 2
+ CONFIG_PIC32MX_UART1 - UART 1
+ CONFIG_PIC32MX_UART2 - UART 2
+ CONFIG_PIC32MX_ADC - ADC 1
+ CONFIG_PIC32MX_PMP - Parallel Master Port
+ CONFIG_PIC32MX_CM1 - Comparator 1
+ CONFIG_PIC32MX_CM2 - Comparator 2
+ CONFIG_PIC32MX_CM3 - Comparator 3
+ CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA - DMA
+ CONFIG_PIC32MX_FLASH - FLASH
+ CONFIG_PIC32MX_USBDEV - USB device
+ CONFIG_PIC32MX_USBHOST - USB host
+ CONFIG_PIC32MX_CTMU - CTMU
+
+ PIC32MX Configuration Settings
+ DEVCFG0:
+ CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
+ value 2 enables.
+ CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
+ Default 1 (PG2)
+ CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
+ CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
+ CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
+ DEVCFG1: (All settings determined by selections in board.h)
+ DEVCFG2: (All settings determined by selections in board.h)
+ DEVCFG3:
+ CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
+ (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
+ (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
+ can be enabled later by software).
+
+ The priority of interrupts may be specified. The value ranage of
+ priority is 4-31. The default (16) will be used if these any of these
+ are undefined.
+
+ CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
+ CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
+ CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
+ CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
+ CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
+ CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
+ CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
+ CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
+ CONFIG_PIC32MX_T2PRIO - Timer 2 priority
+ CONFIG_PIC32MX_T3PRIO - Timer 3 priority
+ CONFIG_PIC32MX_T4PRIO - Timer 4 priority
+ CONFIG_PIC32MX_T5PRIO - Timer 5 priority
+ CONFIG_PIC32MX_IC1PRIO - Input Capture 1
+ CONFIG_PIC32MX_IC2PRIO - Input Capture 2
+ CONFIG_PIC32MX_IC3PRIO - Input Capture 3
+ CONFIG_PIC32MX_IC4PRIO - Input Capture 4
+ CONFIG_PIC32MX_IC5PRIO - Input Capture 5
+ CONFIG_PIC32MX_OC1PRIO - Output Compare 1
+ CONFIG_PIC32MX_OC2PRIO - Output Compare 2
+ CONFIG_PIC32MX_OC3PRIO - Output Compare 3
+ CONFIG_PIC32MX_OC4PRIO - Output Compare 4
+ CONFIG_PIC32MX_OC5PRIO - Output Compare 5
+ CONFIG_PIC32MX_I2C1PRIO - I2C 1
+ CONFIG_PIC32MX_I2C2PRIO - I2C 2
+ CONFIG_PIC32MX_SPI1PRIO - SPI 1
+ CONFIG_PIC32MX_SPI2PRIO - SPI 2
+ CONFIG_PIC32MX_UART1PRIO - UART 1
+ CONFIG_PIC32MX_UART2PRIO - UART 2
+ CONFIG_PIC32MX_CN - Input Change Interrupt
+ CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
+ CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
+ CONFIG_PIC32MX_CM1PRIO - Comparator 1
+ CONFIG_PIC32MX_CM2PRIO - Comparator 2
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
+ CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
+ CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
+ CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
+ CONFIG_PIC32MX_FCEPRIO - Flash Control Event
+ CONFIG_PIC32MX_USBPRIO - USB
+
+ PIC32MXx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ PIC32MXx USB Device Configuration
+
+ PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
+
+Configurations
+==============
+
+Each PIC32MX configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh mirtoo/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ =======
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest. This configuration use UART1 which is
+ available on FUNC 4 and 5 on connector X3:
+
+ CONFIG_PIC32MX_UART1=y : UART1 for serial console
+ CONFIG_UART1_SERIAL_CONSOLE=n
+
+ If you are not using MPLAB to debug, you may switch to UART2
+ by editting the .config file after configuration to disable UART1
+ and select UART2. You should also change Make.defs to use the
+ release.ld linker script instead of the debug.ld link script.
+
+ This configuration also uses the Microchip C32 toolchain under
+ windows by default:
+
+ CONFIG_PIC32MX_MICROCHIPW_LITE=y : Lite version of windows toolchain
+
+ To switch to the Linux C32 toolchain you will have to change (1) the
+ toolchain selection in .config (after configuration) and (2) the
+ path to the toolchain in setenv.sh. See notes above with regard to
+ the XC32 toolchain.
+
+ nsh:
+ ====
+ This configuration directory holds configuration files tht can
+ be used to support the NuttShell (NSH). This configuration use
+ UART1 which is available on FUNC 4 and 5 on connector X3:
+
+ CONFIG_PIC32MX_UART1=y : UART1 for serial console
+ CONFIG_UART1_SERIAL_CONSOLE=n
+
+ UART2
+ -----
+ If you are not using MPLAB to debug, you may switch to UART2
+ by following the instructions above for the ostest configuration.
+
+ This configuration also uses the Microchip C32 toolchain under
+ windows by default:
+
+ CONFIG_PIC32MX_MICROCHIPW_LITE=y : Lite version of windows toolchain
+
+ To switch to the Linux C32 toolchain you will have to change (1) the
+ toolchain selection in .config (after configuration) and (2) the
+ path to the toolchain in setenv.sh. See notes above with regard to
+ the XC32 toolchain.
+
+ PGA117 Support:
+ --------------
+ The Mirtoo's PGA117 amplifier/multipexer is not used by this configuration
+ but can be enabled by setting:
+
+ CONFIG_ADC=y : Enable support for analog input devices
+ CONFIG_SPI_OWNBUS=y : If the PGA117 is the only device on the bus
+ CONFIG_ADC_PGA11X=y : Enable support for the PGA117
+
+ nxffs:
+ ======
+ This is a configuration very similar to the nsh configuration. This
+ configure also provides the NuttShell (NSH). And this configuration use
+ UART1 which is available on FUNC 4 and 5 on connector X3 (as described
+ for the nsh configuration). This configuration differs from the nsh
+ configuration in the following ways:
+
+ 1) It uses the Pinguino toolchain be default (this is easily changed,
+ see above).
+
+ CONFIG_PIC32MX_PINGUINOW=y
+
+ 2) SPI2 is enabled and support is included for the NXFFS file system
+ on the 32Mbit SST25 device on the Mirtoo board. NXFFS is the NuttX
+ wear-leveling file system.
+
+ CONFIG_PIC32MX_SPI2=y
+ CONFIG_MTD_SST25=y
+ CONFIG_SST25_SECTOR512=y
+ CONFIG_DISABLE_MOUNTPOINT=n
+ CONFIG_FS_NXFFS=y
+ CONFIG_NSH_ARCHINIT=y
+
+ 3) Many operating system features are suppressed to produce a smaller
+ footprint.
+
+ CONFIG_SCHED_WAITPID=n
+ CONFIG_DISABLE_POSIX_TIMERS=y
+ CONFIG_DISABLE_PTHREAD=y
+ CONFIG_DISABLE_MQUEUE=y
+ CONFIG_DISABLE_MQUEUE=y
+
+ 4) Many NSH commands are suppressed, also for a smaller FLASH footprint
+
+ CONFIG_NSH_DISABLESCRIPT=y
+ CONFIG_NSH_DISABLEBG=y
+
+ CONFIG_NSH_DISABLE_DD=y
+ CONFIG_NSH_DISABLE_EXEC=y
+ CONFIG_NSH_DISABLE_EXIT=y
+ CONFIG_NSH_DISABLE_GET=y
+ CONFIG_NSH_DISABLE_IFCONFIG=y
+ CONFIG_NSH_DISABLE_KILL=y
+ CONFIG_NSH_DISABLE_MKFATFS=y
+ CONFIG_NSH_DISABLE_MKFIFO=y
+ CONFIG_NSH_DISABLE_MKRD=y
+ CONFIG_NSH_DISABLE_NFSMOUNT=y
+ CONFIG_NSH_DISABLE_PING=y
+ CONFIG_NSH_DISABLE_PUT=y
+ CONFIG_NSH_DISABLE_SH=y
+ CONFIG_NSH_DISABLE_TEST=y
+ CONFIG_NSH_DISABLE_WGET=y
+
+ When the system boots, you should have the NXFFS file system mounted
+ at /mnt/sst25.
+
+ NOTES: (1) It takes many seconds to boot the sytem using the NXFFS
+ file system because the entire FLASH must be verified on power up
+ (and longer the first time that NXFFS comes up and has to format the
+ entire FLASH). (2) FAT does not have these delays and this configuration
+ can be modified to use the (larger) FAT file system as described below.
+ But you will, or course, lose the wear-leveling feature if FAT is used.
+
+ fat:
+ ----
+ There is no FAT configuration, but the nxffx configuration can be used
+ to support the FAT FS if the following changes are made to the NuttX
+ configuration file:
+
+ CONFIG_FS_NXFFS=n
+ CONFIG_FS_FAT=y
+ CONFIG_NSH_DISABLE_MKFATFS=n
+
+ In this configuration, the FAT file system will not be automatically
+ monounted. When NuttX boots to the NSH prompt, you will find the
+ SST5 block driver at /dev/mtdblock0. This can be formatted with a
+ FAT file system and mounted with these commands:
+
+ nsh> mkfatfs /dev/mtdblock0
+ nsh> mount -t vfat /dev/mtdblock0 /mnt/sst25
+
+ PGA117 Support:
+ ---------------
+ The Mirtoo's PGA117 amplifier/multipexer is not used by this configuration
+ but can be enabled by setting:
+
+ CONFIG_ADC=y : Enable support for anlog input devices
+ CONFIG_SPI_OWNBUS=n : The PGA117 is *not* the only device on the bus
+ CONFIG_ADC_PGA11X=y : Enable support for the PGA117
+
diff --git a/nuttx/configs/mirtoo/include/board.h b/nuttx/configs/mirtoo/include/board.h
new file mode 100644
index 000000000..1e3abdc73
--- /dev/null
+++ b/nuttx/configs/mirtoo/include/board.h
@@ -0,0 +1,190 @@
+/****************************************************************************
+ * configs/mirtoo/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_MIRTOO_INCLUDE_BOARD_H
+#define __CONFIGS_MIRTOO_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdbool.h>
+#endif
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* The Mirtoo does not use an external crystal but relies instead on the
+ * internal +/- 0.9% FRC clock. That clock has a nomninal frequency of 8MHz.
+ */
+
+#define BOARD_FRC_FREQ 8000000 /* FRC nomimal frequency(8MHz) */
+
+/* Oscillator modes */
+
+#define BOARD_FNOSC_FRCPLL 1 /* Use FRC w/PLL module */
+#define BOARD_POSC_DISABLED 1 /* Disable primary oscillator */
+
+/* PLL configuration and resulting CPU clock.
+ * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
+ */
+
+#define BOARD_PLL_INPUT BOARD_FRC_FREQ
+#define BOARD_PLL_IDIV 2 /* PLL input divider: Input = 4MHz */
+#define BOARD_PLL_MULT 20 /* PLL multiplier: PLL = 80MHz */
+#define BOARD_PLL_ODIV 2 /* PLL output divider: Output = 40MHz */
+
+#define BOARD_CPU_CLOCK 40000000 /* CPU clock 40MHz = (((8MHz / 2) * 20) / 2) */
+
+/* USB PLL configuration.
+ * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
+ */
+
+#define BOARD_UPLL_IDIV 2 /* USB PLL divider (revisit) */
+#define BOARD_USB_CLOCK 48000000 /* USB clock (8MHz / 2) * 24 / 2) */
+
+/* Peripheral clock is divided down from CPU clock.
+ * PBCLOCK = CPU_CLOCK / PBDIV
+ */
+
+#define BOARD_PBDIV 1 /* Peripheral clock divisor (PBDIV) */
+#define BOARD_PBCLOCK 40000000 /* Peripheral clock (PBCLK = 40MHz/1) */
+
+/* Watchdog pre-scaler (re-visit) */
+
+#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
+#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
+
+/* LED definitions **********************************************************/
+/* The Mirtoo module has 2 user LEDs labeled LED0 and LED1 in the schematics:
+ *
+ * --- ----- --------------------------------------------------------------
+ * PIN Board Notes
+ * --- ----- --------------------------------------------------------------
+ * RC8 LED0 Grounded, high value illuminates
+ * RC9 LED1 Grounded, high value illuminates
+ *
+ * The Dimitech DTX1-4000L EV-kit1 supports 3 more LEDs, but there are not
+ * controllable from software.
+ */
+
+ /* LED index values for use with pic32mx_setled() */
+
+#define PIC32MX_MIRTOO_LED0 0
+#define PIC32MX_MIRTOO_LED1 1
+#define PIC32MX_MIRTOO_NLEDS 2
+
+/* LED bits for use with pic32mx_setleds() */
+
+#define PIC32MX_MIRTOO_LED0_BIT (1 << PIC32MX_MIRTOO_LED0)
+#define PIC32MX_MIRTOO_LED1_BIT (1 << PIC32MX_MIRTOO_LED1)
+
+/* If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as
+ * follows:
+ * ON OFF
+ * ------------------------- ---- ---- ---- ----
+ * LED0 LED1 LED0 LED1
+ * ------------------------- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF --- ---
+ * LED_HEAPALLOCATE 1 ON OFF --- ---
+ * LED_IRQSENABLED 2 OFF ON --- ---
+ * LED_STACKCREATED 3 ON ON --- ---
+ * LED_INIRQ 4 ON N/C OFF N/C
+ * LED_SIGNAL 4 ON N/C OFF N/C
+ * LED_ASSERTION 4 ON N/C OFF N/C
+ * LED_PANIC 4 ON N/C OFF N/C
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 4
+#define LED_ASSERTION 4
+#define LED_PANIC 4
+
+#define LED_NVALUES 5
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_ledinit, pic32mx_setled, and pic32mx_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
+ * are available to control the LEDs from user applicaitons.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+EXTERN void pic32mx_setled(int led, bool ledon);
+EXTERN void pic32mx_setleds(uint8_t ledset);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MIRTOO_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/mirtoo/nsh/Make.defs b/nuttx/configs/mirtoo/nsh/Make.defs
new file mode 100644
index 000000000..3b8857613
--- /dev/null
+++ b/nuttx/configs/mirtoo/nsh/Make.defs
@@ -0,0 +1,197 @@
+############################################################################
+# configs/mirtoo/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip C32 toolchain under Windows
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip C32 toolchain under Windows
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ WINTOOL = y
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip C32 toolchain under Linux
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = xc32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip C32 toolchain under Linux
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = xc32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPOPENL),y)
+ # microchipOpen toolchain under Linux
+ CROSSDEV = mypic32-
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_PINGUINOW),y)
+ # Penquino mips-elf toolchain under Windows
+ CROSSDEV = mips-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = mips-elf-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_PINGUINOL),y)
+ # Penquino mips-elf toolchain under Linux
+ CROSSDEV = mips-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = mips-elf-debug.ld
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mirtoo/nsh/appconfig b/nuttx/configs/mirtoo/nsh/appconfig
new file mode 100644
index 000000000..73fe6f32c
--- /dev/null
+++ b/nuttx/configs/mirtoo/nsh/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/mirtoo/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
diff --git a/nuttx/configs/mirtoo/nsh/defconfig b/nuttx/configs/mirtoo/nsh/defconfig
new file mode 100644
index 000000000..bcc18dc3c
--- /dev/null
+++ b/nuttx/configs/mirtoo/nsh/defconfig
@@ -0,0 +1,495 @@
+############################################################################
+# configs/mirtoo/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX250F128D=y
+CONFIG_ARCH_BOARD="mirtoo"
+CONFIG_ARCH_BOARD_MIRTOO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in linker scripts as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+CONFIG_PIC32MX_MICROCHIPOPENL=n
+CONFIG_PIC32MX_PINGUINOW=n
+CONFIG_PIC32MX_PINGUINOL=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_CM3=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+
+#
+# Mirtoo Board Settings
+#
+CONFIG_MTD_SST25=n
+CONFIG_SST25_SPIMODE=1
+CONFIG_SST25_SPIFREQUENCY=20000000
+CONFIG_SST25_SECTOR512=n
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=1
+CONFIG_PIC32MX_ICESEL=2
+CONFIG_PIC32MX_OSCOUT=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_SPI=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=22
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# PGA117 support
+#
+# Prerequisites:
+#
+CONFIG_ADC=n
+CONFIG_SPI_OWNBUS=y
+CONFIG_DEBUG_SPI=n
+
+CONFIG_ADC_PGA11X=n
+#CONFIG_PGA11X_SPIFREQUENCY
+CONFIG_PGA11X_DAISYCHAIN=n
+CONFIG_PGA11X_SPIMODE=1
+CONFIG_PGA11X_MULTIPLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mirtoo/nsh/setenv.sh b/nuttx/configs/mirtoo/nsh/setenv.sh
new file mode 100755
index 000000000..95a5e8d30
--- /dev/null
+++ b/nuttx/configs/mirtoo/nsh/setenv.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+# configs/mirtoo/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX C32 toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install the
+# toolchain at a different location
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This the Linux path to the location where I installed the MicroChip
+# PIC32MX XC32 toolchain under Linux. This is the default install
+# location. You will also have to edit this if you install a different
+# version of if you install the toolchain at a different location
+#export TOOLCHAIN_BIN="/opt/microchip/xc32/v1.00/bin"
+
+# This the Cygwin path to the location where I installed the Pinguino
+# toolchain under Windows. You will have to edit this if you install the
+# tool chain in a different location or use a different version. /bin
+# needs to precede the tool path or otherwise you will get
+# /cygdrive/c/PinguinoX.3/win32/p32/bin/make which does not like POSIX
+# style paths.
+#export TOOLCHAIN_BIN="/bin:/cygdrive/c/PinguinoX.3/win32/p32/bin"
+
+# This the Linux path to the location where I installed the microchipOpen
+# toolchain under Linux. You will have to edit this if you use the
+# microchipOpen toolchain.
+#export TOOLCHAIN_BIN="~/projects/microchipopen/v105_freeze/pic32-v105-freeze-20120622/install-image/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mirtoo/nxffs/Make.defs b/nuttx/configs/mirtoo/nxffs/Make.defs
new file mode 100644
index 000000000..bf5f06698
--- /dev/null
+++ b/nuttx/configs/mirtoo/nxffs/Make.defs
@@ -0,0 +1,197 @@
+############################################################################
+# configs/mirtoo/nxffs/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip C32 toolchain under Windows
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip C32 toolchain under Windows
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ WINTOOL = y
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip C32 toolchain under Linux
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = xc32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip C32 toolchain under Linux
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = xc32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPOPENL),y)
+ # microchipOpen toolchain under Linux
+ CROSSDEV = mypic32-
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_PINGUINOW),y)
+ # Penquino mips-elf toolchain under Windows
+ CROSSDEV = mips-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = mips-elf-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_PINGUINOL),y)
+ # Penquino mips-elf toolchain under Linux
+ CROSSDEV = mips-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = mips-elf-debug.ld
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mirtoo/nxffs/appconfig b/nuttx/configs/mirtoo/nxffs/appconfig
new file mode 100644
index 000000000..b9c9d36bb
--- /dev/null
+++ b/nuttx/configs/mirtoo/nxffs/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/mirtoo/nxffs/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
diff --git a/nuttx/configs/mirtoo/nxffs/defconfig b/nuttx/configs/mirtoo/nxffs/defconfig
new file mode 100644
index 000000000..d7454bda6
--- /dev/null
+++ b/nuttx/configs/mirtoo/nxffs/defconfig
@@ -0,0 +1,538 @@
+############################################################################
+# configs/mirtoo/nxffs/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX250F128D=y
+CONFIG_ARCH_BOARD="mirtoo"
+CONFIG_ARCH_BOARD_MIRTOO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in linker scripts as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=n
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+CONFIG_PIC32MX_MICROCHIPOPENL=n
+CONFIG_PIC32MX_PINGUINOW=y
+CONFIG_PIC32MX_PINGUINOL=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=y
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_CM3=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+
+#
+# Mirtoo Board Settings
+#
+CONFIG_MTD_SST25=y
+CONFIG_SST25_SPIMODE=1
+CONFIG_SST25_SPIFREQUENCY=20000000
+CONFIG_SST25_SECTOR512=n
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=1
+CONFIG_PIC32MX_ICESEL=2
+CONFIG_PIC32MX_OSCOUT=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_SPI=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=22
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# PGA117 support
+#
+# Prerequisites:
+#
+CONFIG_ADC=n
+CONFIG_SPI_OWNBUS=y
+
+CONFIG_ADC_PGA11X=n
+#CONFIG_PGA11X_SPIFREQUENCY
+CONFIG_PGA11X_DAISYCHAIN=n
+CONFIG_PGA11X_SPIMODE=1
+CONFIG_PGA11X_MULTIPLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=y
+CONFIG_NSH_DISABLEBG=y
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Each NSH command can be individually disabled via one of the following
+# settings.
+#
+CONFIG_NSH_DISABLE_CAT=n
+CONFIG_NSH_DISABLE_CD=n
+CONFIG_NSH_DISABLE_CP=n
+CONFIG_NSH_DISABLE_DD=y
+CONFIG_NSH_DISABLE_ECHO=n
+CONFIG_NSH_DISABLE_EXEC=y
+CONFIG_NSH_DISABLE_EXIT=y
+CONFIG_NSH_DISABLE_FREE=n
+CONFIG_NSH_DISABLE_GET=y
+CONFIG_NSH_DISABLE_HELP=n
+CONFIG_NSH_DISABLE_IFCONFIG=y
+CONFIG_NSH_DISABLE_KILL=y
+CONFIG_NSH_DISABLE_LOSETUP=n
+CONFIG_NSH_DISABLE_LS=n
+CONFIG_NSH_DISABLE_MB=n
+CONFIG_NSH_DISABLE_MKDIR=n
+CONFIG_NSH_DISABLE_MKFATFS=y
+CONFIG_NSH_DISABLE_MKFIFO=y
+CONFIG_NSH_DISABLE_MKRD=y
+CONFIG_NSH_DISABLE_MH=n
+CONFIG_NSH_DISABLE_MOUNT=n
+CONFIG_NSH_DISABLE_MW=n
+CONFIG_NSH_DISABLE_MV=n
+CONFIG_NSH_DISABLE_NFSMOUNT=y
+CONFIG_NSH_DISABLE_PS=n
+CONFIG_NSH_DISABLE_PING=y
+CONFIG_NSH_DISABLE_PUT=y
+CONFIG_NSH_DISABLE_PWD=n
+CONFIG_NSH_DISABLE_RM=n
+CONFIG_NSH_DISABLE_RMDIR=n
+CONFIG_NSH_DISABLE_SET=n
+CONFIG_NSH_DISABLE_SH=y
+CONFIG_NSH_DISABLE_SLEEP=n
+CONFIG_NSH_DISABLE_TEST=y
+CONFIG_NSH_DISABLE_UMOUNT=n
+CONFIG_NSH_DISABLE_UNSET=n
+CONFIG_NSH_DISABLE_USLEEP=n
+CONFIG_NSH_DISABLE_WGET=y
+CONFIG_NSH_DISABLE_XD=n
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mirtoo/nxffs/setenv.sh b/nuttx/configs/mirtoo/nxffs/setenv.sh
new file mode 100755
index 000000000..34f8d3ef1
--- /dev/null
+++ b/nuttx/configs/mirtoo/nxffs/setenv.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+# configs/mirtoo/nxffs/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX C32 toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install the
+# toolchain at a different location
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This the Linux path to the location where I installed the MicroChip
+# PIC32MX XC32 toolchain under Linux. This is the default install
+# location. You will also have to edit this if you install a different
+# version of if you install the toolchain at a different location
+#export TOOLCHAIN_BIN="/opt/microchip/xc32/v1.00/bin"
+
+# This the Cygwin path to the location where I installed the Pinguino
+# toolchain under Windows. You will have to edit this if you install the
+# tool chain in a different location or use a different version. /bin
+# needs to precede the tool path or otherwise you will get
+# /cygdrive/c/PinguinoX.3/win32/p32/bin/make which does not like POSIX
+# style paths.
+#export TOOLCHAIN_BIN="/bin:/cygdrive/c/PinguinoX.3/win32/p32/bin"
+
+# This the Linux path to the location where I installed the microchipOpen
+# toolchain under Linux. You will have to edit this if you use the
+# microchipOpen toolchain.
+#export TOOLCHAIN_BIN="~/projects/microchipopen/v105_freeze/pic32-v105-freeze-20120622/install-image/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mirtoo/ostest/Make.defs b/nuttx/configs/mirtoo/ostest/Make.defs
new file mode 100644
index 000000000..9956d7fb0
--- /dev/null
+++ b/nuttx/configs/mirtoo/ostest/Make.defs
@@ -0,0 +1,197 @@
+############################################################################
+# configs/mirtoo/ostest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip C32 toolchain under Windows
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip C32 toolchain under Windows
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ WINTOOL = y
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip C32 toolchain under Linux
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = xc32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip C32 toolchain under Linux
+ CROSSDEV = pic32-
+ # CROSSDEV = xc32-
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = xc32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPOPENL),y)
+ # microchipOpen toolchain under Linux
+ CROSSDEV = mypic32-
+ # MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = c32-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_PINGUINOW),y)
+ # Penquino mips-elf toolchain under Windows
+ CROSSDEV = mips-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = mips-elf-debug.ld
+endif
+ifeq ($(CONFIG_PIC32MX_PINGUINOL),y)
+ # Penquino mips-elf toolchain under Linux
+ CROSSDEV = mips-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ LDSCRIPT = mips-elf-debug.ld
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mirtoo/ostest/appconfig b/nuttx/configs/mirtoo/ostest/appconfig
new file mode 100644
index 000000000..545e133d6
--- /dev/null
+++ b/nuttx/configs/mirtoo/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mirtoo/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/mirtoo/ostest/defconfig b/nuttx/configs/mirtoo/ostest/defconfig
new file mode 100644
index 000000000..fdbc4b561
--- /dev/null
+++ b/nuttx/configs/mirtoo/ostest/defconfig
@@ -0,0 +1,471 @@
+############################################################################
+# configs/mirtoo/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX250F128D=y
+CONFIG_ARCH_BOARD="mirtoo"
+CONFIG_ARCH_BOARD_MIRTOO=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in linker scripts as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+CONFIG_PIC32MX_MICROCHIPOPENL=n
+CONFIG_PIC32MX_PINGUINOW=n
+CONFIG_PIC32MX_PINGUINOL=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_CM3=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=1
+CONFIG_PIC32MX_ICESEL=2
+CONFIG_PIC32MX_OSCOUT=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=19
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=n
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mirtoo/ostest/setenv.sh b/nuttx/configs/mirtoo/ostest/setenv.sh
new file mode 100755
index 000000000..28177a539
--- /dev/null
+++ b/nuttx/configs/mirtoo/ostest/setenv.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+# configs/mirtoo/ostest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX C32 toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install the
+# toolchain at a different location
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This the Linux path to the location where I installed the MicroChip
+# PIC32MX XC32 toolchain under Linux. This is the default install
+# location. You will also have to edit this if you install a different
+# version of if you install the toolchain at a different location
+#export TOOLCHAIN_BIN="/opt/microchip/xc32/v1.00/bin"
+
+# This the Cygwin path to the location where I installed the Pinguino
+# toolchain under Windows. You will have to edit this if you install the
+# tool chain in a different location or use a different version. /bin
+# needs to precede the tool path or otherwise you will get
+# /cygdrive/c/PinguinoX.3/win32/p32/bin/make which does not like POSIX
+# style paths.
+#export TOOLCHAIN_BIN="/bin:/cygdrive/c/PinguinoX.3/win32/p32/bin"
+
+# This the Linux path to the location where I installed the microchipOpen
+# toolchain under Linux. You will have to edit this if you use the
+# microchipOpen toolchain.
+#export TOOLCHAIN_BIN="~/projects/microchipopen/v105_freeze/pic32-v105-freeze-20120622/install-image/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mirtoo/scripts/c32-debug.ld b/nuttx/configs/mirtoo/scripts/c32-debug.ld
new file mode 100644
index 000000000..d91aa5e72
--- /dev/null
+++ b/nuttx/configs/mirtoo/scripts/c32-debug.ld
@@ -0,0 +1,313 @@
+/****************************************************************************
+ * configs/mirtoo/scripts/c32-debug.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX250F128D has 128Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 128K
+
+ /* The PIC32MX250F128D has 3Kb of boot FLASH at physical addresses
+ * 0x1fc00000-0x1fc00c00. The initial reset vector is in KSEG1, but
+ * all other accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * --------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 384 384 (0.375Kb)
+ * Gen exception 0x1fc00000 KSEG1 128 512 (0.500Kb)
+ * TLB Refill 0x1fc00200 KSEG1 256 768 (0.750Kb)
+ * Cache Error 0x1fc00300 KSEG1 128 896 (0.875Kb)
+ * Others 0x1fc00380 KSEG1 128 1024 (1.000Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152 (1.125Kb)
+ * Debug code 0x1fc00480 KSEG1 3072-1152-16 3056 (2.984Kb)
+ * DEVCFG3-0 0x1fc00bf0 KSEG1 16 3072 (3Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 256
+ kseg1_cacherr (rx) : ORIGIN = 0xbfc00300, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 3072-1152-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc00bf0, LENGTH = 16
+
+ /* The PIC32MX250F128D has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * NOTE: When used with MPLAB, we need to set aside 512 bytes of memory
+ * at the beginning of this region for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_progmem
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/mirtoo/scripts/c32-release.ld b/nuttx/configs/mirtoo/scripts/c32-release.ld
new file mode 100644
index 000000000..05f0ecc06
--- /dev/null
+++ b/nuttx/configs/mirtoo/scripts/c32-release.ld
@@ -0,0 +1,315 @@
+/****************************************************************************
+ * configs/mirtoo/scripts/c32-release.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX250F128D has 128Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 128K
+
+ /* The PIC32MX250F128D has 3Kb of boot FLASH at physical addresses
+ * 0x1fc00000-0x1fc00c00. The initial reset vector is in KSEG1, but
+ * all other accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * --------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 384 384 (0.375Kb)
+ * Gen exception 0x1fc00000 KSEG1 128 512 (0.500Kb)
+ * TLB Refill 0x1fc00200 KSEG1 256 768 (0.750Kb)
+ * Cache Error 0x1fc00300 KSEG1 128 896 (0.875Kb)
+ * Others 0x1fc00380 KSEG1 128 1024 (1.000Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152 (1.125Kb)
+ * JTAG 0x1fc00480 KSEG1 16 1168 (1.141Kb)
+ * Exceptions 0x1fc00490 KSEG0 3072-1168-16 3056 (2.984Kb)
+ * DEVCFG3-0 0x1fc00bf0 KSEG1 16 3072 (3Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 256
+ kseg1_cacherr (rx) : ORIGIN = 0xbfc00300, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 3072-1168-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc00bf0, LENGTH = 16
+
+ /* The PIC32MX250F128D has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * NOTE: When used with MPLAB, we need to set aside 512 bytes of memory
+ * at the beginning of this region for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/mirtoo/scripts/mips-elf-debug.ld b/nuttx/configs/mirtoo/scripts/mips-elf-debug.ld
new file mode 100644
index 000000000..c08ba13c8
--- /dev/null
+++ b/nuttx/configs/mirtoo/scripts/mips-elf-debug.ld
@@ -0,0 +1,313 @@
+/****************************************************************************
+ * configs/mirtoo/scripts/mips-elf-debug.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX250F128D has 128Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 128K
+
+ /* The PIC32MX250F128D has 3Kb of boot FLASH at physical addresses
+ * 0x1fc00000-0x1fc00c00. The initial reset vector is in KSEG1, but
+ * all other accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * --------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 384 384 (0.375Kb)
+ * Gen exception 0x1fc00000 KSEG1 128 512 (0.500Kb)
+ * TLB Refill 0x1fc00200 KSEG1 256 768 (0.750Kb)
+ * Cache Error 0x1fc00300 KSEG1 128 896 (0.875Kb)
+ * Others 0x1fc00380 KSEG1 128 1024 (1.000Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152 (1.125Kb)
+ * Debug code 0x1fc00480 KSEG1 3072-1152-16 3056 (2.984Kb)
+ * DEVCFG3-0 0x1fc00bf0 KSEG1 16 3072 (3Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 256
+ kseg1_cacherr (rx) : ORIGIN = 0xbfc00300, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 3072-1152-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc00bf0, LENGTH = 16
+
+ /* The PIC32MX250F128D has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * NOTE: When used with MPLAB, we need to set aside 512 bytes of memory
+ * at the beginning of this region for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-littlemips")
+OUTPUT_ARCH(mips)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_progmem
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/mirtoo/scripts/mips-elf-release.ld b/nuttx/configs/mirtoo/scripts/mips-elf-release.ld
new file mode 100644
index 000000000..ce64e67a5
--- /dev/null
+++ b/nuttx/configs/mirtoo/scripts/mips-elf-release.ld
@@ -0,0 +1,315 @@
+/****************************************************************************
+ * configs/mirtoo/scripts/mips-elf-release.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX250F128D has 128Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 128K
+
+ /* The PIC32MX250F128D has 3Kb of boot FLASH at physical addresses
+ * 0x1fc00000-0x1fc00c00. The initial reset vector is in KSEG1, but
+ * all other accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * --------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 384 384 (0.375Kb)
+ * Gen exception 0x1fc00000 KSEG1 128 512 (0.500Kb)
+ * TLB Refill 0x1fc00200 KSEG1 256 768 (0.750Kb)
+ * Cache Error 0x1fc00300 KSEG1 128 896 (0.875Kb)
+ * Others 0x1fc00380 KSEG1 128 1024 (1.000Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152 (1.125Kb)
+ * JTAG 0x1fc00480 KSEG1 16 1168 (1.141Kb)
+ * Exceptions 0x1fc00490 KSEG0 3072-1168-16 3056 (2.984Kb)
+ * DEVCFG3-0 0x1fc00bf0 KSEG1 16 3072 (3Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 256
+ kseg1_cacherr (rx) : ORIGIN = 0xbfc00300, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 3072-1168-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc00bf0, LENGTH = 16
+
+ /* The PIC32MX250F128D has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * NOTE: When used with MPLAB, we need to set aside 512 bytes of memory
+ * at the beginning of this region for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K
+}
+
+OUTPUT_FORMAT("elf32-littlemips")
+OUTPUT_ARCH(mips)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/mirtoo/scripts/xc32-debug.ld b/nuttx/configs/mirtoo/scripts/xc32-debug.ld
new file mode 100644
index 000000000..7582dcaab
--- /dev/null
+++ b/nuttx/configs/mirtoo/scripts/xc32-debug.ld
@@ -0,0 +1,313 @@
+/****************************************************************************
+ * configs/mirtoo/scripts/xc32-debug.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX250F128D has 128Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_program_mem (rx) : ORIGIN = 0x9d000000, LENGTH = 128K
+
+ /* The PIC32MX250F128D has 3Kb of boot FLASH at physical addresses
+ * 0x1fc00000-0x1fc00c00. The initial reset vector is in KSEG1, but
+ * all other accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * --------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 384 384 (0.375Kb)
+ * Gen exception 0x1fc00000 KSEG1 128 512 (0.500Kb)
+ * TLB Refill 0x1fc00200 KSEG1 256 768 (0.750Kb)
+ * Cache Error 0x1fc00300 KSEG1 128 896 (0.875Kb)
+ * Others 0x1fc00380 KSEG1 128 1024 (1.000Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152 (1.125Kb)
+ * Debug code 0x1fc00480 KSEG1 3072-1152-16 3056 (2.984Kb)
+ * DEVCFG3-0 0x1fc00bf0 KSEG1 16 3072 (3Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 256
+ kseg1_cacherr (rx) : ORIGIN = 0xbfc00300, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 3072-1152-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc00bf0, LENGTH = 16
+
+ /* The PIC32MX250F128D has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * NOTE: When used with MPLAB, we need to set aside 512 bytes of memory
+ * at the beginning of this region for use by MPLAB.
+ */
+
+ kseg1_data_mem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_program_mem
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_program_mem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_data_mem) ;
+ _bmxdudba_address = LENGTH(kseg1_data_mem) ;
+ _bmxdupba_address = LENGTH(kseg1_data_mem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_data_mem AT>kseg0_program_mem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_data_mem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_data_mem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/mirtoo/scripts/xc32-release.ld b/nuttx/configs/mirtoo/scripts/xc32-release.ld
new file mode 100644
index 000000000..2c8471ad8
--- /dev/null
+++ b/nuttx/configs/mirtoo/scripts/xc32-release.ld
@@ -0,0 +1,315 @@
+/****************************************************************************
+ * configs/mirtoo/scripts/xc32-release.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX250F128D has 128Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_program_mem (rx) : ORIGIN = 0x9d000000, LENGTH = 128K
+
+ /* The PIC32MX250F128D has 3Kb of boot FLASH at physical addresses
+ * 0x1fc00000-0x1fc00c00. The initial reset vector is in KSEG1, but
+ * all other accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * --------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 384 384 (0.375Kb)
+ * Gen exception 0x1fc00000 KSEG1 128 512 (0.500Kb)
+ * TLB Refill 0x1fc00200 KSEG1 256 768 (0.750Kb)
+ * Cache Error 0x1fc00300 KSEG1 128 896 (0.875Kb)
+ * Others 0x1fc00380 KSEG1 128 1024 (1.000Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152 (1.125Kb)
+ * JTAG 0x1fc00480 KSEG1 16 1168 (1.141Kb)
+ * Exceptions 0x1fc00490 KSEG0 3072-1168-16 3056 (2.984Kb)
+ * DEVCFG3-0 0x1fc00bf0 KSEG1 16 3072 (3Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 256
+ kseg1_cacherr (rx) : ORIGIN = 0xbfc00300, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 3072-1168-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc00bf0, LENGTH = 16
+
+ /* The PIC32MX250F128D has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * NOTE: When used with MPLAB, we need to set aside 512 bytes of memory
+ * at the beginning of this region for use by MPLAB.
+ */
+
+ kseg1_data_mem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_program_mem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_data_mem) ;
+ _bmxdudba_address = LENGTH(kseg1_data_mem) ;
+ _bmxdupba_address = LENGTH(kseg1_data_mem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_data_mem AT > kseg0_program_mem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_data_mem AT>kseg0_program_mem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_data_mem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_data_mem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/mirtoo/src/Makefile b/nuttx/configs/mirtoo/src/Makefile
new file mode 100644
index 000000000..bc2ca0805
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/Makefile
@@ -0,0 +1,96 @@
+############################################################################
+# configs/mirtoo/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c
+
+ifeq ($(CONFIG_PIC32MX_SPI2),y)
+CSRCS += up_spi2.c
+endif
+
+ifeq ($(CONFIG_PIC32MX_ADC),y)
+CSRCS += up_adc.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/mirtoo/src/mirtoo-internal.h b/nuttx/configs/mirtoo/src/mirtoo-internal.h
new file mode 100644
index 000000000..cbdbf2e12
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/mirtoo-internal.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+ * configs/mirtoo/src/mirtoo-internal.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_MIRTOO_SRC_MIRTOO_INTERNAL_H
+#define __CONFIGS_MIRTOO_SRC_MIRTOO_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_spi2initialize
+ *
+ * Description:
+ * Called to configure SPI2 chip select GPIO pins for the Mirtoo module.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_PIC32MX_SPI2
+EXTERN void weak_function pic32mx_spi2initialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_adcinitialize
+ *
+ * Description:
+ * Perform architecture specific ADC initialization
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PIC32MX_ADC
+/* EXTERN int pic32mx_adcinitialize(void); not used */
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MIRTOO_SRC_MIRTOO_INTERNAL_H */
diff --git a/nuttx/configs/mirtoo/src/up_adc.c b/nuttx/configs/mirtoo/src/up_adc.c
new file mode 100644
index 000000000..1f1fa2eb8
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/up_adc.c
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * config/mirtoo/src/up_adc.c
+ * arch/arm/src/board/up_adc.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "pic32mx-internal.h"
+#include "mirtoo-internal.h"
+
+#ifdef CONFIG_PIC32MX_ADC
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* The Mirtoo features a PGA117 amplifier/multipexer that can be configured to
+ * bring any analog signal from PORT0,.. PORT7 to pin 19 of the PIC32MX:
+ *
+ * --- ------------------------------------------------ ----------------------------
+ * PIN PIC32 SIGNAL(s) BOARD SIGNAL/USAGE
+ * --- ------------------------------------------------ ----------------------------
+ * 19 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0 AIN PGA117 Vout
+ --- ------------------------------------------------ ----------------------------
+ *
+ * The PGA117 driver can be enabled by setting the following the the nsh
+ * configuration:
+ *
+ * CONFIG_ADC=y : Enable support for analog input devices
+ * CONFIG_PIC32MX_ADC=y : Enable support the PIC32 ADC driver
+ * CONFIG_SPI_OWNBUS=n : The PGA117 is *not* the only device on the bus
+ * CONFIG_ADC_PGA11X=y : Enable support for the PGA117
+ *
+ * When CONFIG_PIC32MX_ADC=y is defined, the Mirtoo boot up logic will automatically
+ * configure pin 18 (AN0) as an analog input.
+ */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pic32mx_adcinitialize
+ *
+ * Description:
+ * Perform architecture specific ADC initialization
+ *
+ ****************************************************************************/
+
+#if 0 /* Not used */
+int pic32mx_adcinitialize(void)
+{
+ /* Configure the pin 19 as an analog input */
+#warning "Missing logic"
+
+ /* Initialize the PGA117 amplifier multiplexer */
+#warning "Missing logic"
+
+ /* Register the ADC device driver */
+#warning "Missing logic"
+
+ return OK;
+}
+#endif
+
+#endif /* CONFIG_PIC32MX_ADC */ \ No newline at end of file
diff --git a/nuttx/configs/mirtoo/src/up_boot.c b/nuttx/configs/mirtoo/src/up_boot.c
new file mode 100644
index 000000000..8acce6c45
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/up_boot.c
@@ -0,0 +1,161 @@
+/************************************************************************************
+ * configs/mirtoo/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "pic32mx-pps.h"
+#include "mirtoo-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+#define GPIO_U1TX (GPIO_OUTPUT|GPIO_PORTC|GPIO_PIN5)
+#define GPIO_U1RX (GPIO_INPUT|GPIO_PORTC|GPIO_PIN6)
+
+#define GPIO_U2TX (GPIO_OUTPUT|GPIO_PORTB|GPIO_PIN10)
+#define GPIO_U2RX (GPIO_INPUT|GPIO_PORTB|GPIO_PIN11)
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_uartinitialize
+ *
+ * Description:
+ * When mounted on the DTX1-4000L EV-kit1 board, serial output is avaiable through
+ * an FT230X device via the FUNC0 and FUNC1 module outputs. If CONFIG_PIC32MX_UART2
+ * is enabled, the src/up_boot will configure the UART2 pins as follows.
+ *
+ * ---------- ------ ----- ------ -------------------------
+ * BOARD OUTPUT PIN SIGNAL NOTES
+ * ---------- ------ ----- ------ -------------------------
+ * FT230X RXD FUNC0 RPB11 U2RX UART2 RX (Also PGEC2)
+ * FT230X TXD FUNC1 RPB10 U2TX UART2 TX (Also PGED2)
+ *
+ * If CONFIG_PIC32MX_UART1 is enabled, the src/up_boot will configure the UART
+ * pins as follows. This will support communictions (via an external RS-232
+ * driver) through X3 pins 4 and 5:
+ *
+ * ---------- ------ ----- ------ -------------------------
+ * BOARD MODULE PIN SIGNAL NOTES
+ * ---------- ------ ----- ------ -------------------------
+ * X3, pin 4 FUNC4 RPBC5 U1TX UART1 TX
+ * X3, pin 5 FUNC5 RPBC6 U1RX UART1 RX
+ *
+ ************************************************************************************/
+
+static inline void pic32mx_uartinitialize(void)
+{
+#ifdef CONFIG_PIC32MX_UART2
+ /* Make sure that TRIS pins are set correctly. Configure the UART pins as digital
+ * inputs and outputs first.
+ */
+
+ pic32mx_configgpio(GPIO_U2TX);
+ pic32mx_configgpio(GPIO_U2RX);
+
+ /* Configure UART TX and RX pins to RPB10 and 11, respectively */
+
+ putreg32(PPS_INSEL_RPB11, PIC32MX_PPS_U2RXR);
+ putreg32(PPS_OUTSEL_U2TX, PIC32MX_PPS_RPB10R);
+#endif
+
+#ifdef CONFIG_PIC32MX_UART1
+ /* Make sure that TRIS pins are set correctly. Configure the UART pins as digital
+ * inputs and outputs first.
+ */
+
+ pic32mx_configgpio(GPIO_U1TX);
+ pic32mx_configgpio(GPIO_U1RX);
+
+ /* Configure UART TX and RX pins to RPB10 and 11, respectively */
+
+ putreg32(PPS_INSEL_RPC6, PIC32MX_PPS_U1RXR);
+ putreg32(PPS_OUTSEL_U1TX, PIC32MX_PPS_RPC5R);
+#endif
+}
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_boardinitialize
+ *
+ * Description:
+ * All PIC32MX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void pic32mx_boardinitialize(void)
+{
+ /* Configure the console UART */
+
+ pic32mx_uartinitialize();
+
+ /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak
+ * function pic32mx_spi2initialize() has been brought into the link.
+ */
+
+#ifdef CONFIG_PIC32MX_SPI2
+ if (pic32mx_spi2initialize)
+ {
+ pic32mx_spi2initialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ pic32mx_ledinit();
+#endif
+}
diff --git a/nuttx/configs/mirtoo/src/up_leds.c b/nuttx/configs/mirtoo/src/up_leds.c
new file mode 100644
index 000000000..8eb719717
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/up_leds.c
@@ -0,0 +1,258 @@
+/****************************************************************************
+ * configs/mirtoo/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "pic32mx-internal.h"
+#include "mirtoo-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED Configuration ********************************************************/
+/* The Mirtoo module has 2 user LEDs labeled LED0 and LED1 in the schematics:
+ *
+ * --- ----- --------------------------------------------------------------
+ * PIN Board Notes
+ * --- ----- --------------------------------------------------------------
+ * RC8 LED0 Grounded, high value illuminates
+ * RC9 LED1 Grounded, high value illuminates
+ *
+ * The Dimitech DTX1-4000L EV-kit1 supports 3 more LEDs, but there are not
+ * controllable from software.
+ *
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as
+ * follows:
+ * ON OFF
+ * ------------------------- ---- ---- ---- ----
+ * LED0 LED1 LED0 LED1
+ * ------------------------- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF --- ---
+ * LED_HEAPALLOCATE 1 ON OFF --- ---
+ * LED_IRQSENABLED 2 OFF ON --- ---
+ * LED_STACKCREATED 3 ON ON --- ---
+ * LED_INIRQ 4 ON N/C OFF N/C
+ * LED_SIGNAL 4 ON N/C OFF N/C
+ * LED_ASSERTION 4 ON N/C OFF N/C
+ * LED_PANIC 4 ON N/C OFF N/C
+ */
+
+#define GPIO_LED_0 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTC|GPIO_PIN8)
+#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTC|GPIO_PIN9)
+
+/* LED Management Definitions ***********************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+# define LED_OFF 0
+# define LED_ON 1
+# define LED_NC 2
+#endif
+
+/* Debug ********************************************************************/
+
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_LEDS)
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_LEDS
+# undef CONFIG_DEBUG_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private types
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+struct led_setting_s
+{
+ uint8_t led0 : 2;
+ uint8_t led1 : 2;
+ uint8_t unused : 4;
+};
+#endif
+
+ /****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The
+ * following structures identified the LED settings for each NuttX LED state.
+ */
+
+#ifdef CONFIG_ARCH_LEDS
+static const struct led_setting_s g_ledonvalues[LED_NVALUES] =
+{
+ {LED_OFF, LED_OFF, 0},
+ {LED_ON, LED_OFF, 0},
+ {LED_OFF, LED_ON, 0},
+ {LED_ON, LED_ON, 0},
+ {LED_ON, LED_NC, 0},
+};
+
+static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
+{
+ {LED_NC, LED_NC, 0},
+ {LED_NC, LED_NC, 0},
+ {LED_NC, LED_NC, 0},
+ {LED_NC, LED_NC, 0},
+ {LED_OFF, LED_NC, 0},
+};
+
+/* If CONFIG_ARCH_LEDS is not defined, the the user can control the LEDs in
+ * any way. The following array simply maps the PIC32MX_MIRTOO_LEDn
+ * index values to the correct LED pin configuration.
+ */
+
+#else
+static const uint16_t g_ledpincfg[PIC32MX_MIRTOO_NLEDS] =
+{
+ GPIO_LED_0, GPIO_LED_1
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_setleds(FAR const struct led_setting_s *setting)
+{
+ /* LEDs are pulled up so writing a low value (false) illuminates them */
+
+ if (setting->led0 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_0, setting->led0 == LED_ON);
+ }
+
+ if (setting->led1 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_1, setting->led1 == LED_ON);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pic32mx_ledinit
+ ****************************************************************************/
+
+void pic32mx_ledinit(void)
+{
+ /* Configure output pins */
+
+ pic32mx_configgpio(GPIO_LED_0);
+ pic32mx_configgpio(GPIO_LED_1);
+}
+
+/****************************************************************************
+ * Name: pic32mx_setled
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setled(int led, bool ledon)
+{
+ /* LEDs are pulled up so writing a low value (false) illuminates them */
+
+ if ((unsigned)led < PIC32MX_MIRTOO_NLEDS)
+ {
+ pic32mx_gpiowrite(g_ledpincfg[led], ledon);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_setleds
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setleds(uint8_t ledset)
+{
+ /* Call pic32mx_setled() with ledon == true to illuminated the LED */
+
+ pic32mx_setled(PIC32MX_MIRTOO_LED0, (ledset & PIC32MX_MIRTOO_LED0_BIT) != 0);
+ pic32mx_setled(PIC32MX_MIRTOO_LED1, (ledset & PIC32MX_MIRTOO_LED1_BIT) != 0);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledon(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledonvalues[led]);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledoff(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledoffvalues[led]);
+ }
+}
+#endif
diff --git a/nuttx/configs/mirtoo/src/up_nsh.c b/nuttx/configs/mirtoo/src/up_nsh.c
new file mode 100644
index 000000000..33e0692e6
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/up_nsh.c
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * config/mirtoo/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/mount.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <errno.h>
+#include <debug.h>
+
+#ifdef CONFIG_PIC32MX_SPI2
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+# include <nuttx/fs/nxffs.h>
+#endif
+
+#include "pic32mx-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+/* Can't support the SST25 device if it SPI2 or SST25 support is not enabled */
+
+#define HAVE_SST25 1
+#if !defined(CONFIG_PIC32MX_SPI2) || !defined(CONFIG_MTD_SST25)
+# undef HAVE_SST25
+#endif
+
+/* Can't support SST25 features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef HAVE_SST25
+#endif
+
+/* Use minor device number 0 is not is provided */
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Can't support both FAT and NXFFS */
+
+#if defined(CONFIG_FS_FAT) && defined(CONFIG_FS_NXFFS)
+# warning "Can't support both FAT and NXFFS -- using FAT"
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef HAVE_SST25
+ FAR struct spi_dev_s *spi;
+ FAR struct mtd_dev_s *mtd;
+ int ret;
+
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(2);
+ if (!spi)
+ {
+ fdbg("ERROR: Failed to initialize SPI port 2\n");
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the SST 25 SPI FLASH driver */
+
+ mtd = sst25_initialize(spi);
+ if (!mtd)
+ {
+ fdbg("ERROR: Failed to bind SPI port 2 to the SST 25 FLASH driver\n");
+ return -ENODEV;
+ }
+
+#ifndef CONFIG_FS_NXFFS
+ /* And finally, use the FTL layer to wrap the MTD driver as a block driver */
+
+ ret = ftl_initialize(CONFIG_NSH_MMCSDMINOR, mtd);
+ if (ret < 0)
+ {
+ fdbg("ERROR: Initialize the FTL layer\n");
+ return ret;
+ }
+#else
+ /* Initialize to provide NXFFS on the MTD interface */
+
+ ret = nxffs_initialize(mtd);
+ if (ret < 0)
+ {
+ fdbg("ERROR: NXFFS initialization failed: %d\n", -ret);
+ return ret;
+ }
+
+ /* Mount the file system at /mnt/sst25 */
+
+ ret = mount(NULL, "/mnt/sst25", "nxffs", 0, NULL);
+ if (ret < 0)
+ {
+ fdbg("ERROR: Failed to mount the NXFFS volume: %d\n", errno);
+ return ret;
+ }
+#endif
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/mirtoo/src/up_spi2.c b/nuttx/configs/mirtoo/src/up_spi2.c
new file mode 100644
index 000000000..3b43497d7
--- /dev/null
+++ b/nuttx/configs/mirtoo/src/up_spi2.c
@@ -0,0 +1,198 @@
+/************************************************************************************
+ * configs/mirtoo/src/up_spi2.c
+ * arch/arm/src/board/up_spi2.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "pic32mx-internal.h"
+#include "pic32mx-pps.h"
+#include "mirtoo-internal.h"
+
+#ifdef CONFIG_PIC32MX_SPI2
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* The Mirtoo module as two on-board SPI devices:
+ *
+ * SST25VF032B - 32-Mbit SPI Serial FLASH
+ *
+ * PGA117 - Zero drift programmable gain amplifier with MUX. The PGA117 offers 10
+ * analog inputs, a four-pin SPI interface with daisy-chain capability, and hardware
+ * and software shutdown in a TSSOP-20 package. Only 8 of the analog inputs (PORT0-7)
+ * are used on the Mirtoo module.
+ *
+ * Chip selects:
+ *
+ * ------ -------- ------------------------- --------------------------------
+ * PIN SIGNAL BOARD CONNECTION NOTES
+ * ------ -------- ------------------------- --------------------------------
+ * RPA1 SI PGA117 and SST25VF032B SPI2 data OUT (SDO2)
+ * RPA2 SO PGA117 and SST25VF032B SPI2 data IN (SDI2)
+ * SCK2 SCK PGA117 and SST25VF032B SPI2 clock
+ *
+ * RB7 ~CSAI PGA117 PGA117 chip select (active low)
+ * RB13 ~CSM SST25VF032B SST25VF032B chip select (active low)
+ */
+
+#define GPIO_SI (GPIO_OUTPUT|GPIO_PORTA|GPIO_PIN1)
+#define GPIO_SO (GPIO_INPUT|GPIO_PORTA|GPIO_PIN1)
+#define GPIO_SCK (GPIO_OUTPUT|GPIO_PORTA|GPIO_PIN1)
+
+#define GPIO_PGA117_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN7)
+#define GPIO_SST25VF032B_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN13)
+
+/* The following enable debug output from this file (needs CONFIG_DEBUG too).
+ *
+ * CONFIG_DEBUG_SPI - Define to enable basic SPI debug
+ */
+
+#ifdef CONFIG_DEBUG_SPI
+# define spidbg lldbg
+# define spivdbg llvdbg
+#else
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_spi2initialize
+ *
+ * Description:
+ * Called to configure SPI2 chip select GPIO pins for the Mirtoo module.
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_spi2initialize(void)
+{
+ /* Make sure that TRIS pins are set correctly. Configure the SPI pins as digital
+ * inputs and outputs first.
+ */
+
+ pic32mx_configgpio(GPIO_SI);
+ pic32mx_configgpio(GPIO_SO);
+ pic32mx_configgpio(GPIO_SCK);
+
+ /* Configure SPI2 data in and data out to use RPA2 and 1, respectively */
+
+ putreg32(PPS_INSEL_RPA2, PIC32MX_PPS_SDI2R);
+ putreg32(PPS_OUTSEL_SDO2, PIC32MX_PPS_RPA1R);
+
+ /* Configure the SPI chip select GPIOs */
+
+ pic32mx_configgpio(GPIO_PGA117_CS);
+ pic32mx_configgpio(GPIO_SST25VF032B_CS);
+}
+
+/************************************************************************************
+ * Name: pic32mx_spi2select, pic32mx_spi2status, and pic32mx_spi2cmddata
+ *
+ * Description:
+ * These external functions must be provided by board-specific logic. They are
+ * implementations of the select, status, and cmddata methods of the SPI interface
+ * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods
+ * including up_spiinitialize()) are provided by common PIC32MX logic. To use
+ * this common SPI logic on your board:
+ *
+ * 1. Provide logic in pic32mx_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide pic32mx_spiNselect() and pic32mx_spiNstatus() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
+ * pic32mx_spiNcmddata() functions in your board-specific logic. These
+ * functions will perform cmd/data selection operations using GPIOs in the way
+ * your board is configured.
+ * 3. Add a call to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+struct spi_dev_s;
+enum spi_dev_e;
+
+void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ if (devid == SPIDEV_FLASH)
+ {
+ pic32mx_gpiowrite(GPIO_SST25VF032B_CS, !selected);
+ }
+ else if (devid == SPIDEV_MUX)
+ {
+ pic32mx_gpiowrite(GPIO_PGA117_CS, !selected);
+ }
+}
+
+uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return 0;
+}
+
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+ return 0;
+}
+#endif
+
+#endif /* CONFIG_PIC32MX_SPI2 */
diff --git a/nuttx/configs/mx1ads/Kconfig b/nuttx/configs/mx1ads/Kconfig
new file mode 100644
index 000000000..ba83e1cf7
--- /dev/null
+++ b/nuttx/configs/mx1ads/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_MX1ADS
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/mx1ads/README.txt b/nuttx/configs/mx1ads/README.txt
new file mode 100644
index 000000000..1ff9ebac3
--- /dev/null
+++ b/nuttx/configs/mx1ads/README.txt
@@ -0,0 +1,138 @@
+README
+^^^^^^
+
+Toolchain
+^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the ARM920T GCC toolchain (if
+ different from the default).
+
+ If you have no ARM toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+
+ 1. You must have already configured Nuttx in <some-dir>nuttx.
+
+ cd tools
+ ./configure.sh mx1ads/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/arm920t-defconfig-4.2.4 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h so that the PATH variable includes the path to the
+ newly built binaries.
+
+ARM/i.MX1-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ARM920T=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=imx
+
+ CONFIG_ARCH_CHIP_name - For use in C code. Could be line _IMX1,
+ _IMXL, _IMX21, _IMX27, _IMX31, etc. (not all of which are
+ supported).
+
+ CONFIG_ARCH_CHIP_IMX1
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=mx1ads (for the Freescale MX1ADS evaluation board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_MX1ADS (for the Spectrum Digital C5471 EVM)
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_VSTART - The startaddress of DRAM (virtual)
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ IMX specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ IMX USB Configuration
+
+ CONFIG_IMX_GIO_USBATTACH
+ GIO that detects USB attach/detach events
+ CONFIG_IMX_GIO_USBDPPULLUP
+ GIO
+ CONFIG_DMA320_USBDEV_DMA
+ Enable IMX-specific DMA support
+ CONFIG_IMX_GIO_USBATTACH=6
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each MX1ADS configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh imxads/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ostest
+^^^^^^
+
+This configuration directory, performs a simple OS test using
+examples/ostest.
diff --git a/nuttx/configs/mx1ads/include/README.txt b/nuttx/configs/mx1ads/include/README.txt
new file mode 100644
index 000000000..25c8e1c81
--- /dev/null
+++ b/nuttx/configs/mx1ads/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Freescale MX1ADS evaluation board.
diff --git a/nuttx/configs/mx1ads/include/board.h b/nuttx/configs/mx1ads/include/board.h
new file mode 100644
index 000000000..1180e67cc
--- /dev/null
+++ b/nuttx/configs/mx1ads/include/board.h
@@ -0,0 +1,166 @@
+/************************************************************************************
+ * configs/mx1ads/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clock settings -- All clock values are precalculated */
+
+#define IMX_SYS_CLK_FREQ 16780000 /* Crystal frequency */
+
+/* MPCTL0 -- Controls the MCU clock:
+ *
+ * MFI + MFN / (MFD+1)
+ * IMX_MCUPLL_CLK_FREQ = 2 * IMX_SYS_CLK_FREQ * --------------------
+ * PD + 1
+ */
+
+#if 0 /* 150 MHz */
+# define IMX_MPCTL0_MFN 16
+# define IMX_MPCTL0_MFI 9
+# define IMX_MPCTL0_MFD 99
+# define IMX_MPCTL0_PD 1
+#else /* 180 MHz */
+# define IMX_MPCTL0_MFN 441
+# define IMX_MPCTL0_MFI 4
+# define IMX_MPCTL0_MFD 938
+# define IMX_MPCTL0_PD 0
+#endif
+
+#define IMX_MPCTL0_VALUE \
+ ((IMX_MPCTL0_MFN << PLL_MPCTL0_MFN_SHIFT) |\
+ (IMX_MPCTL0_MFI << PLL_MPCTL0_MFI_SHIFT) |\
+ (IMX_MPCTL0_MFD << PLL_MPCTL0_MFD_SHIFT) |\
+ (IMX_MPCTL0_PD << PLL_MPCTL0_PD_SHIFT))
+
+/* This yields: */
+
+#if 0 /* 150 MHz */
+# define IMX_MCUPLL_CLK_FREQ 153704800
+#else /* 180 MHz */
+# define IMX_MCUPLL_CLK_FREQ 183561405
+#endif
+
+/* SPCTL0 -- Controls the system PLL:
+ *
+ * MFI + MFN / (MFD+1)
+ * IMX_SYSPLL_CLK_FREQ = 2 * IMX_SYS_CLK_FREQ * --------------------
+ * PD + 1
+ */
+
+#define IMX_SPCTL0_MFN 678
+#define IMX_SPCTL0_MFI 5
+#define IMX_SPCTL0_MFD 938
+#define IMX_SPCTL0_PD 1
+
+#define IMX_SPCTL0_VALUE \
+ ((IMX_SPCTL0_MFN << PLL_SPCTL0_MFN_SHIFT) |\
+ (IMX_SPCTL0_MFI << PLL_SPCTL0_MFI_SHIFT) |\
+ (IMX_SPCTL0_MFD << PLL_SPCTL0_MFD_SHIFT) |\
+ (IMX_SPCTL0_PD << PLL_SPCTL0_PD_SHIFT))
+
+/* This yields: */
+
+#define IMX_SYSPLL_CLK_FREQ 96015910
+
+/* PDCR -- Controls peripheral clocks */
+
+#define IMX_PCLKDIV1 0
+#define IMX_PCLKDIV2 0
+#define IMX_PCLKDIV3 0
+
+#define IMX_PCDR_VALUE \
+ ((IMX_PCLKDIV1 << PLL_PCDR_PCLKDIV1_SHIFT) |\
+ (IMX_PCLKDIV2 << PLL_PCDR_PCLKDIV2_SHIFT) |\
+ (IMX_PCLKDIV3 << PLL_PCDR_PCLKDIV3_SHIFT))
+
+/* PERCLK1: UART, Timers, PWM */
+
+#define IMX_PERCLK1_FREQ (IMX_SYSPLL_CLK_FREQ/(IMX_PCLKDIV1+1))
+
+/* PERCLK2: CSPI, LCD, SD */
+
+#define IMX_PERCLK2_FREQ (IMX_SYSPLL_CLK_FREQ/(IMX_PCLKDIV2+1))
+
+/* PERCLK3: SSI */
+
+#define IMX_PERCLK3_FREQ (IMX_SYSPLL_CLK_FREQ/(IMX_PCLKDIV3+1))
+
+/* CSCR settings -- Controls HCLK and BCLK and USB clock.
+ * HCLK: SDRAM, CSI, Memory Stick, I2C, DMA
+ */
+
+#define IMX_CSCR_BCLKDIV 1
+#define IMX_CSCR_USBDIV 6
+
+/* LED definitions ******************************************************************/
+
+/* The MX1ADS has only one usable LED: Port A, bit 2 */
+
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF OFF */
+#define LED_HEAPALLOCATE 1 /* OFF OFF */
+#define LED_IRQSENABLED 2 /* OFF OFF */
+#define LED_STACKCREATED 3 /* OFF OFF */
+#define LED_INIRQ 4 /* ON OFF */
+#define LED_SIGNAL 5 /* ON OFF */
+#define LED_ASSERTION 6 /* ON OFF */
+#define LED_PANIC 7 /* ON OFF */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/* All i.MX architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ */
+
+extern void imx_boardinitialize(void);
+
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/mx1ads/ostest/Make.defs b/nuttx/configs/mx1ads/ostest/Make.defs
new file mode 100644
index 000000000..ffcb4662c
--- /dev/null
+++ b/nuttx/configs/mx1ads/ostest/Make.defs
@@ -0,0 +1,134 @@
+############################################################################
+# configs/mx1ads/ostest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm920t -march=armv4t -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm920t -march=armv4t -msoft-float
+endif
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/mx1ads/ostest/appconfig b/nuttx/configs/mx1ads/ostest/appconfig
new file mode 100644
index 000000000..2f61aa07c
--- /dev/null
+++ b/nuttx/configs/mx1ads/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/mx1ads/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/mx1ads/ostest/defconfig b/nuttx/configs/mx1ads/ostest/defconfig
new file mode 100644
index 000000000..f20216aa8
--- /dev/null
+++ b/nuttx/configs/mx1ads/ostest/defconfig
@@ -0,0 +1,324 @@
+############################################################################
+# configs/mx1ads/ostest/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM920T=y
+CONFIG_ARCH_CHIP="imx"
+CONFIG_ARCH_CHIP_IMX1=y
+CONFIG_ARCH_BOARD="mx1ads"
+CONFIG_ARCH_BOARD_MX1ADS=y
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=16777216
+CONFIG_DRAM_START=0x08000000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_DRAM_NUTTXENTRY=0x01004000
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# IMX specific serial device driver settings
+#
+CONFIG_UART1_DISABLE=n
+CONFIG_UART2_DISABLE=y
+CONFIG_UART3_DISABLE=y
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# IMX specific SPI device driver settings
+#
+CONFIG_SPI1_DISABLE=n
+CONFIG_SPI2_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=29
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# IMX USB Configuration
+#
+CONFIG_IMX_GIO_USBATTACH=6
+CONFIG_IMX_GIO_USBDPPULLUP=17
+CONFIG_IMX_VENDORID=0xd320
+CONFIG_IMX_PRODUCTID=0x3211
+CONFIG_IMX_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=n
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/mx1ads/ostest/ld.script b/nuttx/configs/mx1ads/ostest/ld.script
new file mode 100644
index 000000000..e16f9de24
--- /dev/null
+++ b/nuttx/configs/mx1ads/ostest/ld.script
@@ -0,0 +1,84 @@
+/****************************************************************************
+ * configs/mx1ads/ostest/ld.script
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x09008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.); /* See below */
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/mx1ads/ostest/setenv.sh b/nuttx/configs/mx1ads/ostest/setenv.sh
new file mode 100755
index 000000000..e73858fc7
--- /dev/null
+++ b/nuttx/configs/mx1ads/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/mx1ads/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/mx1ads/src/Makefile b/nuttx/configs/mx1ads/src/Makefile
new file mode 100644
index 000000000..4a2c02ef1
--- /dev/null
+++ b/nuttx/configs/mx1ads/src/Makefile
@@ -0,0 +1,77 @@
+############################################################################
+# configs/mx1ads/src/Makefile
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_boot.c up_leds.c up_network.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/mx1ads/src/README.txt b/nuttx/configs/mx1ads/src/README.txt
new file mode 100644
index 000000000..d7b3f6f8f
--- /dev/null
+++ b/nuttx/configs/mx1ads/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Freescale MX1ADS evaluation board.
diff --git a/nuttx/configs/mx1ads/src/up_boot.c b/nuttx/configs/mx1ads/src/up_boot.c
new file mode 100644
index 000000000..67ac4ce17
--- /dev/null
+++ b/nuttx/configs/mx1ads/src/up_boot.c
@@ -0,0 +1,107 @@
+/************************************************************************************
+ * configs/mx1ads/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "imx_gpio.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: imx_boardinitialize
+ *
+ * Description:
+ * All i.MX architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ ************************************************************************************/
+
+void imx_boardinitialize(void)
+{
+ uint32_t regval;
+
+ putreg32(0x000003ab, IMX_SC_GPCR); /* I/O pad driving strength */
+ putreg32(IMX_MPCTL0_VALUE, IMX_PLL_MPCTL0);
+ putreg32(IMX_SPCTL0_VALUE, IMX_PLL_SPCTL0);
+
+ regval = (CSCR_CLKOSEL_FCLK | /* Output FCLK on CLK0 */
+ (IMX_CSCR_USBDIV << PLL_CSCR_USBDIV_SHIFT) | /* USB divider */
+ CSCR_SDCNT_4thEDGE | /* Shutdown on 4th edge */
+ (IMX_CSCR_BCLKDIV << PLL_CSCR_BCLKDIV_SHIFT) | /* Bclock divider */
+ PLL_CSCR_SPEN | PLL_CSCR_MPEN); /* Enable MUC and System PLL */
+ putreg32(regval, IMX_PLL_CSCR);
+
+ /* Use these new frequencies now */
+
+ putreg32(IMX_PLL_CSCR, regval | (PLL_CSCR_MPLLRESTART|PLL_CSCR_SPLLRESTART));
+
+ /* Setup peripheral clocking */
+
+ putreg32(IMX_PCDR_VALUE, IMX_PLL_PCDR);
+
+ /* Configure CS4 for cs8900 Ethernet */
+
+#ifdef CONFIG_NET
+ putreg32(0x00000f00, IMX_EIM_CS4H);
+ putreg32(0x00001501, IMX_EIM_CS4L);
+
+ imxgpio_configprimary(GPIOA, 21);
+ imxgpio_configprimary(GPIOA, 22);
+
+ regval = getreg32(IMX_CS4_VSECTION + 0x0c);
+ regval = getreg32(IMX_CS4_VSECTION + 0x0c);
+#endif
+}
diff --git a/nuttx/configs/mx1ads/src/up_leds.c b/nuttx/configs/mx1ads/src/up_leds.c
new file mode 100644
index 000000000..30ba2bdbe
--- /dev/null
+++ b/nuttx/configs/mx1ads/src/up_leds.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/mx1ads/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Configure Port A, Bit 2 as an output, initial value=1 */
+
+ imxgpio_configoutput(GPIOA, 2, 1);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ imxgpio_setoutput(GPIOA, 2); /* Port A, Bit 2 = 1 */
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ default:
+ imxgpio_clroutput(GPIOA, 2); /* Port A, Bit 2 = 0 */
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ imxgpio_clroutput(GPIOA, 2); /* Port A, Bit 2 = 0 */
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/mx1ads/src/up_network.c b/nuttx/configs/mx1ads/src/up_network.c
new file mode 100644
index 000000000..20fc766e3
--- /dev/null
+++ b/nuttx/configs/mx1ads/src/up_network.c
@@ -0,0 +1,77 @@
+/****************************************************************************
+ * configs/mx1ads/src/up_network.c
+ * arch/arm/src/board/up_network.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#if defined(CONFIG_NET) && defined(CONFIG_NET_CS8900)
+
+#include <debug.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+extern void cs8900_initialize(void);
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_netinitialize
+ ****************************************************************************/
+
+void up_netinitialize(void)
+{
+# error "Missing implementation"
+}
+
+#endif /* CONFIG_NET && CONFIG_NET_DM90x0 */
diff --git a/nuttx/configs/ne64badge/Kconfig b/nuttx/configs/ne64badge/Kconfig
new file mode 100644
index 000000000..44fb67fdf
--- /dev/null
+++ b/nuttx/configs/ne64badge/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_NE64BADGE
+endif
diff --git a/nuttx/configs/ne64badge/README.txt b/nuttx/configs/ne64badge/README.txt
new file mode 100644
index 000000000..48a19264e
--- /dev/null
+++ b/nuttx/configs/ne64badge/README.txt
@@ -0,0 +1,481 @@
+README
+^^^^^^
+
+ This README discusses issues unique to NuttX configurations for the
+ Future Electronics Group NE64 /PoE Badge board based on the
+ MC9S12NE64 hcs12 cpu.
+
+CONTENTS
+^^^^^^^^
+ • MC9S12NE64 Features
+ • NE64 Badge Pin Usage
+ • Development Environment
+ • NuttX Buildroot Toolchain
+ • FreeScale HCS12 Serial Monitor
+ • Soft Registers
+ • HCS12/NE64BADGE-specific Configuration Options
+ • Configurations
+
+MC9S12NE64 Features
+^^^^^^^^^^^^^^^^^^^
+
+ • 16-bit HCS12 core
+ - HCS12 CPU
+ - Upward compatible with M68HC11 instruction set
+ - Interrupt stacking and programmer’s model identical to M68HC11
+ - Instruction queue
+ - Enhanced indexed addressing
+ - Memory map and interface (MMC)
+ - Interrupt control (INT)
+ - Background debug mode (BDM)
+ - Enhanced debug12 module, including breakpoints and change-of-flow
+ trace buffer (DBG)
+ - Multiplexed expansion bus interface (MEBI) - available only in
+ 112-pin package version
+ • Wakeup interrupt inputs
+ - Up to 21 port bits available for wakeup interrupt function with
+ digital filtering
+ • Memory
+ - 64K bytes of FLASH EEPROM
+ - 8K bytes of RAM
+ • Analog-to-digital converter (ATD)
+ - One 8-channel module with 10-bit resolution
+ - External conversion trigger capability
+ • Timer module (TIM)
+ - 4-channel timer
+ - Each channel configurable as either input capture or output
+ compare
+ - Simple PWM mode
+ - Modulo reset of timer counter
+ - 16-bit pulse accumulator
+ - External event counting
+ - Gated time accumulation
+ • Serial interfaces
+ - Two asynchronous serial communications interface (SCI)
+ - One synchronous serial peripheral interface (SPI)
+ - One inter-IC bus (IIC)
+ • Ethernet Media access controller (EMAC)
+ - IEEE 802.3 compliant
+ - Medium-independent interface (MII)
+ - Full-duplex and half-duplex modes
+ - Flow control using pause frames
+ - MII management function
+ - Address recognition
+ - Frames with broadcast address are always accepted or always
+ rejected
+ - Exact match for single 48-bit individual (unicast) address
+ - Hash (64-bit hash) check of group (multicast) addresses
+ - Promiscuous mode
+ • Ethertype filter
+ • Loopback mode
+ • Two receive and one transmit Ethernet buffer interfaces
+ • Ethernet 10/100 Mbps transceiver (EPHY)
+ - IEEE 802.3 compliant
+ - Digital adaptive equalization
+ - Half-duplex and full-duplex
+ - Auto-negotiation next page ability
+ - Baseline wander (BLW) correction
+ - 125-MHz clock generator and timing recovery
+ - Integrated wave-shaping circuitry
+ - Loopback modes
+ • CRG (clock and reset generator module)
+ - Windowed COP watchdog
+ - Real-time interrupt
+ - Clock monitor
+ - Pierce oscillator
+ - Phase-locked loop clock frequency multiplier
+ - Limp home mode in absence of external clock
+ - 25-MHz crystal oscillator reference clock
+ • Operating frequency
+ - 50 MHz equivalent to 25 MHz bus speed for single chip
+ - 32 MHz equivalent to 16 MHz bus speed in expanded bus modes
+ • Internal 2.5-V regulator
+ - Supports an input voltage range from 3.3 V ± 5%
+ - Low-power mode capability
+ - Includes low-voltage reset (LVR) circuitry
+ • 80-pin TQFP-EP or 112-pin LQFP package
+ - Up to 70 I/O pins with 3.3 V input and drive capability (112-pin
+ package)
+ - Up to two dedicated 3.3 V input only lines (IRQ, XIRQ)
+ • Development support
+ - Single-wire background debug™ mode (BDM)
+ - On-chip hardware breakpoints
+ - Enhanced DBG debug features
+
+NE64 Badge Pin Usage
+^^^^^^^^^^^^^^^^^^^^
+
+PIN PIN NAME BOARD SIGNAL NOTES
+--- ------------------- -------------- ----------------------
+ 44 RESET J3 RESET_L Also to SW3
+ 57 BKGD/MODC/TAGHI_B BDM BKGD CON6A
+
+ 85 PAD0 VR1 Potentiometer
+ 86 PAD1 J3 ANALOG_IN0 Not used on board
+ 87 PAD2 J3 ANALOG_IN1 " " " " "" " "
+ 88 PAD3 J3 ANALOG_IN2 " " " " "" " "
+ 89 PAD4 J3 ANALOG_IN3 " " " " "" " "
+
+ 70 PHY_TXP J7 TD+ RJ45 connector
+ 71 PHY_TXN J7 TD- RJ45 connector
+ 73 PHY_RXP J7 RD+ RJ45 connector
+ 74 PHY_RXN J7 RD- RJ45 connector
+
+ Ports A,B,E,K managed by the MEBI block
+ ---------------------------------------
+ 60 PA0/ADDR8/DATA8 J3 ADDR_DATA8 Not used on board
+ 61 PA1/ADDR9/DATA9 J3 ADDR_DATA9 " " " " "" " "
+ 62 PA2/ADDR10/DATA10 J3 ADDR_DATA10 " " " " "" " "
+ 63 PA3/ADDR11/DATA11 J3 ADDR_DATA11 " " " " "" " "
+ 77 PA4/ADDR12/DATA12 J3 ADDR_DATA12 " " " " "" " "
+ 78 PA5/ADDR13/DATA13 J3 ADDR_DATA13 " " " " "" " "
+ 79 PA6/ADDR14/DATA14 J3 ADDR_DATA14 " " " " "" " "
+ 80 PA7/ADDR15/DATA15 J3 ADDR_DATA15 " " " " "" " "
+
+ 10 PB0/ADDR0/DATA0 J3 ADDR_DATA0 Not used on board
+ 11 PB1/ADDR1/DATA1 J3 ADDR_DATA1 " " " " "" " "
+ 12 PB2/ADDR2/DATA2 J3 ADDR_DATA2 " " " " "" " "
+ 13 PB3/ADDR3/DATA3 J3 ADDR_DATA3 " " " " "" " "
+ 16 PB4/ADDR4/DATA4 J3 ADDR_DATA4 " " " " "" " "
+ 17 PB5/ADDR5/DATA5 J3 ADDR_DATA5 " " " " "" " "
+ 18 PB6/ADDR6/DATA6 J3 ADDR_DATA6 " " " " "" " "
+ 19 PB7/ADDR7/DATA7 J3 ADDR_DATA7 " " " " "" " "
+
+ 56 PE0/XIRQ_B BUTTON1 SW1
+ 55 PE1/IRQ_B J3 IRQ Not used on board
+ 54 PE2/R_W J3 RW " " " " "" " "
+ 53 PE3/LSTRB_B/TAGLO_B J3 LSTRB " " " " "" " "
+ 41 PE4/ECLK J3 ECLK " " " " "" " "
+ 40 PE5/IPIPE0/MODA J3 MODA " " " " "" " "
+ 39 PE6/IPIPE1/MODB J3 MODB " " " " "" " "
+ 38 PE7/NOACC/XCLKS_B pulled low pulled low
+
+ 97 PK0/XADR14 N/C N/C
+ 98 PK1/XADR15 N/C N/C
+ 99 PK2/XADR16 N/C N/C
+100 PK3/XADR17 N/C N/C
+103 PK4/XADR18 N/C N/C
+104 PK5/XADR19 N/C N/C
+105 PK6/XCS_B J3 XCS Not used on board
+106 PK7/ECS_B/ROMCTL J3 ECS " " " " "" " "
+
+ Ports T,S,G,H,J,L managed by the PIM Block
+ ------------------------------------------
+110 PT4/IOC1_4 J3 GPIO8 Not used on board
+109 PT5/IOC1_5 J3 GPIO9 " " " " "" " "
+108 PT6/IOC1_6 J3 GPIO10 " " " " "" " "
+107 PT7/IOC1_7 N/C N/C
+
+ 30 PS0/RXD0 RS232_RX Eventually maps to J2 RXD
+ 31 PS1/TXD0 RS232_TX Eventually maps to J2 TXD
+ 32 PS2/RXD1 J3&J4 UART_RX Not used on board
+ 33 PS3/TXD1 J3&J4 UART_TX " " " " "" " "
+ 34 PS4/MISO J3 SPI_MISO " " " " "" " "
+ 35 PS5/MOSI J3 SPI_MOSI " " " " "" " "
+ 36 PS6/SCK J3 SPI_CLOCK " " " " "" " "
+ 37 PS7/SS_B J3 SPI_SS " " " " "" " "
+
+ 22 PG0/RXD0/KWG0 J3 GPIO0 Not used on board
+ 23 PG1/RXD1/KWG1 J3 GPIO1 " " " " "" " "
+ 24 PG2/RXD2/KWG2 J3 GPIO2 " " " " "" " "
+ 25 PG3/RXD3/KWG3 J3 GPIO3 " " " " "" " "
+ 26 PG4/RXCLK/KWG4 J3 GPIO4 " " " " "" " "
+ 27 PG5/RXDV/KWG5 J3 GPIO5 " " " " "" " "
+ 28 PG6/RXER/KWG6 J3 GPIO6 " " " " "" " "
+ 29 PG7/KWG7 J3 GPIO7 " " " " "" " "
+
+ 7 PH0/TXD0/KWH0 N/C N/C
+ 6 PH1/TXD1/KWH1 N/C N/C
+ 5 PH2/TXD2/KWH2 J4 XBEE_RESET Not used on board
+ 4 PH3/TXD3/KWH3 J4 XBEE_RSSI Not used on board
+ 3 PH4/TXCLK/KWH4 BUTTON2 SW2
+ 2 PH5/TXDV/KWH5 J5 XBEE_LOAD_H Not used on board
+ 1 PH6/TXER/KWH6 J4 XBEE_LOAD_L Not used on board
+
+ 8 PJ0/MDC/KWJ0 LED1 D21, red
+ 9 PJ1/MDIO/KWJ1 LED2 D22, red
+ 20 PJ2/CRS/KWJ2 J3 SPI_CS Not used on board
+ 21 PJ3/COL/KWJ3 N/C
+112 PJ6/SDA/KWJ6 J3 I2C_DATA Not used on board
+111 PJ7/SCL/KWJ7 J3 I2C_CLOCK " " " " "" " "
+
+ 51 PL6/TXER/KWL6 N/C N/C
+ 52 PL5/TXDV/KWL5 N/C N/C
+ 58 PL4/COLLED Collision LED red
+ 59 PL3/DUPLED Full Duplex LED yellow
+ 81 PL2/SPDLED 100Mbps Speed LED yellow
+ 83 PL1/LNKLED Link Good LED green
+ 84 PL0/ACTLED Activity LED yellow
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development
+ environment. The source has been built only using the GNU toolchain
+ (see below). Other toolchains will likely cause problems.
+
+NuttX Buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the HC12 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no HC12 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin
+ environments.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh ne64badge/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/m9s12x-defconfig-3.3.6 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ If the make fails because it can't find the file to download, you may
+ have to locate the file on the internet and download it into the archives/
+ directory manually. For example, binutils-2.18 can be found here:
+ http://ftp.gnu.org/gnu/binutils/
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+FreeScale HCS12 Serial Monitor
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ General:
+ The NuttX HCS12 port is configured to use the Freescale HCS serial
+ monitor. This monitor supports primitive debug commands that allow
+ FLASH/EEPROM programming and debugging through an RS-232 serial
+ interface. The serial monior is 2Kb in size and resides in FLASH at
+ addresses 0xf800-0xffff. The monitor does not use any RAM other than
+ the stack itself.
+
+ AN2458
+ The serial monitor is described in detail in Freescale Application
+ Note AN2458.pdf.
+
+ COP:
+ The serial monitor uses the COP for the cold reset function and should
+ not be used by the application without some precautions (see AN2458).
+
+ Clocking:
+ The serial monitor sets the operating frequency to 24 MHz. This is
+ not altered by the NuttX start-up; doing so would interfere with the
+ operation of the serial monitor.
+
+ Memory Configuration:
+ Registers:
+ • Register space is located at 0x0000–0x03ff.
+ FLASH:
+ • FLASH memory is any address greater than 0x4000. All paged
+ addresses are assumed to be FLASH memory.
+ • Application code should exclude the 0xf780–0xff7f memory.
+ SRAM:
+ • RAM ends at 0x3FFF and builds down to the limit of the device’s
+ available RAM.
+ • The serial monitor's stack pointer is set to the end of RAM+1
+ (0x4000).
+ EEPROM:
+ • EEPROM (if the target device has any) is limited to the available
+ space between the registers and the RAM (0x0400–to start of RAM).
+ External Devices:
+ • External devices attached to the multiplexed external bus
+ interface are not supported
+
+ Serial Communications:
+ The serial monitor uses RS-232 serial communications through SCI0 at
+ 115,200 baud. The monitor must have exclusive use of this interface.
+ Access to the serial port is available through a monitor jump table.
+
+ Interrrupts:
+ The serial monitor redirects interrupt vectors to an unprotected
+ portion of FLASH just before the protected monitor program
+ (0xf780–0xf7fe). The monitor will automatically redirect vector
+ programming operations to these user vectors. The user code should
+ therefore keep the normal (non-monitor) vector locations
+ (0xff80–0xfffe).
+
+Soft Registers
+^^^^^^^^^^^^^^
+
+ The mc68hcs12 compilation is prone to errors like the following:
+
+ CC: lib_b16sin.c
+ lib_b16sin.c: In function `b16sin':
+ lib_b16sin.c:110: error: unable to find a register to spill in class `S_REGS'
+ lib_b16sin.c:110: error: this is the insn:
+ (insn:HI 41 46 44 8 (parallel [
+ (set (subreg:SI (reg:DI 58 [ rad ]) 4)
+ (reg/v:SI 54 [ rad ]))
+ (clobber (scratch:HI))
+ ]) 20 {movsi_internal} (insn_list 46 (nil))
+ (expr_list:REG_UNUSED (scratch:HI)
+ (expr_list:REG_NO_CONFLICT (reg/v:SI 54 [ rad ])
+ (nil))))
+ lib_b16sin.c:110: confused by earlier errors, bailing out
+
+ There are several ways that this error could be fixed:
+
+ 1. Increase the number of soft registers (i.e., "fake" registers defined
+ at fixed memory locations). This can be done by adding something like
+ -msoft-reg-count=4 to the CFLAGS. This approach was not taken
+ because:
+
+ - This slows hcs12 performance
+ - All of these soft registers wouil have to be saved and restored
+ on every interrupt and context switch.
+
+ 2. Lowering the optimization level by dropping -Os to -O2 or, more likely,
+ by removing -fomit-frame-pointer. Also not desireable becauase 99% of the
+ files that do not have this problem also increase in size. Special case
+ compilation with reduced optimization levels just for the files that need
+ it could be done, but this would complicate the make system.
+
+ 3. Restructuring files to reduce the complexity. If you add local variables
+ to hold intermediate computational results, this error can be eliminated.
+ This is the approach taken in NuttX. It has disadvantages only in that
+ (1) it takes some effort and good guessing to eliminate the problem, and (2)
+ the problem is not really eliminated -- it can and will re-occur when files
+ are changed or new files are added.
+
+ 4. Many files are built that are needed by DEM09S12NE64. Another very simple
+ option if those problem files are needed is to just remove the offending
+ files from the Make.defs file so that they no longer cause a problem.
+
+HCS12/NE64BADGE-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=hc
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_HC=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_HCS12=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=mc92s12nec64
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_MCS92S12NEC64
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=ne64badge
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_NE64BADGE (for the Future Electronics Group NE64 Badge)
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed RAM.
+
+ CONFIG_DRAM_START - The start address of installed RAM
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ GPIO Interrupts
+
+ CONFIG_GPIO_IRQ - Enable general support for GPIO IRQs
+ CONFIG_HCS12_PORTG_INTS - Enable PortG IRQs
+ CONFIG_HCS12_PORTH_INTS - Enable PortH IRQs
+ CONFIG_HCS12_PORTJ_INTS - Enable PortJ IRQs
+
+ HCS12 build options:
+
+ CONFIG_HCS12_SERIALMON - Indicates that the target systems uses
+ the Freescale serial bootloader.
+
+ CONFIG_HCS12_NONBANKED - Indicates that the target systems does not
+ support banking. Only short calls are made; one fixed page is
+ presented the the paging window. Only 48Kb of FLASH is usable
+ in this configuration: pages 3e, 3d, then 3f will appear as a
+ contiguous address space in memory.
+
+ HCS12 Sub-system support
+
+ CONFIG_HCS12_SCI0
+ CONFIG_HCS12_SCI1
+
+ HCS12 specific device driver settings:
+
+ CONFIG_SCIn_SERIAL_CONSOLE - selects SCIn for the console and ttys0
+ (default is the SCI0).
+
+ CONFIG_SCIn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+
+ CONFIG_SCIn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+
+ CONFIG_SCIn_BAUD - The configure BAUD of the UART.
+
+ CONFIG_SCIn_BITS - The number of bits. Must be either 7 or 8.
+
+ CONFIG_SCIn_PARTIY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0
+
+ CONFIG_SCIn_2STOP - Two stop bits
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Freescale HCS12 configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh ne64badge/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
diff --git a/nuttx/configs/ne64badge/include/board.h b/nuttx/configs/ne64badge/include/board.h
new file mode 100644
index 000000000..ba4ce3631
--- /dev/null
+++ b/nuttx/configs/ne64badge/include/board.h
@@ -0,0 +1,151 @@
+/************************************************************************************
+ * configs/ne64badge/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Frequency of the crystal oscillator */
+
+#define HCS12_OSCCLK 16000000 /* 16MHz */
+
+/* PLL Settings
+ *
+ * SYNR register controls the multiplication factor of the PLL. If the PLL is on, the
+ * count in the loop divider (SYNR) register effectively multiplies up the PLL clock
+ * (PLLCLK) from the reference frequency by 2 x (SYNR+1). PLLCLK will not be below
+ * the minimum VCO frequency (fSCM).
+ *
+ * The REFDV register provides a finer granularity for the PLL multiplier steps. The
+ * count in the reference divider divides OSCCLK frequency by REFDV + 1.
+ *
+ * PLLCLK = 2 * OSCCLK * (SYNR + 1) / (REFDV + 1)
+ *
+ * If (PLLSEL = 1), Bus Clock = PLLCLK / 2
+ */
+
+#define HCS12_SYNR_VALUE 0x15
+#define HCS12_REFDV_VALUE 0x15
+#define HCS12_PLLCLK (2*HCS12_OSCCLK*(HCS12_SYNR+1)/(HCS12_REFDV+1))
+#define HCS12_BUSCLK (HSC12_PLLCLK/2)
+
+/* LED definitions ******************************************************************/
+
+/* The NE64 Badge board has 2 red LEDs that we will encode as: */
+
+ /* LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF = Still initializing */
+#define LED_HEAPALLOCATE 0 /* OFF OFF = Still initializing */
+#define LED_IRQSENABLED 0 /* OFF OFF = Still initializing */
+#define LED_STACKCREATED 1 /* ON OFF = Initialization complete */
+#define LED_INIRQ 2 /* NC ON = In an interrupt handler */
+#define LED_SIGNAL 2 /* NC ON = In a signal handler */
+#define LED_ASSERTION 2 /* NC ON = In an assertion */
+#define LED_PANIC 2 /* NC ON = Oops! We crashed. (flashing) */
+
+/* Button definitions ***************************************************************/
+
+/* The NE64 badge has 2 switches, one labed SW1 and the other SW2 on the board (but
+ * referred to as button1 and button2 in some documentation)
+ */
+
+#define BUTTON1 1 /* Bit 0: SW1 button is depressed */
+#define BUTTON2 2 /* Bit 1: SW2 button is depressed */
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: hcs12_boardinitialize
+ *
+ * Description:
+ * All HCS12 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void hcs12_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the state of all buttons. up_buttons()
+ * returns an bit set with bits corresponding to the state of each button.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ne64badge/ostest/Make.defs b/nuttx/configs/ne64badge/ostest/Make.defs
new file mode 100644
index 000000000..fcd01d112
--- /dev/null
+++ b/nuttx/configs/ne64badge/ostest/Make.defs
@@ -0,0 +1,153 @@
+############################################################################
+# configs/ne64badge/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+# NuttX buildroot under Linux or Cygwin
+
+CROSSDEV = m9s12x-elf-
+MAXOPTIMIZATION = -Os
+WINTOOL = n
+
+ifeq ($(CONFIG_HCS12_NONBANKED),y)
+ ARCHCPUFLAGS = -m9s12x -mshort -mnolong-calls
+ LDSCRIPT = ld.script.nonbanked
+else
+ ARCHCPUFLAGS = -m9s12x -mshort -mlong-calls
+ LDSCRIPT = ld.script.banked
+endif
+
+ifneq ($(CONFIG_HCS12_MSOFTREGS),0)
+ ARCHCPUFLAGS += -msoft-reg-count=$(CONFIG_HCS12_MSOFTREGS)
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ LDFLAGS += -nostartfiles -nodefaultlibs
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ne64badge/ostest/appconfig b/nuttx/configs/ne64badge/ostest/appconfig
new file mode 100644
index 000000000..013a78d05
--- /dev/null
+++ b/nuttx/configs/ne64badge/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ne64badge/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ne64badge/ostest/defconfig b/nuttx/configs/ne64badge/ostest/defconfig
new file mode 100755
index 000000000..4f480675d
--- /dev/null
+++ b/nuttx/configs/ne64badge/ostest/defconfig
@@ -0,0 +1,402 @@
+############################################################################
+# configs/ne64badge/ostest/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="hc"
+CONFIG_ARCH_HC=y
+CONFIG_ARCH_HCS12=y
+CONFIG_ARCH_CHIP="m9s12"
+CONFIG_ARCH_CHIP_MCS92S12NEC64=y
+CONFIG_ARCH_BOARD="ne64badge"
+CONFIG_ARCH_BOARD_NE64BADGE=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_HCS12_PORTG_INTS=n
+CONFIG_HCS12_PORTH_INTS=n
+CONFIG_HCS12_PORTJ_INTS=n
+
+#
+# HCS12 build options:
+#
+
+CONFIG_HCS12_SERIALMON=n
+CONFIG_HCS12_NONBANKED=y
+
+#
+# CS12 Sub-system support
+#
+CONFIG_HCS12_SCI0=y
+CONFIG_HCS12_SCI1=n
+
+#
+# MC9S12NEC64 specific serial device driver settings
+#
+CONFIG_SCI0_SERIAL_CONSOLE=y
+CONFIG_SCI0_TXBUFSIZE=32
+CONFIG_SCI0_RXBUFSIZE=32
+CONFIG_SCI0_BAUD=38400
+CONFIG_SCI0_BITS=8
+CONFIG_SCI0_PARITY=0
+CONFIG_SCI0_2STOP=0
+
+CONFIG_SCI1_SERIAL_CONSOLE=n
+CONFIG_SCI1_TXBUFSIZE=32
+CONFIG_SCI1_RXBUFSIZE=32
+CONFIG_SCI1_BAUD=38400
+CONFIG_SCI1_BITS=8
+CONFIG_SCI1_PARITY=0
+CONFIG_SCI1_2STOP=0
+
+#
+# MC9S12NEC64 specific SSI device driver settings
+#
+CONFIG_SPI0_DISABLE=n
+CONFIG_SPI1_DISABLE=y
+CONFIG_SPI_POLLWAIT=y
+#CONFIG_SPI_TXLIMIT=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=y
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Setup for a two-pass build
+#
+CONFIG_BUILD_2PASS=n
+CONFIG_PASS1_BUILDIR=configs/ne64badge/initrel
+CONFIG_PASS1_TARGET=init.r
+CONFIG_PASS1_OBJECT=
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=11
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=256
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=512
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=256
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ne64badge/ostest/ld.script.banked b/nuttx/configs/ne64badge/ostest/ld.script.banked
new file mode 100755
index 000000000..5f466e649
--- /dev/null
+++ b/nuttx/configs/ne64badge/ostest/ld.script.banked
@@ -0,0 +1,151 @@
+/****************************************************************************
+ * configs/ne64badge/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The NE64 Badge has 64Kb of FLASH and 8Kb of SRAM that are assumed to be
+ * paged and positioned as below:
+ */
+
+MEMORY
+{
+ /* The register space resides at address 0x0000-0x03ff. The following
+ * address, 0x0400-0x1fff are unused.
+ *
+ * The 8Kb SRAM is mapped to 0x2000-0x2fff.
+ */
+
+ sram (rwx) : ORIGIN = 0x2000, LENGTH = 8K
+
+ /* Two fixed text flash pages (corresponding to page 3e and 3f). The
+ * top 256 bytes of page 3f is reserved to hold the interrupt vectors
+ */
+
+ lowtext(rx) : ORIGIN = 0x4000, LENGTH = 16K /* Page 3e */
+ hitext (rx) : ORIGIN = 0xc000, LENGTH = 16K-256 /* Page 3f */
+
+ /* Flash memory pages:
+ *
+ * The MC9S12NE64 implements 6 bits of the PPAGE register which gives it a
+ * 1 Mbyte program memory address space that is accessed through the PPAGE
+ * window. The lower 768K portion (0x000000-0x0bffff) of the address space
+ * is accessed with PPAGE values 0x00 through 0x2f. This address range
+ * is reserved for external memory when the part is operated in expanded
+ * mode. The upper 256K of the address space (0x0c0000-0x100000), accessed
+ * with PPAGE values 0x30 through 0x3f, is occupied by on chip flash.
+ */
+
+ page30 (rx) : ORIGIN = 0x0c0000, LENGTH = 16K /* Page 30 */
+ page31 (rx) : ORIGIN = 0x0c4000, LENGTH = 16K /* Page 31 */
+ page32 (rx) : ORIGIN = 0x0c8000, LENGTH = 16K /* Page 32 */
+ page33 (rx) : ORIGIN = 0x0cc000, LENGTH = 16K /* Page 33 */
+ page34 (rx) : ORIGIN = 0x0d0000, LENGTH = 16K /* Page 34 */
+ page35 (rx) : ORIGIN = 0x0d4000, LENGTH = 16K /* Page 35 */
+ page36 (rx) : ORIGIN = 0x0d8000, LENGTH = 16K /* Page 36 */
+ page37 (rx) : ORIGIN = 0x0dc000, LENGTH = 16K /* Page 37 */
+ page38 (rx) : ORIGIN = 0x0e0000, LENGTH = 16K /* Page 38 */
+ page39 (rx) : ORIGIN = 0x0e4000, LENGTH = 16K /* Page 39 */
+ page3a (rx) : ORIGIN = 0x0e8000, LENGTH = 16K /* Page 3a */
+ page3b (rx) : ORIGIN = 0x0ec000, LENGTH = 16K /* Page 3b */
+ page3c (rx) : ORIGIN = 0x0f0000, LENGTH = 16K /* Page 3c */
+ page3d (rx) : ORIGIN = 0x0f4000, LENGTH = 16K /* Page 3d */
+
+ page3e (rx) : ORIGIN = 0x0f8000, LENGTH = 16K /* Page 3e */
+ page3f (rx) : ORIGIN = 0x0fc000, LENGTH = 16K-2K /* Page 3f */
+
+ /* Vectors */
+
+ vectors (rx) : ORIGIN = 0xff80, LENGTH = 256
+}
+
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(nonbanked)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > hitext
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > lowtext
+
+ .vectors : {
+ *(vectors)
+ } > vectors
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectors
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ne64badge/ostest/ld.script.nonbanked b/nuttx/configs/ne64badge/ostest/ld.script.nonbanked
new file mode 100755
index 000000000..dfa8b15b2
--- /dev/null
+++ b/nuttx/configs/ne64badge/ostest/ld.script.nonbanked
@@ -0,0 +1,124 @@
+/****************************************************************************
+ * configs/ne64badge/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The NE64 Badge has 64Kb of FLASH and 8Kb of SRAM that are assumed to be
+ * paged and positioned as below:
+ */
+
+MEMORY
+{
+ /* The register space resides at address 0x0000-0x03ff. The following
+ * address, 0x0400-0x1fff are unused.
+ *
+ * The 8Kb SRAM is mapped to 0x2000-0x2fff.
+ */
+
+ sram (rwx) : ORIGIN = 0x2000, LENGTH = 8K
+
+ /* Three fixed text flash pages (corresponding to page 3e, 3d, and 3f) at
+ * 16Kb each (minus 256 bytes at the end of page 3f that is reserved for
+ * interrupt vectors). Notice that this is linked as a single contiguous;
+ * Post-processing is planned to make the binary to the appropriate flash
+ * pages.
+ */
+
+ text (rx) : ORIGIN = 0x4000, LENGTH = 48K-256 /* Page 3e, 3d, and 3f */
+
+ /* Vectors */
+
+ vectors (rx) : ORIGIN = 0xff80, LENGTH = 256
+}
+
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(nonbanked)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > text
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > text
+
+ .vectors : {
+ *(vectors)
+ } > vectors
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectors
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ne64badge/ostest/setenv.sh b/nuttx/configs/ne64badge/ostest/setenv.sh
new file mode 100755
index 000000000..c5aa591b4
--- /dev/null
+++ b/nuttx/configs/ne64badge/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ne64badge/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_m9s12x/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ne64badge/src/Makefile b/nuttx/configs/ne64badge/src/Makefile
new file mode 100644
index 000000000..657fedddc
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/Makefile
@@ -0,0 +1,86 @@
+############################################################################
+# configs/ne64badge/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_leds.c up_buttons.c up_spi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ne64badge/src/ne64badge_internal.h b/nuttx/configs/ne64badge/src/ne64badge_internal.h
new file mode 100644
index 000000000..d10618c9a
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/ne64badge_internal.h
@@ -0,0 +1,205 @@
+/************************************************************************************
+ * configs/ne64badge/src/ne64badge_internal.h
+ * arch/arm/src/board/ne64badge_internal.n
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_NE64BADGE_SRC_NE64BADGE_INTERNAL_H
+#define __CONFIGS_NE64BADGE_SRC_NE64BADGE_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "m9s12_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* NE64BADGE Pin Usage **************************************************************/
+/* PIN PIN NAME BOARD SIGNAL NOTES
+ * --- ------------------- -------------- ----------------------
+ * 44 RESET J3 RESET_L Also to SW3
+ * 57 BKGD/MODC/TAGHI_B BDM BKGD CON6A
+ *
+ * 85 PAD0 VR1 Potentiometer
+ * 86 PAD1 J3 ANALOG_IN0 Not used on board
+ * 87 PAD2 J3 ANALOG_IN1 " " " " "" " "
+ * 88 PAD3 J3 ANALOG_IN2 " " " " "" " "
+ * 89 PAD4 J3 ANALOG_IN3 " " " " "" " "
+ *
+ * 70 PHY_TXP J7 TD+ RJ45 connector
+ * 71 PHY_TXN J7 TD- RJ45 connector
+ * 73 PHY_RXP J7 RD+ RJ45 connector
+ * 74 PHY_RXN J7 RD- RJ45 connector
+ *
+ * Ports A,B,E,K managed by the MEBI block
+ * ---------------------------------------
+ * 60 PA0/ADDR8/DATA8 J3 ADDR_DATA8 Not used on board
+ * 61 PA1/ADDR9/DATA9 J3 ADDR_DATA9 " " " " "" " "
+ * 62 PA2/ADDR10/DATA10 J3 ADDR_DATA10 " " " " "" " "
+ * 63 PA3/ADDR11/DATA11 J3 ADDR_DATA11 " " " " "" " "
+ * 77 PA4/ADDR12/DATA12 J3 ADDR_DATA12 " " " " "" " "
+ * 78 PA5/ADDR13/DATA13 J3 ADDR_DATA13 " " " " "" " "
+ * 79 PA6/ADDR14/DATA14 J3 ADDR_DATA14 " " " " "" " "
+ * 80 PA7/ADDR15/DATA15 J3 ADDR_DATA15 " " " " "" " "
+ *
+ * 10 PB0/ADDR0/DATA0 J3 ADDR_DATA0 Not used on board
+ * 11 PB1/ADDR1/DATA1 J3 ADDR_DATA1 " " " " "" " "
+ * 12 PB2/ADDR2/DATA2 J3 ADDR_DATA2 " " " " "" " "
+ * 13 PB3/ADDR3/DATA3 J3 ADDR_DATA3 " " " " "" " "
+ * 16 PB4/ADDR4/DATA4 J3 ADDR_DATA4 " " " " "" " "
+ * 17 PB5/ADDR5/DATA5 J3 ADDR_DATA5 " " " " "" " "
+ * 18 PB6/ADDR6/DATA6 J3 ADDR_DATA6 " " " " "" " "
+ * 19 PB7/ADDR7/DATA7 J3 ADDR_DATA7 " " " " "" " "
+ *
+ * 56 PE0/XIRQ_B BUTTON1 SW1
+ * 55 PE1/IRQ_B J3 IRQ Not used on board
+ * 54 PE2/R_W J3 RW " " " " "" " "
+ * 53 PE3/LSTRB_B/TAGLO_B J3 LSTRB " " " " "" " "
+ * 41 PE4/ECLK J3 ECLK " " " " "" " "
+ * 40 PE5/IPIPE0/MODA J3 MODA " " " " "" " "
+ * 39 PE6/IPIPE1/MODB J3 MODB " " " " "" " "
+ * 38 PE7/NOACC/XCLKS_B pulled low pulled low
+ */
+
+#define NE64BADGE_BUTTON1 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT_E | GPIO_PIN_0)
+
+/* 97 PK0/XADR14 N/C N/C
+ * 98 PK1/XADR15 N/C N/C
+ * 99 PK2/XADR16 N/C N/C
+ * 100 PK3/XADR17 N/C N/C
+ * 103 PK4/XADR18 N/C N/C
+ * 104 PK5/XADR19 N/C N/C
+ * 105 PK6/XCS_B J3 XCS Not used on board
+ * 106 PK7/ECS_B/ROMCTL J3 ECS " " " " "" " "
+ *
+ * Ports T,S,G,H,J,L managed by the PIM Block
+ * ------------------------------------------
+ * 110 PT4/IOC1_4 J3 GPIO8 Not used on board
+ * 109 PT5/IOC1_5 J3 GPIO9 " " " " "" " "
+ * 108 PT6/IOC1_6 J3 GPIO10 " " " " "" " "
+ * 107 PT7/IOC1_7 N/C N/C
+ *
+ * 30 PS0/RXD0 RS232_RX Eventually maps to J2 RXD
+ * 31 PS1/TXD0 RS232_TX Eventually maps to J2 TXD
+ * 32 PS2/RXD1 J3&J4 UART_RX Not used on board
+ * 33 PS3/TXD1 J3&J4 UART_TX " " " " "" " "
+ * 34 PS4/MISO J3 SPI_MISO " " " " "" " "
+ * 35 PS5/MOSI J3 SPI_MOSI " " " " "" " "
+ * 36 PS6/SCK J3 SPI_CLOCK " " " " "" " "
+ * 37 PS7/SS_B J3 SPI_SS " " " " "" " "
+ *
+ * 22 PG0/RXD0/KWG0 J3 GPIO0 Not used on board
+ * 23 PG1/RXD1/KWG1 J3 GPIO1 " " " " "" " "
+ * 24 PG2/RXD2/KWG2 J3 GPIO2 " " " " "" " "
+ * 25 PG3/RXD3/KWG3 J3 GPIO3 " " " " "" " "
+ * 26 PG4/RXCLK/KWG4 J3 GPIO4 " " " " "" " "
+ * 27 PG5/RXDV/KWG5 J3 GPIO5 " " " " "" " "
+ * 28 PG6/RXER/KWG6 J3 GPIO6 " " " " "" " "
+ * 29 PG7/KWG7 J3 GPIO7 " " " " "" " "
+ *
+ * 7 PH0/TXD0/KWH0 N/C N/C
+ * 6 PH1/TXD1/KWH1 N/C N/C
+ * 5 PH2/TXD2/KWH2 J4 XBEE_RESET Not used on board
+ * 4 PH3/TXD3/KWH3 J4 XBEE_RSSI Not used on board
+ * 3 PH4/TXCLK/KWH4 BUTTON2 SW2
+ * 2 PH5/TXDV/KWH5 J5 XBEE_LOAD_H Not used on board
+ * 1 PH6/TXER/KWH6 J4 XBEE_LOAD_L Not used on board
+ */
+
+#define NE64BADGE_BUTTON2 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT_H | GPIO_PIN_4)
+
+/* 8 PJ0/MDC/KWJ0 LED1 D21, red
+ * 9 PJ1/MDIO/KWJ1 LED2 D22, red
+ * 20 PJ2/CRS/KWJ2 J3 SPI_CS Not used on board
+ * 21 PJ3/COL/KWJ3 N/C
+ * 112 PJ6/SDA/KWJ6 J3 I2C_DATA Not used on board
+ * 111 PJ7/SCL/KWJ7 J3 I2C_CLOCK " " " " "" " "
+ */
+
+#define NE64BADGE_LED1 (GPIO_OUTPUT | GPIO_OUTPUT_HIGH | GPIO_PORT_J | GPIO_PIN_0)
+#define NE64BADGE_LED2 (GPIO_OUTPUT | GPIO_OUTPUT_HIGH | GPIO_PORT_J | GPIO_PIN_1)
+
+/* 51 PL6/TXER/KWL6 N/C N/C
+ * 52 PL5/TXDV/KWL5 N/C N/C
+ * 58 PL4/COLLED Collision LED red
+ * 59 PL3/DUPLED Full Duplex LED yellow
+ * 81 PL2/SPDLED 100Mbps Speed LED yellow
+ * 83 PL1/LNKLED Link Good LED green
+ * 84 PL0/ACTLED Activity LED yellow
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+/************************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Configure and initialize on-board LEDs
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void up_ledinit(void);
+#endif
+
+/************************************************************************************
+ * Name: hcs12_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board.
+ *
+ ************************************************************************************/
+
+extern void weak_function hcs12_spiinitialize(void);
+
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_NE64BADGE_SRC_NE64BADGE_INTERNAL_H */
+
diff --git a/nuttx/configs/ne64badge/src/up_boot.c b/nuttx/configs/ne64badge/src/up_boot.c
new file mode 100644
index 000000000..a1d0071d9
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/up_boot.c
@@ -0,0 +1,89 @@
+/************************************************************************************
+ * configs/ne64badge/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "ne64badge_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: hcs12_boardinitialize
+ *
+ * Description:
+ * All HCS12 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void hcs12_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * hcs12_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_INCLUDE_HCS12_ARCH_SPI)
+ if (hcs12_spiinitialize)
+ {
+ hcs12_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/ne64badge/src/up_buttons.c b/nuttx/configs/ne64badge/src/up_buttons.c
new file mode 100644
index 000000000..70c57f2cc
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/up_buttons.c
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * configs/ne64badge/src/up_buttons.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "ne64badge_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef BUTTON_DEBUG /* Define to enable debug */
+#undef BUTTON_VERBOSE /* Define to enable verbose debug */
+
+#ifdef BUTTON_DEBUG
+# define btndbg lldbg
+# ifdef BUTTON_VERBOSE
+# define btnvdbg lldbg
+# else
+# define btnvdbg(x...)
+# endif
+#else
+# undef BUTTON_VERBOSE
+# define btndbg(x...)
+# define btnvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef BUTTON_VERBOSE
+# define btn_dumpgpio(m) m9s12_dumpgpio(m)
+#else
+# define btn_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ /* Configure all button GPIO lines */
+
+ btn_dumpgpio("up_buttoninit() Entry)");
+
+ hcs12_configgpio(NE64BADGE_BUTTON1);
+ hcs12_configgpio(NE64BADGE_BUTTON2);
+
+ btn_dumpgpio("up_buttoninit() Exit");
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+
+ if (hcs12_gpioread(NE64BADGE_BUTTON1))
+ {
+ ret |= BUTTON1;
+ }
+
+ if (hcs12_gpioread(NE64BADGE_BUTTON2))
+ {
+ ret |= BUTTON2;
+ }
+
+ return ret;
+}
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/ne64badge/src/up_leds.c b/nuttx/configs/ne64badge/src/up_leds.c
new file mode 100644
index 000000000..73991f570
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/up_leds.c
@@ -0,0 +1,158 @@
+/****************************************************************************
+ * configs/ne64badge/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "ne64badge_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_VERBOSE
+# define led_dumpgpio(m) m9s12_dumpgpio(m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Configure and initialize on-board LEDs
+ *
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure all LED GPIO lines */
+
+ led_dumpgpio("up_ledinit() Entry)");
+
+ hcs12_configgpio(NE64BADGE_LED1);
+ hcs12_configgpio(NE64BADGE_LED2);
+
+ led_dumpgpio("up_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ default:
+ case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
+ hcs12_gpiowrite(NE64BADGE_LED1, true);
+ hcs12_gpiowrite(NE64BADGE_LED2, true);
+ break;
+
+ case 1 : /* STACKCREATED */
+ hcs12_gpiowrite(NE64BADGE_LED1, false);
+ hcs12_gpiowrite(NE64BADGE_LED2, true);
+ break;
+
+ case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
+ hcs12_gpiowrite(NE64BADGE_LED2, false);
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ default:
+ case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
+ case 1 : /* STACKCREATED */
+ hcs12_gpiowrite(NE64BADGE_LED1, true);
+ case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
+ hcs12_gpiowrite(NE64BADGE_LED2, true);
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ne64badge/src/up_nsh.c b/nuttx/configs/ne64badge/src/up_nsh.c
new file mode 100644
index 000000000..17a52819b
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/up_nsh.c
@@ -0,0 +1,86 @@
+/****************************************************************************
+ * config/ne64badge/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "ne64badge_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ /* Configure SPI-based devices */
+
+ return OK;
+}
diff --git a/nuttx/configs/ne64badge/src/up_spi.c b/nuttx/configs/ne64badge/src/up_spi.c
new file mode 100644
index 000000000..8d52b7570
--- /dev/null
+++ b/nuttx/configs/ne64badge/src/up_spi.c
@@ -0,0 +1,130 @@
+/************************************************************************************
+ * configs/ne64badge/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "ne64badge_internal.h"
+
+#if defined(CONFIG_HCS12_SPI)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: hcs12_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the NE64 Badge board.
+ *
+ ************************************************************************************/
+
+void weak_function hcs12_spiinitialize(void)
+{
+}
+
+/****************************************************************************
+ * Name: hcs12_spiselect and hcs12_spistatus
+ *
+ * Description:
+ * The external functions, hcs12_spiselect and hcs12_spistatus must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common HCS12 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in hcs12_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide hcs12_spiselect() and hcs12_spistatus() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+void hcs12_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+}
+
+uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif /* CONFIG_HCS12_SPI */
diff --git a/nuttx/configs/ntosd-dm320/Kconfig b/nuttx/configs/ntosd-dm320/Kconfig
new file mode 100644
index 000000000..67681a845
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_NTOSD_DM320
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/ntosd-dm320/README.txt b/nuttx/configs/ntosd-dm320/README.txt
new file mode 100644
index 000000000..1b19e7782
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/README.txt
@@ -0,0 +1,371 @@
+README
+^^^^^^
+
+This is the README file for the port of NuttX to the Neuros OSD.
+
+CONTENTS
+^^^^^^^^
+ - Dev vs. Production Neuros OSD v1.0 boards
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - ARM/DM320-specific Configuration Options
+ - Configurations
+ - Configuration Options
+
+Dev vs. Production Neuros OSD v1.0 boards
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ This port supports both the original Neuros OSD v1.0 Dev Board.
+ This port has recently been extended to V1.0 Production board (and
+ that is now the default configuration). References:
+
+ http://www.neurostechnology.com/neuros-developer-community
+ http://wiki.neurostechnology.com/index.php/OSD_1.0_Developer_Home
+ http://wiki.neurostechnology.com/index.php/DM320_Platform_development
+
+ There are some differences between the Dev Board and the currently
+ available commercial v1.0 Boards, most notably in the amount of memory:
+ 8Mb FLASH and 32Mb RAM vs. 16Mb and 64Mb as in the production board.
+ See the following for more information:
+
+ http://wiki.neurostechnology.com/index.php/OSD_Developer_Board_v1
+
+ NuttX operates on the ARM9EJS of this dual core processor. The DSP
+ is available and unused.
+
+ STATUS: This port is code complete, verified, and included in the
+ NuttX 0.2.1 release.
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. Raisonance GNU toolchain, or
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_DM320_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_DM320_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_DM320_DEVKITARM=y : devkitARM under Windows
+ CONFIG_DM320_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_DM320_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/dm320,
+ arch/arm/src/common, arch/arm/src/arm, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/arm/up_head.S. You may have to build the NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by the IDE.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the ARM926 GCC toolchain (if
+ different from the default).
+
+ If you have no ARM toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+
+ 1. You must have already configured Nuttx in <some-dir>nuttx.
+
+ cd tools
+ ./configure.sh ntosd-dm320/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/arm-defconfig .config OR
+ cp configs/arm926t_defconfig-4.2.4 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h so that the PATH variable includes the path to the
+ newly built binaries.
+
+ARM/DM320-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_ARM926EJS=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=dm320
+
+ CONFIG_ARCH_CHIP_name - For use in C code
+
+ CONFIG_ARCH_CHIP_DM320
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=ntosd-dm320
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_NTOSD_DM320 (for the Spectrum Digital C5471 EVM)
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_VSTART - The startaddress of DRAM (virtual)
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ DM320 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ DM320 USB Configuration
+
+ CONFIG_DM320_GIO_USBATTACH
+ GIO that detects USB attach/detach events
+ CONFIG_DM320_GIO_USBDPPULLUP
+ GIO
+ CONFIG_DMA320_USBDEV_DMA
+ Enable DM320-specific DMA support
+ CONFIG_DM320_GIO_USBATTACH=6
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Neuros OSD configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh ntosd-dm320/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+nettest
+^^^^^^^
+
+This alternative configuration directory may be used to
+enable networking using the OSDs DM9000A Ethernet interface.
+It uses examples/nettest to excercise the TCP/IP network.
+
+nsh
+^^^
+
+Configures the NuttShell (nsh) located at examples/nsh. The
+Configuration enables both the serial and telnetd NSH interfaces.
+
+ostest
+^^^^^^
+
+This configuration directory, performs a simple OS test using
+examples/ostest.
+
+poll
+^^^^
+
+This configuration exercises the poll()/select() text at
+examples/poll
+
+thttpd
+^^^^^^
+
+This builds the THTTPD web server example using the THTTPD and
+the examples/thttpd application.
+
+udp
+^^^
+
+This alternative configuration directory is similar to nettest
+except that is use examples/upd to exercise UDP.
+
+uip
+^^^
+
+This configuration file demonstrates the tiny webserver
+at examples/uip.
+
+Configuration Options
+^^^^^^^^^^^^^^^^^^^^^
+
+In additional to the common configuration options listed in the
+file configs/README.txt, there are other configuration options
+specific to the DM320:
+
+ CONFIG_ARCH - identifies the arch subdirectory and, hence, the
+ processor architecture.
+ CONFIG_ARCH_name - for use in C code. This identifies the
+ particular chip or SoC that the architecture is implemented
+ in.
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+ CONFIG_ARCH_CHIP_name - For use in C code
+ CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
+ the board that supports the particular chip or SoC.
+ CONFIG_ENDIAN_BIG - define if big endian (default is little endian)
+ CONFIG_ARCH_BOARD_name - for use in C code
+ CONFIG_BOARD_LOOPSPERMSEC - for delay loops
+ CONFIG_ARCH_LEDS - Use LEDs to show state.
+ CONFIG_DRAM_SIZE - Describes the internal DRAM.
+ CONFIG_DRAM_START - The start address of internal DRAM
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+DM320 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+DM320 USB Configuration
+
+ CONFIG_DM320_GIO_USBATTACH
+ GIO that detects USB attach/detach events
+ CONFIG_DM320_GIO_USBDPPULLUP
+ GIO connected to D+. Support software connect/disconnect.
+ CONFIG_DMA320_USBDEV_DMA
+ Enable DM320-specific DMA support
+
+Neuros OSD Configuration Options
+
+ CONFIG_ARCH_NTOSD_DEVBOARD - Selects the old NTOSD development board.
+ The default is the production OSD board which differs in
+ several ways.
diff --git a/nuttx/configs/ntosd-dm320/doc/README.txt b/nuttx/configs/ntosd-dm320/doc/README.txt
new file mode 100644
index 000000000..758870b9c
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/doc/README.txt
@@ -0,0 +1,74 @@
+NuttX on the Neuros Technology OSD
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+References:
+^^^^^^^^^^^
+
+http://wiki.neurostechnology.com/index.php/Main_Page
+http://wiki.neurostechnology.com/index.php/OSD_Developer_Home
+http://wiki.neurostechnology.com/index.php/DM320_Platform_development
+http://wiki.neurostechnology.com/index.php/The_Neuros_and_Open_Source
+...
+
+Status:
+^^^^^^^
+
+NOTE: These instructions are for the Neuros development board (and a
+rather old version of NuttX),
+http://wiki.neurostechnology.com/index.php/OSD_Developer_Board_v1
+and have _not_ been updated for the Neuros OSD 1.0 consumer unit
+(or for the current version of NuttX),
+http://wiki.neurostechnology.com/index.php/Neuros_OSD_1.0
+
+At present, the system only supports a serial console and timer
+interrupts so there is not to much that you can do with it. But I
+would be happy to work with anyone who is interested in using it.
+
+General instructions.
+
+1. Download build-0.1.0.tar.gz and nuttx-0.2.3.tar.gz into the same
+ <directory>. These are the current versions as of this writing
+ (but could very well new older release now).
+
+2. Unpack, you should now have <directory>/buildroot and
+ <directory>/nuttx-0.2.3
+
+3. Rename nuttx-0.2.3 to nuttx
+
+4. Configure NuttX:
+
+ cd <directory>/nuttx/tools
+ ./configure.sh ntosd-dm320
+
+5. Build the toolchain:
+
+ cd <directory>/buildroot
+ cp configs/c5471-defconfig .config
+ make oldconfig
+ make
+
+6. Build Nuttx:
+
+ cd <directory>nuttx
+ . ./setenv.sh
+ make
+ mv nuttx /tftpboot/nuttx.dm320
+
+7. Configure the OSD u-boot:
+
+ Neuros Devboard > set ipaddr yy.yy.yy.yy
+ Neuros Devboard > set serverip xx.xx.xx.xx
+ Neuros Devboard > ...
+ Neuros Devboard > run update-ipstatic
+
+ where yy.yy.yy.yy is the OSD IP address and xx.xx.xx.xx is
+ the host PC address.
+
+8. Load and run nuttx from uboot
+
+ tftpboot xx.xx.xx.xx nuttx.dm320
+ go 1008000
+
+What will run is an a simple OS test that will verify many of the
+features of the OS. (this is nutts/examples/ostest).
+
diff --git a/nuttx/configs/ntosd-dm320/doc/test-result.txt b/nuttx/configs/ntosd-dm320/doc/test-result.txt
new file mode 100644
index 000000000..6b295e495
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/doc/test-result.txt
@@ -0,0 +1,468 @@
+This is the output from running examples/ostest on April 28, 2007
+=================================================================
+
+Neuros Devboard > tftpboot 192.168.0.100 nuttx.dm320
+Found DM9000 ID:90000a46 at address 60000300 !
+DM9000 work in 16 bus width
+[eth_init]MAC:0:18:11:80:10:6:
+TFTP from server 192.168.0.100; our IP address is 192.168.0.101
+Filename 'nuttx.dm320'.
+Load address: 0x1000000
+Loading: #############################
+done
+Bytes transferred = 146617 (23cb9 hex)
+Neuros Devboard > go 1008000
+## Starting application at 0x01008000 ...
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 aiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 aiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=18
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+sighand_test: Signaling pid=18 with signo=17 sigvalue=42
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+sieve1 finished
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 3 started
+barrier_test: Thread 3 created
+barrier_func: Thread 4 started
+barrier_test: Thread 4 created
+barrier_func: Thread 5 started
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 3 calling pthread_barrier_wait()
+barrier_func: Thread 4 calling pthread_barrier_wait()
+barrier_test: Thread 5 created
+barrier_func: Thread 6 started
+barrier_test: Thread 6 created
+barrier_func: Thread 7 started
+barrier_test: Thread 7 created
+barrier_func: Thread 5 calling pthread_barrier_wait()
+barrier_func: Thread 6 calling pthread_barrier_wait()
+barrier_func: Thread 7 calling pthread_barrier_wait()
+barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2, back with status=0 (I am not special)
+barrier_func: Thread 3, back with status=0 (I am not special)
+barrier_func: Thread 4, back with status=0 (I am not special)
+barrier_func: Thread 5, back with status=0 (I am not special)
+barrier_func: Thread 6, back with status=0 (I am not special)
+barrier_func: Thread 7 done
+barrier_func: Thread 0 done
+barrier_test: Thread 0 completed with result=0
+barrier_func: Thread 1 done
+barrier_func: Thread 2 done
+barrier_func: Thread 3 done
+barrier_func: Thread 4 done
+barrier_func: Thread 5 done
+barrier_func: Thread 6 done
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+barrier_test: Thread 3 completed with result=0
+barrier_test: Thread 4 completed with result=0
+barrier_test: Thread 5 completed with result=0
+barrier_test: Thread 6 completed with result=0
+barrier_test: Thread 7 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena fe0f10 fe0f10
+ordblks 2 2
+mxordblk fd99b0 fd99b0
+uordblks 53f0 53f0
+fordblks fdbb20 fdbb20
+user_main: Exitting
diff --git a/nuttx/configs/ntosd-dm320/include/README.txt b/nuttx/configs/ntosd-dm320/include/README.txt
new file mode 100644
index 000000000..a52d0c95b
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Neuros dm320-based OSD.
diff --git a/nuttx/configs/ntosd-dm320/include/board.h b/nuttx/configs/ntosd-dm320/include/board.h
new file mode 100644
index 000000000..cf302a1ff
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/include/board.h
@@ -0,0 +1,134 @@
+/************************************************************************************
+ * arch/board/board.h
+ *
+ * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* This platform has the ARM at 175 MHz and the DSP at 101.25 MHz */
+
+#define DM320_ARM_CLOCK 175500000
+#define DM320_SDR_CLOCK 101250000
+#define DM320_DSP_CLOCK 101250000
+#define DM320_AXL_CLOCK 175500000
+#define DM320_AHB_CLOCK 87750000
+
+/* UART0/1 and TIMER0/1 are clocked by PLLIN=27MHz */
+
+#define CONFIG_DM320_UARTPPLIN 1
+
+/* Configration for dm9000 network device */
+
+#define DM9000_BASE CONFIG_DM9000_BASE
+
+/* Memory Map ***********************************************************************/
+
+/* The Neuros development board has 16MiB RAM starting at 0x01000000 (physical) and
+ * 8MiB of FLASH. The Neuros OSD 1.0 consumer has 32MiB RAM starting at 0x01100000
+ * (physical) and 16MiB of FLASH.
+ *
+ * FIXME: Flash location may also differ on OSD 1.0 consumer unit!
+ */
+
+#ifdef CONFIG_ARCH_NTOSD_DEVBOARD
+# if CONFIG_DRAM_START != 0x01000000
+# error "Invalid setting for CONFIG_DRAM_START"
+# endif
+# if CONFIG_DRAM_SIZE != 0x01000000
+# warning "Check CONFIG_DRAM_SIZE. This Neuros OSD has 0x01000000 bytes of SDRAM"
+# endif
+# define DM320_SDRAM_PSECTION 0x01000000 /* 496Mb many section -- */
+# define DM320_SDRAM_PADDR 0x01000000 /* 496Mb many sections CW */
+#else
+# if CONFIG_DRAM_START != 0x01100000
+# error "Invalid setting for CONFIG_DRAM_START"
+# endif
+# if CONFIG_DRAM_SIZE != 0x02000000
+# warning "Check CONFIG_DRAM_SIZE. This Neuros OSD has 0x02000000 bytes of SDRAM"
+# endif
+# define DM320_SDRAM_PSECTION 0x01100000 /* 496Mb many section -- */
+# define DM320_SDRAM_PADDR 0x01100000 /* 496Mb many sections CW */
+#endif
+
+/* GIO keyboard (GIO 1-5) */
+
+#define KEY_MASK 0x003E
+#define KEY_SCAN0_BIT 0x0002
+#define KEY_SCAN1_BIT 0x0004
+#define KEY_SCAN2_BIT 0x0008
+#define KEY_SCAN3_BIT 0x0010
+#define KEY_SCAN4_BIT 0x0020
+
+#define KEY_GIO_DIR0_VAL KEY_MASK /* Configure as INPUT */
+#define KEY_GIO_INV0_VAL KEY_MASK /* All inverted */
+#define KEY_GIO_SET0_VAL (0) /* Initialized to zero */
+#define KEY_GIO_CLR0_VAL (0)
+
+#define GIO_KEY_SCAN0 1
+#define GIO_KEY_SCAN1 2
+#define GIO_KEY_SCAN2 3
+#define GIO_KEY_SCAN3 4
+#define GIO_KEY_SCAN4 5
+#define GIO_MS_DETECT 5
+#define GIO_DM9000A_INT 6
+#define GIO_MMC_DETECT 8
+#define GIO_CFC_DETECT 9
+#define GIO_VIDEO_IN 10
+#define GIO_LED_RED 16
+#define GIO_LED_GREEN 17
+#define GIO_CFC_ENABLE 25
+#define GIO_I2C_SCL 30
+#define GIO_I2C_SDA 31
+#define GIO_ENA_VIDEO 32
+#define GIO_CFC_RESET 36
+#define GIO_CFC_STSCHG 37
+
+/************************************************************************************
+ * Inline Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/ntosd-dm320/nettest/Make.defs b/nuttx/configs/ntosd-dm320/nettest/Make.defs
new file mode 100644
index 000000000..c3b25f9cb
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nettest/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/nettest/Make.defs
+#
+# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/nettest/appconfig b/nuttx/configs/ntosd-dm320/nettest/appconfig
new file mode 100644
index 000000000..de2ad4fb4
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nettest/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/ntosd-dm320/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/ntosd-dm320/nettest/defconfig b/nuttx/configs/ntosd-dm320/nettest/defconfig
new file mode 100644
index 000000000..848cf2f9d
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nettest/defconfig
@@ -0,0 +1,320 @@
+############################################################################
+# configs/ntosd-dm320/nettest/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=29
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=y
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/nettest/ld.script b/nuttx/configs/ntosd-dm320/nettest/ld.script
new file mode 100644
index 000000000..1b0b18500
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nettest/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/nettest/ld.script
+ *
+ * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/nettest/setenv.sh b/nuttx/configs/ntosd-dm320/nettest/setenv.sh
new file mode 100755
index 000000000..8a7788cfd
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nettest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/nettest/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ntosd-dm320/nsh/Make.defs b/nuttx/configs/ntosd-dm320/nsh/Make.defs
new file mode 100644
index 000000000..5c7d88265
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nsh/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/nsh/Make.defs
+#
+# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/nsh/appconfig b/nuttx/configs/ntosd-dm320/nsh/appconfig
new file mode 100644
index 000000000..21cbb6327
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nsh/appconfig
@@ -0,0 +1,58 @@
+############################################################################
+# configs/ntosd-dm320/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+
diff --git a/nuttx/configs/ntosd-dm320/nsh/defconfig b/nuttx/configs/ntosd-dm320/nsh/defconfig
new file mode 100644
index 000000000..d824f55fc
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nsh/defconfig
@@ -0,0 +1,351 @@
+############################################################################
+# configs/ntosd-dm320/nsh/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=12
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/mount
+#CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+CONFIG_EXAMPLES_MOUNT_RAMDEVNO=0
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=y
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/nsh/ld.script b/nuttx/configs/ntosd-dm320/nsh/ld.script
new file mode 100644
index 000000000..6155a1429
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nsh/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/nsh/ld.script
+ *
+ * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/nsh/setenv.sh b/nuttx/configs/ntosd-dm320/nsh/setenv.sh
new file mode 100755
index 000000000..bf3f497ad
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ntosd-dm320/ostest/Make.defs b/nuttx/configs/ntosd-dm320/ostest/Make.defs
new file mode 100644
index 000000000..7b1976cdd
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/ostest/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/ostest/Make.defs
+#
+# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/ostest/appconfig b/nuttx/configs/ntosd-dm320/ostest/appconfig
new file mode 100644
index 000000000..4e74fabc6
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ntosd-dm320/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ntosd-dm320/ostest/defconfig b/nuttx/configs/ntosd-dm320/ostest/defconfig
new file mode 100644
index 000000000..edc991880
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/ostest/defconfig
@@ -0,0 +1,316 @@
+############################################################################
+# configs/ntosd-dm320/ostest/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=29
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=n
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/ostest/ld.script b/nuttx/configs/ntosd-dm320/ostest/ld.script
new file mode 100644
index 000000000..f475f99f2
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/ostest/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/ostest/ld.script
+ *
+ * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/ostest/setenv.sh b/nuttx/configs/ntosd-dm320/ostest/setenv.sh
new file mode 100755
index 000000000..6ce1e04a8
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/ostest/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ntosd-dm320/poll/Make.defs b/nuttx/configs/ntosd-dm320/poll/Make.defs
new file mode 100644
index 000000000..9e63120b1
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/poll/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/poll/Make.defs
+#
+# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/poll/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/poll/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/poll/appconfig b/nuttx/configs/ntosd-dm320/poll/appconfig
new file mode 100644
index 000000000..e16589d1d
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/poll/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/ntosd-dm320/poll/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/poll
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/ntosd-dm320/poll/defconfig b/nuttx/configs/ntosd-dm320/poll/defconfig
new file mode 100644
index 000000000..7386ff966
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/poll/defconfig
@@ -0,0 +1,327 @@
+############################################################################
+# configs/ntosd-dm320/poll/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="poll_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=19
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/poll
+CONFIG_EXAMPLE_POLL_NOMAC=n
+CONFIG_EXAMPLE_POLL_IPADDR=0x0a000002
+CONFIG_EXAMPLE_POLL_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_POLL_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=y
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/poll/ld.script b/nuttx/configs/ntosd-dm320/poll/ld.script
new file mode 100644
index 000000000..f8bdf223b
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/poll/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/poll/ld.script
+ *
+ * Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/poll/setenv.sh b/nuttx/configs/ntosd-dm320/poll/setenv.sh
new file mode 100755
index 000000000..a3479fb18
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/poll/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/poll/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ntosd-dm320/src/Makefile b/nuttx/configs/ntosd-dm320/src/Makefile
new file mode 100644
index 000000000..1d0a1e614
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/src/Makefile
@@ -0,0 +1,77 @@
+############################################################################
+# configs/ntosd-dm320/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c up_network.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ntosd-dm320/src/README.txt b/nuttx/configs/ntosd-dm320/src/README.txt
new file mode 100644
index 000000000..280539eb4
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Neuros OSD.
diff --git a/nuttx/configs/ntosd-dm320/src/up_leds.c b/nuttx/configs/ntosd-dm320/src/up_leds.c
new file mode 100644
index 000000000..9e2336e36
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/src/up_leds.c
@@ -0,0 +1,104 @@
+/************************************************************************
+ * confgs/ntosd-dm320/src/up_leds.c
+ *
+ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "up_internal.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_ledinit
+ ************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ GIO_OUTPUT(GIO_LED_GREEN);
+ GIO_OUTPUT(GIO_LED_RED);
+ GIO_SET_OUTPUT(GIO_LED_GREEN);
+ GIO_CLEAR_OUTPUT(GIO_LED_RED);
+}
+
+/************************************************************************
+ * Name: up_ledon
+ ************************************************************************/
+
+void up_ledon(int led)
+{
+ if (led == GIO_LED_GREEN)
+ {
+ GIO_SET_OUTPUT(GIO_LED_GREEN);
+ }
+ else if (led == GIO_LED_RED)
+ {
+ GIO_SET_OUTPUT(GIO_LED_RED);
+ }
+}
+
+/************************************************************************
+ * Name: up_ledoff
+ ************************************************************************/
+
+void up_ledoff(int led)
+{
+ if (led == GIO_LED_GREEN)
+ {
+ GIO_CLEAR_OUTPUT(GIO_LED_GREEN);
+ }
+ else if (led == GIO_LED_RED)
+ {
+ GIO_CLEAR_OUTPUT(GIO_LED_RED);
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/ntosd-dm320/src/up_network.c b/nuttx/configs/ntosd-dm320/src/up_network.c
new file mode 100644
index 000000000..c94c81433
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/src/up_network.c
@@ -0,0 +1,103 @@
+/****************************************************************************
+ * board/up_network.c
+ *
+ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#if defined(CONFIG_NET) && defined(CONFIG_NET_DM90x0)
+
+#include <debug.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "dm320_memorymap.h"
+#include "dm320_emif.h"
+#include "dm320_gio.h"
+
+extern void dm9x_initialize(void);
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_netinitialize
+ ****************************************************************************/
+
+void up_netinitialize(void)
+{
+ /* CS4 is used for DM9000A Ethernet. Interrupt is provided via GIO6
+ * which must be configured to interrupt on the rising edge. Bus
+ * width is 16-bits.
+ */
+
+ nlldbg("CS4CTRL1=%04x CS4CTRL2=%04x\n",
+ getreg16(DM320_EMIF_CS4CTRL1), getreg16(DM320_EMIF_CS4CTRL2));
+
+ /* It is assumed that bootloader has already configured CS4. Here,
+ * we will only make certain that the GIO is properly configured
+ */
+
+ GIO_INPUT(GIO_DM9000A_INT);
+ GIO_NONINVERTED(GIO_DM9000A_INT);
+ GIO_INTERRUPT(GIO_DM9000A_INT);
+ GIO_RISINGEDGE(GIO_DM9000A_INT);
+
+ nlldbg("GIO DIR0=%04x INV0=%04x IRQPORT=%04x IRQEDGE=%04x\n",
+ getreg16(DM320_GIO_DIR0), getreg16(DM320_GIO_INV0),
+ getreg16(DM320_GIO_IRQPORT), getreg16(DM320_GIO_IRQEDGE));
+
+ /* Then initialize the driver */
+
+ dm9x_initialize();
+}
+
+#endif /* CONFIG_NET && CONFIG_NET_DM90x0 */
diff --git a/nuttx/configs/ntosd-dm320/thttpd/Make.defs b/nuttx/configs/ntosd-dm320/thttpd/Make.defs
new file mode 100644
index 000000000..aca221871
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/thttpd/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/thttpd/Make.defs
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/thttpd/appconfig b/nuttx/configs/ntosd-dm320/thttpd/appconfig
new file mode 100644
index 000000000..bf47bf59f
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/thttpd/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/ntosd-dm320/thttpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/thttpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/thttpd
+
diff --git a/nuttx/configs/ntosd-dm320/thttpd/defconfig b/nuttx/configs/ntosd-dm320/thttpd/defconfig
new file mode 100644
index 000000000..90f84c5e3
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/thttpd/defconfig
@@ -0,0 +1,395 @@
+############################################################################
+# configs/ntosd-dm320/thttpd/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM926EJS=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="thttp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=y
+CONFIG_DEBUG_BINFMT=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=2
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# THTTPD settings
+#
+CONFIG_THTTPD_PORT=80
+CONFIG_THTTPD_IPADDR=0x0a000002
+CONFIG_THTTPD_SERVER_ADDRESS="http://www.nuttx.org"
+CONFIG_THTTPD_SERVER_SOFTWARE="thttpd/2.25b 29dec2003-NuttX"
+CONFIG_THTTPD_PATH="/mnt/www"
+CONFIG_THTTPD_CGI_PATH="/mnt/www/cgi-bin"
+CONFIG_THTTPD_CGI_PATTERN="/mnt/www/cgi-bin/*"
+CONFIG_THTTPD_CGI_PRIORITY=50
+CONFIG_THTTPD_CGI_STACKSIZE=1024
+CONFIG_THTTPD_CGI_BYTECOUNT=20000
+CONFIG_THTTPD_CGI_TIMELIMIT=0
+CONFIG_THTTPD_CHARSET="iso-8859-1"
+CONFIG_THTTPD_IOBUFFERSIZE=256
+#CONFIG_THTTPD_INDEX_NAMES
+CONFIG_AUTH_FILE=n
+CONFIG_THTTPD_LISTEN_BACKLOG=8
+CONFIG_THTTPD_LINGER_MSEC=500
+CONFIG_THTTPD_OCCASIONAL_MSEC=120
+CONFIG_THTTPD_IDLE_READ_LIMIT_SEC=300
+CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC=300
+CONFIG_THTTPD_TILDE_MAP1=n
+CONFIG_THTTPD_TILDE_MAP2=n
+CONFIG_THTTPD_GENERATE_INDICES=n
+CONFIG_THTTPD_URLPATTERN=n
+
+#
+# Additional settings for examples/thttpd
+#
+CONFIG_EXAMPLE_THTTPD_NOMAC=n
+CONFIG_EXAMPLE_THTTPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_THTTPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=y
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/thttpd/ld.script b/nuttx/configs/ntosd-dm320/thttpd/ld.script
new file mode 100644
index 000000000..63199aa5a
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/thttpd/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/thttpd/ld.script
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/thttpd/setenv.sh b/nuttx/configs/ntosd-dm320/thttpd/setenv.sh
new file mode 100755
index 000000000..54700fb6b
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/thttpd/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/thttpd/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ntosd-dm320/udp/Make.defs b/nuttx/configs/ntosd-dm320/udp/Make.defs
new file mode 100644
index 000000000..003df0778
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/udp/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/udp/Make.defs
+#
+# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/udp/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/udp/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/udp/appconfig b/nuttx/configs/ntosd-dm320/udp/appconfig
new file mode 100644
index 000000000..1a1eb12fc
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/udp/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/ntosd-dm320/udp/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/udp
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/ntosd-dm320/udp/defconfig b/nuttx/configs/ntosd-dm320/udp/defconfig
new file mode 100644
index 000000000..4bc4b4bc8
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/udp/defconfig
@@ -0,0 +1,328 @@
+############################################################################
+# configs/ntosd-dm320/udp/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="udp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=29
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=0
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=0
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/udp
+CONFIG_EXAMPLE_UDP_SERVER=n
+CONFIG_EXAMPLE_UDP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UDP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UDP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UDP_SERVERIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=y
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/udp/ld.script b/nuttx/configs/ntosd-dm320/udp/ld.script
new file mode 100644
index 000000000..89dd8f823
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/udp/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/udp/ld.script
+ *
+ * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/udp/setenv.sh b/nuttx/configs/ntosd-dm320/udp/setenv.sh
new file mode 100755
index 000000000..a2e1ffec7
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/udp/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/udp/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ntosd-dm320/uip/Make.defs b/nuttx/configs/ntosd-dm320/uip/Make.defs
new file mode 100644
index 000000000..e759a8dcc
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/uip/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/ntosd-dm320/uip/Make.defs
+#
+# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_DM320_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_DM320_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_DM320_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/uip/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/uip/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv5te -mfloat-abi=soft -fno-builtin
+else
+ ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv5te -msoft-float -fno-builtin
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+#[blf] The `ea3131' had this, but despite using buildroot, neuros doesn't...
+### ifneq ($(CONFIG_LPC313X_BUILDROOT),y) ### change to ...DM320...
+### LDFLAGS += -nostartfiles -nodefaultlibs
+### endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ntosd-dm320/uip/appconfig b/nuttx/configs/ntosd-dm320/uip/appconfig
new file mode 100644
index 000000000..73bf15ba3
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/uip/appconfig
@@ -0,0 +1,46 @@
+############################################################################
+# configs/ntosd-dm320/uip/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/uip
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webserver
diff --git a/nuttx/configs/ntosd-dm320/uip/defconfig b/nuttx/configs/ntosd-dm320/uip/defconfig
new file mode 100644
index 000000000..88a45f94d
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/uip/defconfig
@@ -0,0 +1,328 @@
+############################################################################
+# configs/ntosd-dm320/uip/defconfig
+#
+# Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="dm320"
+CONFIG_ARCH_CHIP_DM320=y
+CONFIG_ARCH_BOARD="ntosd-dm320"
+CONFIG_ARCH_BOARD_NTOSD_DM320=y
+CONFIG_ARCH_NTOSD_DEVBOARD=n
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_DRAM_SIZE=33554432
+CONFIG_DRAM_START=0x01100000
+CONFIG_DRAM_VSTART=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=n
+
+#
+# ARM-specific configuration
+#
+CONFIG_ARCH_LOWVECTORS=n
+CONFIG_ARCH_ROMPGTABLE=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_DM320_CODESOURCERYW=n
+CONFIG_DM320_CODESOURCERYL=y
+CONFIG_DM320_DEVKITARM=n
+CONFIG_DM320_BUILDROOT=n
+
+#
+# DM320 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=29
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_USER_ENTRYPOINT="uip_main"
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# DM320 USB Configuration
+#
+CONFIG_DM320_GIO_USBATTACH=6
+CONFIG_DM320_GIO_USBDPPULLUP=17
+CONFIG_DM320_VENDORID=0xd320
+CONFIG_DM320_PRODUCTID=0x3211
+CONFIG_DM320_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for netutils/httpd
+CONFIG_NETUTILS_HTTPDSTACKSIZE=4096
+CONFIG_NETUTILS_HTTPDFILESTATS=y
+CONFIG_NETUTILS_HTTPDNETSTATS=y
+CONFIG_NETUTILS_HTTPD_DUMPBUFFER=n
+CONFIG_NETUTILS_HTTPD_DUMPPSTATE=n
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=y
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ntosd-dm320/uip/ld.script b/nuttx/configs/ntosd-dm320/uip/ld.script
new file mode 100644
index 000000000..57d763c8e
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/uip/ld.script
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * configs/ntosd-dm320/uip/ld.script
+ *
+ * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The OS entry point is here */
+
+ . = 0x00008000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+ . = ALIGN(4096);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/ntosd-dm320/uip/setenv.sh b/nuttx/configs/ntosd-dm320/uip/setenv.sh
new file mode 100755
index 000000000..ccc74829d
--- /dev/null
+++ b/nuttx/configs/ntosd-dm320/uip/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/ntosd-dm320/uip/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/nucleus2g/Kconfig b/nuttx/configs/nucleus2g/Kconfig
new file mode 100644
index 000000000..32a7fae76
--- /dev/null
+++ b/nuttx/configs/nucleus2g/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_NUCLEUS2G
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/nucleus2g/README.txt b/nuttx/configs/nucleus2g/README.txt
new file mode 100644
index 000000000..81bd2fe65
--- /dev/null
+++ b/nuttx/configs/nucleus2g/README.txt
@@ -0,0 +1,499 @@
+README
+^^^^^^
+
+README for NuttX port to the Nucleus 2G LPC1768 board from 2G Engineering
+(http://www.2g-eng.com/)
+
+Contents
+^^^^^^^^
+
+ 2G-Engineering Nucleus Board
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ LEDs
+ Nucleus 2G Configuration Options
+ Configurations
+
+Nucleus 2G Board
+^^^^^^^^^^^^^^^^
+
+GPIO Usage
+
+ P0[0]/RD1/TXD3/SDA1 P0[0]/CAN_RX1
+ P0[1]/TD1/RXD3/SCL P0[1]/CAN_TX1
+ P0[2]/TXD0/AD0[7] TX0
+ P0[3]/RXD0/AD0[6] RX0
+ P0[4] P0[4]/CAN1_STB
+ P0[5] P0[5]/CAN2_STB
+ P0[6]/I2SRX_SDA/SSEL1/MAT2[0] GPI/O_CS1
+ P0[7]/I2STX_CLK/SCK1/MAT2[1] SCLK1
+ P0[8]/I2STX_WS/MISO1/MAT2[2] MISO1
+ P0[9]/I2STX_SDA/MOSI1/MAT2[3] MOSI1
+ P0[10] P0[10]/CAN1_TERM
+ P0[11] P0[11]/CAN2_TERM
+ P0[15]/TXD1/SCK0/SCK MMC_CLK
+ P0[16]/RXD1/SSEL0/SSEL MMC_CD
+ P0[17]/CTS1/MISO0/MISO MMC_DATA0
+ P0[18]/DCD1/MOSI0/MOSI MMC_MISO
+ P0[19]/DSR1/SDA1 GPI/O_CS2
+ P0[20]/DTR1/SCL1 GPI/O_CS3
+ P0[21]/RI1/MCIPWR/RD1 P0[21]
+ P0[22]/RTS1/TD1 P0[22]
+ P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] AD0
+ P0[24]/AD0[1]/I2SRX_WS/CAP3[1] AD1
+ P0[25]/AD0[2]/I2SRX_SDA/TXD3 AD2
+ P0[26]/AD0[3]/AOUT/RXD3 AD3
+ P0[27]/SDA0/USB_SDA SDA
+ P0[28]/SCL0 SCL
+ P0[29]/USB_D+ USB+
+ P0[30]/USB_D- USB-
+
+ P1[0] - P1[17] Not connected
+ P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] USB_LINK
+ P1[19]-P[29] P[19]-P[29]
+ P1[30]/VBUS/AD0[4] USB_+5
+ P1[31]/SCK1/AD0[5] AD5
+
+ P2[0] P2[0]/LED1_A
+ P2[1] P2[1]/LED1_B
+ P2[2] P2[2]/LED2_A
+ P2[3] P2[3]/LED2_B
+ P2[4] P2[4]
+ P2[5]/PWM1[6]/DTR1/TRACEDATA[0] 232_POWERAVE
+ P2[6]/PCAP1[0]/RI1/TRACECLK 232_VALID
+ P2[7]/RD2/RTS1 P2[7]/CAN_RX2
+ P2[8]/TD2/TXD2 P2[8]/CAN_TX2
+ P2[9]/USB_CONNECT/RXD2 USB_CONNECT
+ P2[10]/EINT0/NMI BOOTLOADER
+ P2[11]/EINT1/I2STX_CLK HEARTBEAT
+ P2[12]/EINT2/I2STX_WS EXTRA_LED
+ P2[13]/EINT3/I2STX_SDA 5V_ENABLE
+
+ P3[25]-P3[26] Not connected
+
+ P4[28]-P4[29] P4[28]-P4[29]
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM toolchain, you simply need add one of the
+ following configuration options to your .config (or defconfig) file:
+
+ CONFIG_LPC17_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC17_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC17_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC17_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC17_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows)and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or
+ Linux native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc17xx,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc17x/lpc17_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh nucleus2g/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+LEDs
+^^^^
+
+ If CONFIG_ARCH_LEDS is defined, then support for the Nucleus-2G LEDs will be
+ included in the build. See:
+
+ - configs/nucleus2g/include/board.h - Defines LED constants, types and
+ prototypes the LED interface functions.
+
+ - configs/nucleus2g/src/nucleus2g_internal.h - GPIO settings for the LEDs.
+
+ - configs/nucleus2g/src/up_leds.c - LED control logic.
+
+ The Nucleus2G has 3 LEDs... two on the Babel CAN board and a "heartbeat" LED."
+ The LEDs on the Babel CAN board are capabl of OFF/GREEN/RED/AMBER status.
+ In normal usage, the two LEDs on the Babel CAN board would show CAN status, but if
+ CONFIG_ARCH_LEDS is defined, these LEDs will be controlled as follows for NuttX
+ debug functionality (where NC means "No Change").
+
+ During the boot phases. LED1 and LED2 will show boot status.
+
+ /* LED1 LED2 HEARTBEAT */
+ #define LED_STARTED 0 /* OFF OFF OFF */
+ #define LED_HEAPALLOCATE 1 /* GREEN OFF OFF */
+ #define LED_IRQSENABLED 2 /* OFF GREEN OFF */
+ #define LED_STACKCREATED 3 /* OFF OFF OFF */
+
+ #define LED_INIRQ 4 /* NC NC ON (momentary) */
+ #define LED_SIGNAL 5 /* NC NC ON (momentary) */
+ #define LED_ASSERTION 6 /* NC NC ON (momentary) */
+ #define LED_PANIC 7 /* NC NC ON (2Hz flashing) */
+ #undef LED_IDLE /* Sleep mode indication not supported */
+
+ After the system is booted, this logic will no longer use LEDs 1 and 2. They
+ are then available for use the application software using lpc17_led1() and
+ lpc17_led2():
+
+ enum lpc17_ledstate_e
+ {
+ LPC17_LEDSTATE_OFF = 0,
+ LPC17_LEDSTATE_GREEN = 1,
+ LPC17_LEDSTATE_RED = 2,
+ LPC17_LEDSTATE_AMBER = (LPC17_LEDSTATE_GREEN|LPC17_LEDSTATE_RED),
+ };
+
+ EXTERN void lpc17_led1(enum lpc17_ledstate_e state);
+ EXTERN void lpc17_led2(enum lpc17_ledstate_e state);
+
+ The heartbeat LED is illuminated during all interrupt and signal procressing.
+ Normally, it will glow dimly to inicate that the LPC17xx is taking interrupts.
+ On an assertion PANIC, it will flash at 2Hz.
+
+Nucleus 2G Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc17xx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LPC1768=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=nucleus2g (for the Nucleus 2G)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_NUCLEUS2G=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x10000000
+
+ CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ CONFIG_LPC17_MAINOSC=y
+ CONFIG_LPC17_PLL0=y
+ CONFIG_LPC17_PLL1=n
+ CONFIG_LPC17_ETHERNET=n
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_LPC17_USBOTG=n
+ CONFIG_LPC17_USBDEV=n
+ CONFIG_LPC17_UART0=y
+ CONFIG_LPC17_UART1=n
+ CONFIG_LPC17_UART2=n
+ CONFIG_LPC17_UART3=n
+ CONFIG_LPC17_CAN1=n
+ CONFIG_LPC17_CAN2=n
+ CONFIG_LPC17_SPI=n
+ CONFIG_LPC17_SSP0=n
+ CONFIG_LPC17_SSP1=n
+ CONFIG_LPC17_I2C0=n
+ CONFIG_LPC17_I2C1=n
+ CONFIG_LPC17_I2S=n
+ CONFIG_LPC17_TMR0=n
+ CONFIG_LPC17_TMR1=n
+ CONFIG_LPC17_TMR2=n
+ CONFIG_LPC17_TMR3=n
+ CONFIG_LPC17_RIT=n
+ CONFIG_LPC17_PWM=n
+ CONFIG_LPC17_MCPWM=n
+ CONFIG_LPC17_QEI=n
+ CONFIG_LPC17_RTC=n
+ CONFIG_LPC17_WDT=n
+ CONFIG_LPC17_ADC=n
+ CONFIG_LPC17_DAC=n
+ CONFIG_LPC17_GPDMA=n
+ CONFIG_LPC17_FLASH=n
+
+ LPC17xx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ LPC17xx specific CAN device driver settings. These settings all
+ require CONFIG_CAN:
+
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
+ CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
+
+ LPC17xx specific PHY/Ethernet device driver settings. These setting
+ also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
+
+ CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+
+ CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ LPC17xx USB Device Configuration
+
+ CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+ CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+ CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in SRAM.
+ CONFIG_LPC17_USBDEV_DMA
+ Enable lpc17xx-specific DMA support
+ CONFIG_LPC17_USBDEV_NOVBUS
+ Define if the hardware implementation does not support the VBUS signal
+ CONFIG_LPC17_USBDEV_NOLED
+ Define if the hardware implementation does not support the LED output
+
+ LPC17xx USB Host Configuration (the Nucleus2G does not support USB Host)
+
+ CONFIG_USBHOST_OHCIRAM_SIZE
+ Total size of OHCI RAM (in AHB SRAM Bank 1)
+ CONFIG_USBHOST_NEDS
+ Number of endpoint descriptors
+ CONFIG_USBHOST_NTDS
+ Number of transfer descriptors
+ CONFIG_USBHOST_TDBUFFERS
+ Number of transfer descriptor buffers
+ CONFIG_USBHOST_TDBUFSIZE
+ Size of one transfer descriptor buffer
+ CONFIG_USBHOST_IOBUFSIZE
+ Size of one end-user I/O buffer. This can be zero if the
+ application can guarantee that all end-user I/O buffers
+ reside in AHB SRAM.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Nucleus 2G configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh nucleus2g/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables only the serial NSH interfaces.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+ usbserial:
+ This configuration directory exercises the USB serial class
+ driver at examples/usbserial. See examples/README.txt for
+ more information.
+
+ usbstorage:
+ This configuration directory exercises the USB mass storage
+ class driver at examples/usbstorage. See examples/README.txt for
+ more information.
+
diff --git a/nuttx/configs/nucleus2g/include/board.h b/nuttx/configs/nucleus2g/include/board.h
new file mode 100644
index 000000000..88fc2164c
--- /dev/null
+++ b/nuttx/configs/nucleus2g/include/board.h
@@ -0,0 +1,290 @@
+/************************************************************************************
+ * configs/nucleus2g/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* NOTE: The following definitions require lpc17_syscon.h. It is not included here
+ * because the including C file may not have that file in its include path.
+ */
+
+#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
+#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
+#define BOARD_RTCCLK_FREQUENCY (32000) /* RTC oscillator frequency */
+#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
+
+/* This is the clock setup we configure for:
+ *
+ * SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
+ * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6
+ */
+
+#define LPC17_CCLK 80000000 /* 80Mhz */
+
+/* Select the main oscillator as the frequency source. SYSCLK is then the frequency
+ * of the main oscillator.
+ */
+
+#undef CONFIG_LPC17_MAINOSC
+#define CONFIG_LPC17_MAINOSC 1
+#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
+
+/* Select the main oscillator and CCLK divider. The output of the divider is CCLK.
+ * The input to the divider (PLLCLK) will be determined by the PLL output.
+ */
+
+#define BOARD_CCLKCFG_DIVIDER 6
+#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
+
+/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
+ *
+ * Source clock: Main oscillator
+ * PLL0 Multiplier value (M): 20
+ * PLL0 Pre-divider value (N): 1
+ *
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
+ */
+
+#undef CONFIG_LPC17_PLL0
+#define CONFIG_LPC17_PLL0 1
+#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
+
+#define BOARD_PLL0CFG_MSEL 20
+#define BOARD_PLL0CFG_NSEL 1
+#define BOARD_PLL0CFG_VALUE \
+ (((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
+
+/* PLL1 -- Not used. */
+
+#undef CONFIG_LPC17_PLL1
+#define BOARD_PLL1CFG_MSEL 36
+#define BOARD_PLL1CFG_NSEL 1
+#define BOARD_PLL1CFG_VALUE \
+ (((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
+
+/* USB divider. This divider is used when PLL1 is not enabled to get the
+ * USB clock from PLL0:
+ *
+ * USBCLK = PLL0CLK / 10 = 48MHz
+ */
+
+#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
+
+/* FLASH Configuration */
+
+#undef CONFIG_LP17_FLASH
+#define CONFIG_LP17_FLASH 1
+#define BOARD_FLASHCFG_VALUE 0x0000303a
+
+/* LED definitions ******************************************************************/
+/* The Nucleus2G has 3 LEDs... two on the Babel CAN board and a "heartbeat" LED."
+ * The LEDs on the Babel CAN board are capabl of OFF/GREEN/RED/AMBER status.
+ * In normal usage, the two LEDs on the Babel CAN board would show CAN status, but if
+ * CONFIG_ARCH_LEDS is defined, these LEDs will be controlled as follows for NuttX
+ * debug functionality (where NC means "No Change").
+ *
+ * During the boot phases. LED1 and LED2 will show boot status.
+ */
+ /* LED1 LED2 HEARTBEAT */
+#define LED_STARTED 0 /* OFF OFF OFF */
+#define LED_HEAPALLOCATE 1 /* GREEN OFF OFF */
+#define LED_IRQSENABLED 2 /* OFF GREEN OFF */
+#define LED_STACKCREATED 3 /* OFF OFF OFF */
+
+/* After the system is booted, this logic will no longer use LEDs 1 and 2. They
+ * are available for use the application software using lpc17_led1() and lpc17_led2()
+ * (prototyped below)
+ */
+ /* LED1 LED2 HEARTBEAT */
+#define LED_INIRQ 4 /* NC NC ON (momentary) */
+#define LED_SIGNAL 5 /* NC NC ON (momentary) */
+#define LED_ASSERTION 6 /* NC NC ON (momentary) */
+#define LED_PANIC 7 /* NC NC ON (1Hz flashing) */
+
+/* Alternate pin selections *********************************************************/
+/* UART1 -- Not connected */
+
+#define GPIO_UART1_TXD GPIO_UART1_TXD_1
+#define GPIO_UART1_RXD GPIO_UART1_RXD_1
+#define GPIO_UART1_CTS GPIO_UART1_CTS_1
+#define GPIO_UART1_DCD GPIO_UART1_DCD_1
+#define GPIO_UART1_DSR GPIO_UART1_DSR_1
+#define GPIO_UART1_DTR GPIO_UART1_DTR_1
+#define GPIO_UART1_RI GPIO_UART1_RI_1
+#define GPIO_UART1_RTS GPIO_UART1_RTS_1
+
+/* UART2 -- Not connected */
+
+#define GPIO_UART2_TXD GPIO_UART2_TXD_1
+#define GPIO_UART2_RXD GPIO_UART2_RXD_1
+
+/* UART3 -- Not connected */
+
+#define GPIO_UART3_TXD GPIO_UART3_TXD_3
+#define GPIO_UART3_RXD GPIO_UART3_RXD_3
+
+/* Either SPI or SSP0 can drive the MMC/SD slot (SSP0 alternate pin settings are
+ * not connected)
+ */
+
+#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
+#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
+#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
+#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
+
+/* SSP1 */
+
+#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1
+
+/* Can bus config */
+
+/* CAN1 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[0]/RD1/TXD3/SDA1 46 RD1
+ * P0[1]/TD1/RXD3/SCL1 47 TD1
+ */
+
+#define GPIO_CAN1_RD GPIO_CAN1_RD_1
+#define GPIO_CAN1_TD GPIO_CAN1_TD_1
+
+/* Suppy default CAN BAUD (can be overridden in the .config file) */
+
+#ifndef CONFIG_CAN1_BAUD
+# define CONFIG_CAN1_BAUD 1000000
+#endif
+#ifndef CONFIG_CAN2_BAUD
+# define CONFIG_CAN2_BAUD 1000000
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef CONFIG_ARCH_LEDS
+enum lpc17_ledstate_e
+{
+ LPC17_LEDSTATE_OFF = 0,
+ LPC17_LEDSTATE_GREEN = 1,
+ LPC17_LEDSTATE_RED = 2,
+ LPC17_LEDSTATE_AMBER = (LPC17_LEDSTATE_GREEN|LPC17_LEDSTATE_RED),
+};
+#endif
+
+enum output_state
+{
+ RELAY_OPEN = 0,
+ RELAY_CLOSED = 1,
+ RELAY_TOGGLE = 2,
+};
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the initialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void lpc17_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lpc17_led1 and 2
+ *
+ * Description:
+ * Once the system has booted, these functions can be used to control LEDs 1 and 2
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void lpc17_led1(enum lpc17_ledstate_e state);
+EXTERN void lpc17_led2(enum lpc17_ledstate_e state);
+#endif
+
+/************************************************************************************
+ * Name: nucleus_bms_relay 1-4
+ *
+ * Description:
+ * once booted these functions control the 4 isolated FET outputs from the
+ * master BMS controller
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BOARD_NUCLEUS2G_BMS
+EXTERN void nucleus_bms_relay1(enum output_state state);
+EXTERN void nucleus_bms_relay2(enum output_state state);
+EXTERN void nucleus_bms_relay3(enum output_state state);
+EXTERN void nucleus_bms_relay4(enum output_state state);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/nucleus2g/nsh/Make.defs b/nuttx/configs/nucleus2g/nsh/Make.defs
new file mode 100644
index 000000000..44cab10a4
--- /dev/null
+++ b/nuttx/configs/nucleus2g/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/nucleus2g/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/nucleus2g/nsh/appconfig b/nuttx/configs/nucleus2g/nsh/appconfig
new file mode 100644
index 000000000..ae83b858b
--- /dev/null
+++ b/nuttx/configs/nucleus2g/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/nucleus2g/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/nucleus2g/nsh/defconfig b/nuttx/configs/nucleus2g/nsh/defconfig
new file mode 100755
index 000000000..6dcef15a7
--- /dev/null
+++ b/nuttx/configs/nucleus2g/nsh/defconfig
@@ -0,0 +1,467 @@
+############################################################################
+# configs/nucleus2g/nsh/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="nucleus2g"
+CONFIG_ARCH_BOARD_NUCLEUS2G=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=y
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=22
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=n
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=1536
+CONFIG_USBHOST_NEDS=2
+CONFIG_USBHOST_NTDS=2
+CONFIG_USBHOST_TDBUFFERS=3
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=512
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/nucleus2g/nsh/ld.script b/nuttx/configs/nucleus2g/nsh/ld.script
new file mode 100755
index 000000000..bc4d89cf1
--- /dev/null
+++ b/nuttx/configs/nucleus2g/nsh/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/nucleus2g/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/nucleus2g/nsh/setenv.sh b/nuttx/configs/nucleus2g/nsh/setenv.sh
new file mode 100755
index 000000000..ffdc74e9b
--- /dev/null
+++ b/nuttx/configs/nucleus2g/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/nucleus2g/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/nucleus2g/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/nucleus2g/ostest/Make.defs b/nuttx/configs/nucleus2g/ostest/Make.defs
new file mode 100644
index 000000000..614654a8f
--- /dev/null
+++ b/nuttx/configs/nucleus2g/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/nucleus2g/ostest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/nucleus2g/ostest/appconfig b/nuttx/configs/nucleus2g/ostest/appconfig
new file mode 100644
index 000000000..835b8e1dc
--- /dev/null
+++ b/nuttx/configs/nucleus2g/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/nucleus2g/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/nucleus2g/ostest/defconfig b/nuttx/configs/nucleus2g/ostest/defconfig
new file mode 100755
index 000000000..622db2a5f
--- /dev/null
+++ b/nuttx/configs/nucleus2g/ostest/defconfig
@@ -0,0 +1,444 @@
+############################################################################
+# configs/nucleus2g/ostest/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="nucleus2g"
+CONFIG_ARCH_BOARD_NUCLEUS2G=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=20
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/nucleus2g/ostest/ld.script b/nuttx/configs/nucleus2g/ostest/ld.script
new file mode 100755
index 000000000..5d3b874af
--- /dev/null
+++ b/nuttx/configs/nucleus2g/ostest/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/nucleus2g/ostest/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/nucleus2g/ostest/setenv.sh b/nuttx/configs/nucleus2g/ostest/setenv.sh
new file mode 100755
index 000000000..6a78a5c23
--- /dev/null
+++ b/nuttx/configs/nucleus2g/ostest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/nucleus2g/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/nucleus2g/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/nucleus2g/ostest/test-result.txt b/nuttx/configs/nucleus2g/ostest/test-result.txt
new file mode 100644
index 000000000..bfae9ef4c
--- /dev/null
+++ b/nuttx/configs/nucleus2g/ostest/test-result.txt
@@ -0,0 +1,432 @@
+Output from examples/ostest for the Nucleus-2G board. June 21, 2010.
+--------------------------------------------------------------------
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve1 finished
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 2, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena b1c0 b1c0
+ordblks 3 3
+mxordblk 7ff0 7ff0
+uordblks 1d20 1d20
+fordblks 94a0 94a0
+user_main: Exitting
diff --git a/nuttx/configs/nucleus2g/src/Makefile b/nuttx/configs/nucleus2g/src/Makefile
new file mode 100644
index 000000000..6e3fc94d2
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/Makefile
@@ -0,0 +1,90 @@
+############################################################################
+# configs/nucleus2g/src/Makefile
+#
+# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c up_ssp.c up_outputs.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/nucleus2g/src/nucleus2g_internal.h b/nuttx/configs/nucleus2g/src/nucleus2g_internal.h
new file mode 100644
index 000000000..168b9aa1d
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/nucleus2g_internal.h
@@ -0,0 +1,156 @@
+/************************************************************************************
+ * configs/nucleus2g/src/nucleus2g_internal.h
+ * arch/arm/src/board/nucleus2g_internal.n
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_NUCLEUS2G_SRC_NUCLEUS2G_INTERNAL_H
+#define _CONFIGS_NUCLEUS2G_SRC_NUCLEUS2G_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* NUCLEUS-2G GPIO Pin Definitions **************************************************/
+/* Board GPIO Usage:
+ *
+ * P0[0]/RD1/TXD3/SDA1 P0[0]/CAN_RX1
+ * P0[1]/TD1/RXD3/SCL P0[1]/CAN_TX1
+ * P0[2]/TXD0/AD0[7] TX0
+ * P0[3]/RXD0/AD0[6] RX0
+ * P0[4] P0[4]/CAN1_STB
+ * P0[5] P0[5]/CAN2_STB
+ * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] GPI/O_CS1
+ * P0[7]/I2STX_CLK/SCK1/MAT2[1] SCLK1
+ * P0[8]/I2STX_WS/MISO1/MAT2[2] MISO1
+ * P0[9]/I2STX_SDA/MOSI1/MAT2[3] MOSI1
+ * P0[10] P0[10]/CAN1_TERM
+ * P0[11] P0[11]/CAN2_TERM
+ * P0[15]/TXD1/SCK0/SCK MMC_CLK
+ * P0[16]/RXD1/SSEL0/SSEL MMC_CD
+ * P0[17]/CTS1/MISO0/MISO MMC_DATA0
+ * P0[18]/DCD1/MOSI0/MOSI MMC_MISO
+ * P0[19]/DSR1/SDA1 GPI/O_CS2
+ * P0[20]/DTR1/SCL1 GPI/O_CS3
+ * P0[21]/RI1/MCIPWR/RD1 P0[21]
+ * P0[22]/RTS1/TD1 P0[22]
+ * P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] AD0
+ * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] AD1
+ * P0[25]/AD0[2]/I2SRX_SDA/TXD3 AD2
+ * P0[26]/AD0[3]/AOUT/RXD3 AD3
+ * P0[27]/SDA0/USB_SDA SDA
+ * P0[28]/SCL0 SCL
+ * P0[29]/USB_D+ USB+
+ * P0[30]/USB_D- USB-
+ *
+ * P1[0] - P1[17] Not connected
+ * P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] USB_LINK
+ * P1[19]-P[29] P[19]-P[29]
+ * P1[30]/VBUS/AD0[4] USB_+5
+ * P1[31]/SCK1/AD0[5] AD5
+ *
+ * P2[0] P2[0]/LED1_A
+ * P2[1] P2[1]/LED1_B
+ * P2[2] P2[2]/LED2_A
+ * P2[3] P2[3]/LED2_B
+ * P2[4] P2[4]
+ * P2[5]/PWM1[6]/DTR1/TRACEDATA[0] 232_POWERAVE
+ * P2[6]/PCAP1[0]/RI1/TRACECLK 232_VALID
+ * P2[7]/RD2/RTS1 P2[7]/CAN_RX2
+ * P2[8]/TD2/TXD2 P2[8]/CAN_TX2
+ * P2[9]/USB_CONNECT/RXD2 USB_CONNECT
+ * P2[10]/EINT0/NMI BOOTLOADER
+ * P2[11]/EINT1/I2STX_CLK HEARTBEAT
+ * P2[12]/EINT2/I2STX_WS EXTRA_LED
+ * P2[13]/EINT3/I2STX_SDA 5V_ENABLE
+ *
+ * P3[25]-P3[26] Not connected
+ *
+ * P4[28]-P4[29] P4[28]-P4[29]
+ */
+
+#define NUCLEUS2G_LED1_A (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN0)
+#define NUCLEUS2G_LED1_B (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN1)
+#define NUCLEUS2G_LED2_A (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN2)
+#define NUCLEUS2G_LED2_B (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN3)
+#define NUCLEUS2G_232_ENABLE (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN5)
+#define NUCLEUS2G_232_POWERSAVE (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN5)
+#define NUCLEUS2G_232_VALID (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5)
+#define NUCLEUS2G_HEARTBEAT (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN11)
+#define NUCLEUS2G_EXTRA_LED (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN12)
+#define NUCLEUS2G_5V_ENABLE (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN13)
+#define NUCLEUS2G_5V_DISABLE (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN13)
+
+#define NUCLEUS2G_MMCSD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN16)
+
+#define NUCLEUS_BMS_RELAY1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN20)
+#define NUCLEUS_BMS_RELAY2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN21)
+#define NUCLEUS_BMS_RELAY3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN22)
+#define NUCLEUS_BMS_RELAY4 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN23)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the NUCLEUS-2G board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lpc17_sspinitialize(void);
+
+extern void up_relayinit(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_NUCLEUS2G_SRC_NUCLEUS2G_INTERNAL_H */
+
diff --git a/nuttx/configs/nucleus2g/src/up_boot.c b/nuttx/configs/nucleus2g/src/up_boot.c
new file mode 100644
index 000000000..d4c44a455
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/up_boot.c
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * configs/nucleus2g/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+#include "nucleus2g_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the initialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc17_boardinitialize(void)
+{
+ /* Enable +5V needed for CAN */
+
+#if defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2)
+ lpc17_configgpio(NUCLEUS2G_5V_ENABLE);
+#else
+ lpc17_configgpio(NUCLEUS2G_5V_DISABLE);
+#endif
+
+ /* If UART0 is used, enabled the MAX232 driver */
+
+#ifdef CONFIG_LPC17_UART0
+ lpc17_configgpio(NUCLEUS2G_232_ENABLE);
+#else
+ lpc17_configgpio(NUCLEUS2G_232_POWERSAVE);
+#endif
+
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function lpc17_sspinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+ if (lpc17_sspinitialize)
+ {
+ lpc17_sspinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+
+ /* Configure the relay outptus for use on the BMS master board */
+
+#ifdef CONFIG_ARCH_BOARD_NUCLEUS2G_BMS
+ up_relayinit();
+#endif
+}
diff --git a/nuttx/configs/nucleus2g/src/up_leds.c b/nuttx/configs/nucleus2g/src/up_leds.c
new file mode 100644
index 000000000..41f955af4
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/up_leds.c
@@ -0,0 +1,235 @@
+/****************************************************************************
+ * configs/nucleus2g/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+
+#include "nucleus2g_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_VERBOSE
+# define led_dumpgpio(m) lpc17_dumpgpio(NUCLEUS2G_LED1_A, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* The Nucleus2G has 3 LEDs... two on the Babel CAN board and a "heartbeat" LED."
+ * The LEDs on the Babel CAN board are capabl of OFF/GREEN/RED/AMBER status.
+ * In normal usage, the two LEDs on the Babel CAN board would show CAN status, but if
+ * CONFIG_ARCH_LEDS is defined, these LEDs will be controlled as follows for NuttX
+ * debug functionality (where NC means "No Change").
+ *
+ * LED1 LED2 HEARTBEAT
+ * +------- ------ -----------------------
+ * LED_STARTED | OFF OFF OFF
+ * LED_HEAPALLOCATE | GREEN OFF OFF
+ * LED_IRQSENABLED | OFF GREEN OFF
+ * LED_STACKCREATED | OFF OFF OFF
+ * LED_INIRQ | NC NC ON (momentary)
+ * LED_SIGNAL | NC NC ON (momentary)
+ * LED_ASSERTION | NC NC ON (momentary)
+ * LED_PANIC | NC NC ON (1Hz flashing)
+ */
+
+static bool g_initialized;
+static int g_nestcount;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure all LED GPIO lines */
+
+ led_dumpgpio("up_ledinit() Entry)");
+
+ lpc17_configgpio(NUCLEUS2G_LED1_A);
+ lpc17_configgpio(NUCLEUS2G_LED1_B);
+ lpc17_configgpio(NUCLEUS2G_LED2_A);
+ lpc17_configgpio(NUCLEUS2G_LED2_B);
+ lpc17_configgpio(NUCLEUS2G_HEARTBEAT);
+ lpc17_configgpio(NUCLEUS2G_EXTRA_LED);
+
+ led_dumpgpio("up_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ /* We will control LED1 and LED2 not yet completed the boot sequence. */
+
+ if (!g_initialized)
+ {
+ enum lpc17_ledstate_e led1 = LPC17_LEDSTATE_OFF;
+ enum lpc17_ledstate_e led2 = LPC17_LEDSTATE_OFF;
+ switch (led)
+ {
+ case LED_STACKCREATED:
+ g_initialized = true;
+ case LED_STARTED:
+ default:
+ break;
+
+ case LED_HEAPALLOCATE:
+ led1 = LPC17_LEDSTATE_GREEN;
+ break;
+
+ case LED_IRQSENABLED:
+ led2 = LPC17_LEDSTATE_GREEN;
+ }
+ lpc17_led1(led1);
+ lpc17_led2(led2);
+ }
+
+ /* We will always control the HB LED */
+
+ switch (led)
+ {
+ default:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ case LED_PANIC:
+ lpc17_gpiowrite(NUCLEUS2G_HEARTBEAT, false);
+ g_nestcount++;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ /* In all states, OFF can only mean turning off the HB LED */
+
+ if (g_nestcount <= 1)
+ {
+ lpc17_gpiowrite(NUCLEUS2G_HEARTBEAT, true);
+ g_nestcount = 0;
+ }
+ else
+ {
+ g_nestcount--;
+ }
+}
+
+/************************************************************************************
+ * Name: lpc17_led1 and 2
+ *
+ * Description:
+ * Once the system has booted, these functions can be used to control LEDs 1 and 2
+ *
+ ************************************************************************************/
+
+void lpc17_led1(enum lpc17_ledstate_e state)
+{
+ bool red = (((unsigned int)state & LPC17_LEDSTATE_RED) != 0);
+ bool green = (((unsigned int)state & LPC17_LEDSTATE_GREEN) != 0);
+
+ lpc17_gpiowrite(NUCLEUS2G_LED1_A, red);
+ lpc17_gpiowrite(NUCLEUS2G_LED1_B, green);
+}
+
+void lpc17_led2(enum lpc17_ledstate_e state)
+{
+ bool red = (((unsigned int)state & LPC17_LEDSTATE_RED) != 0);
+ bool green = (((unsigned int)state & LPC17_LEDSTATE_GREEN) != 0);
+
+ lpc17_gpiowrite(NUCLEUS2G_LED2_A, red);
+ lpc17_gpiowrite(NUCLEUS2G_LED2_B, green);
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/nucleus2g/src/up_nsh.c b/nuttx/configs/nucleus2g/src/up_nsh.c
new file mode 100644
index 000000000..9986c8282
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/up_nsh.c
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * config/nucleus2g/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_NUCLEUS2G
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 0
+# error "The Nucleus-2G MMC/SD is on SSP0"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 0
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The Nucleus-2G MMC/SD is only one slot (0)"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+# ifndef CONFIG_LPC17_SSP0
+# warning "CONFIG_LPC17_SSP0 is not enabled"
+# endif
+#else
+# error "Unrecognized board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB device features if USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *ssp;
+ int ret;
+
+ /* Get the SSP port */
+
+ ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!ssp)
+ {
+ message("nsh_archinitialize: Failed to initialize SSP port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("Successfully initialized SSP port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SSP port to the slot */
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, ssp);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SSP port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("Successfuly bound SSP port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+
+ return OK;
+}
diff --git a/nuttx/configs/nucleus2g/src/up_outputs.c b/nuttx/configs/nucleus2g/src/up_outputs.c
new file mode 100644
index 000000000..749f331eb
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/up_outputs.c
@@ -0,0 +1,129 @@
+/****************************************************************************
+ * configs/nucleus2g/src/up_outputs.c
+ * arch/arm/src/board/up_outputs.c
+ *
+ * Copyright (C) 2012 Hal Glenn. All rights reserved.
+ * Author: Hal Glenn <hglenn@2g-eng.com>
+ *
+ * This file is part of NuttX:
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+
+#include "nucleus2g_internal.h"
+
+#ifdef CONFIG_ARCH_BOARD_NUCLEUS2G_BMS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nucleus_bms_relay 1-4
+ *
+ * Description:
+ * Once booted these functions control the 4 isolated FET outputs from the
+ * master BMS controller
+ *
+ ***************************************************************************/
+
+void nucleus_bms_relay1(enum output_state state)
+{
+ bool value = (state == (enum output_state)RELAY_OPEN);
+ lpc17_gpiowrite(NUCLEUS_BMS_RELAY1, value);
+}
+
+void nucleus_bms_relay2(enum output_state state)
+{
+ bool value = (state == (enum output_state)RELAY_OPEN);
+ lpc17_gpiowrite(NUCLEUS_BMS_RELAY2, value);
+}
+
+void nucleus_bms_relay3(enum output_state state)
+{
+ bool value = (state == (enum output_state)RELAY_OPEN);
+ lpc17_gpiowrite(NUCLEUS_BMS_RELAY3, value);
+}
+
+void nucleus_bms_relay4(enum output_state state)
+{
+ bool value = (state == (enum output_state)RELAY_OPEN);
+ lpc17_gpiowrite(NUCLEUS_BMS_RELAY4, value);
+}
+
+/***************************************************************************
+ * Name: up_relayinit
+ *
+ * Description:
+ * This function is called on boot to init the GPIO for relay control
+ *
+ ***************************************************************************/
+
+void up_relayinit(void)
+{
+ lpc17_configgpio(NUCLEUS_BMS_RELAY1);
+ lpc17_configgpio(NUCLEUS_BMS_RELAY2);
+ lpc17_configgpio(NUCLEUS_BMS_RELAY3);
+ lpc17_configgpio(NUCLEUS_BMS_RELAY4);
+}
+
+#endif /* CONFIG_ARCH_BOARD_NUCLEUS2G_BMS */
+
diff --git a/nuttx/configs/nucleus2g/src/up_ssp.c b/nuttx/configs/nucleus2g/src/up_ssp.c
new file mode 100644
index 000000000..5515d4968
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/up_ssp.c
@@ -0,0 +1,185 @@
+/************************************************************************************
+ * configs/nucleus2g/src/up_ssp.c
+ * arch/arm/src/board/up_ssp.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lpc17_internal.h"
+#include "nucleus2g_internal.h"
+
+/* The LM3S6965 Eval Kit microSD CS is on SSI0 */
+
+#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SSP_DEBUG /* Define to enable debug */
+#undef SSP_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SSP_DEBUG
+# define sspdbg lldbg
+# ifdef SSP_VERBOSE
+# define sspvdbg lldbg
+# else
+# define sspvdbg(x...)
+# endif
+#else
+# undef SSP_VERBOSE
+# define sspdbg(x...)
+# define sspvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSP_VERBOSE
+# define ssp_dumpgpio(m) lpc17_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssp_dumpgpio(m)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit.
+ *
+ ************************************************************************************/
+
+void weak_function lpc17_sspinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssp_dumpgpio("lpc17_sspinitialize() Entry)");
+
+ /* SSP0 connects only to the MMC/SD slot on the Nucleus 1G board.
+ * P0[15]/TXD1/SCK0/SCK MMC_CLK
+ * P0[16]/RXD1/SSEL0/SSEL MMC_CD
+ * P0[17]/CTS1/MISO0/MISO MMC_DATA0
+ * P0[18]/DCD1/MOSI0/MOSI MMC_MISO
+ *
+ * In SPI mode the MMC/SD DATA3/CD functions as the SPI chip select.
+ */
+
+#ifdef CONFIG_LPC17_SSP0
+ lpc17_configgpio(NUCLEUS2G_MMCSD_CS);
+#endif
+
+ /* SSP1 goes off the Nucleus 2G board to the Babel CAN board along with 3 chip
+ * select pins. However, it is currently not used on that board.
+ */
+
+#ifdef CONFIG_LPC17_SSP1
+# warning "SSP1 chip selects not known"
+#endif
+ ssp_dumpgpio("lpc17_sspinitialize() Exit");
+}
+
+/************************************************************************************
+ * Name: lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
+ *
+ * Description:
+ * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
+ * must be provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common LPC17xx logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in lpc17_boardinitialize() to configure SPI/SSP chip select
+ * pins.
+ * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC17_SSP0
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ ssp_dumpgpio("lpc17_spiselect() Entry");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert the CS pin to the card */
+
+ lpc17_gpiowrite(NUCLEUS2G_MMCSD_CS, !selected);
+ }
+ ssp_dumpgpio("lpc17_spiselect() Exit");
+}
+
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_LPC17_SSP1
+# warning "SSP1 chip selects not known"
+#endif
+
+#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
diff --git a/nuttx/configs/nucleus2g/src/up_usbmsc.c b/nuttx/configs/nucleus2g/src/up_usbmsc.c
new file mode 100644
index 000000000..8c71a5ce7
--- /dev/null
+++ b/nuttx/configs/nucleus2g/src/up_usbmsc.c
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * configs/nucleus2g/src/up_usbmsc.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the LPC17xx MMC/SD SPI block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_NUCLEUS2G
+# undef LPC17XX_MMCSDSPIPORTNO
+# define LPC17XX_MMCSDSPIPORTNO 1
+# undef LPC17XX_MMCSDSLOTNO
+# define LPC17XX_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new LPC17xx boards here */
+# error "Unrecognized LPC17xx board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("usbmsc_archinitialize: Initializing SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("usbmsc_archinitialize: Successfully initialized SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("usbmsc_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, LPC17XX_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("usbmsc_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("usbmsc_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
+ return OK;
+}
diff --git a/nuttx/configs/nucleus2g/tools/olimex-tiny.cfg b/nuttx/configs/nucleus2g/tools/olimex-tiny.cfg
new file mode 100644
index 000000000..03d3ac6bc
--- /dev/null
+++ b/nuttx/configs/nucleus2g/tools/olimex-tiny.cfg
@@ -0,0 +1,61 @@
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG ARM-USB-TINY-H"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15ba 0x002a
+
+# NXP LPC1768 Cortex-M3 with 512kB Flash and 32kB+32kB Local On-Chip SRAM, clocked with 4MHz internal RC oscillator
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME lpc1768
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ set _CPUTAPID 0x4ba00477
+}
+
+#delays on reset lines
+jtag_nsrst_delay 200
+jtag_ntrst_delay 200
+
+# LPC2000 & LPC1700 -> SRST causes TRST
+reset_config trst_and_srst srst_pulls_trst
+
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
+
+# LPC1768 has 32kB of SRAM on its main system bus (so-called Local On-Chip SRAM)
+$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size 0x8000 -work-area-backup 0
+
+# REVISIT is there any good reason to have this reset-init event handler??
+# Normally they should set up (board-specific) clocking then probe the flash...
+$_TARGETNAME configure -event reset-init {
+ # Force NVIC.VTOR to point to flash at 0 ...
+ # WHY? This is it's reset value; we run right after reset!!
+ mwb 0xE000ED08 0x00
+}
+
+# LPC1768 has 512kB of user-available FLASH (bootloader is located in separate dedicated region).
+# flash bank lpc1700 <base> <size> 0 0 <target#> <variant> <cclk> [calc_checksum]
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME lpc2000 0x0 0x80000 0 0 $_TARGETNAME lpc1700 80000 calc_checksum
+
+# 4MHz / 6 = 666kHz, so use 500
+jtag_khz 500
diff --git a/nuttx/configs/nucleus2g/tools/olimex.cfg b/nuttx/configs/nucleus2g/tools/olimex.cfg
new file mode 100644
index 000000000..8183ffd92
--- /dev/null
+++ b/nuttx/configs/nucleus2g/tools/olimex.cfg
@@ -0,0 +1,62 @@
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG A"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15BA 0x0003
+
+# NXP LPC1768 Cortex-M3 with 512kB Flash and 32kB+32kB Local On-Chip SRAM, clocked with 4MHz internal RC oscillator
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME lpc1768
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ set _CPUTAPID 0x4ba00477
+}
+
+#delays on reset lines
+jtag_nsrst_delay 200
+jtag_ntrst_delay 200
+
+# LPC2000 & LPC1700 -> SRST causes TRST
+reset_config trst_and_srst srst_pulls_trst
+
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
+
+# LPC1768 has 32kB of SRAM on its main system bus (so-called Local On-Chip SRAM)
+$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size 0x8000 -work-area-backup 0
+
+# REVISIT is there any good reason to have this reset-init event handler??
+# Normally they should set up (board-specific) clocking then probe the flash...
+$_TARGETNAME configure -event reset-init {
+ # Force NVIC.VTOR to point to flash at 0 ...
+ # WHY? This is it's reset value; we run right after reset!!
+ mwb 0xE000ED08 0x00
+}
+
+# LPC1768 has 512kB of user-available FLASH (bootloader is located in separate dedicated region).
+# flash bank lpc1700 <base> <size> 0 0 <target#> <variant> <cclk> [calc_checksum]
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME lpc2000 0x0 0x80000 0 0 $_TARGETNAME lpc1700 80000 calc_checksum
+
+# 4MHz / 6 = 666kHz, so use 500
+jtag_khz 100
+
diff --git a/nuttx/configs/nucleus2g/tools/oocd.sh b/nuttx/configs/nucleus2g/tools/oocd.sh
new file mode 100755
index 000000000..23bc96703
--- /dev/null
+++ b/nuttx/configs/nucleus2g/tools/oocd.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+TOPDIR=$1
+CFGFILE=$2
+USAGE="$0 <TOPDIR> [-d]"
+
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ exit 1
+fi
+
+if [ -z "${CFGFILE}" ]; then
+ echo "Using olimex.cfg"
+ CFGFILE=olimex.cfg
+fi
+
+OPENOCD_PATH="/cygdrive/c/OpenOCD/openocd-0.4.0/src"
+OPENOCD_EXE=openocd.exe
+OPENOCD_CFG="${TOPDIR}/configs/nucleus2g/tools/${CFGFILE}"
+OPENOCD_ARGS="-f `cygpath -w ${OPENOCD_CFG}`"
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+if [ ! -d ${OPENOCD_PATH} ]; then
+ echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
+ exit 1
+fi
+if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
+ echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+fi
+if [ ! -f ${OPENOCD_CFG} ]; then
+ echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
+ exit 1
+fi
+
+echo "Starting OpenOCD"
+${OPENOCD_PATH}/${OPENOCD_EXE} ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
+
+
+
+
diff --git a/nuttx/configs/nucleus2g/tools/scarab.cfg b/nuttx/configs/nucleus2g/tools/scarab.cfg
new file mode 100644
index 000000000..a94c6071a
--- /dev/null
+++ b/nuttx/configs/nucleus2g/tools/scarab.cfg
@@ -0,0 +1,63 @@
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "usbScarab A"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x0403 0xbbe0
+
+# NXP LPC1768 Cortex-M3 with 512kB Flash and 32kB+32kB Local On-Chip SRAM, clocked with 4MHz internal RC oscillator
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME lpc1768
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ set _CPUTAPID 0x4ba00477
+}
+
+#delays on reset lines
+jtag_nsrst_delay 200
+jtag_ntrst_delay 200
+
+# LPC2000 & LPC1700 -> SRST causes TRST
+reset_config trst_and_srst srst_pulls_trst
+
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
+
+# LPC1768 has 32kB of SRAM on its main system bus (so-called Local On-Chip SRAM)
+$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size 0x8000 -work-area-backup 0
+
+# REVISIT is there any good reason to have this reset-init event handler??
+# Normally they should set up (board-specific) clocking then probe the flash...
+$_TARGETNAME configure -event reset-init {
+ # Force NVIC.VTOR to point to flash at 0 ...
+ # WHY? This is it's reset value; we run right after reset!!
+ mwb 0xE000ED08 0x00
+}
+
+# LPC1768 has 512kB of user-available FLASH (bootloader is located in separate dedicated region).
+# flash bank lpc1700 <base> <size> 0 0 <target#> <variant> <cclk> [calc_checksum]
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME lpc2000 0x0 0x80000 0 0 $_TARGETNAME lpc1700 80000 calc_checksum
+
+# 4MHz / 6 = 666kHz, so use 500
+jtag_khz 100
+#jtag_rclk 1000
+
diff --git a/nuttx/configs/nucleus2g/tools/usb-driver.txt b/nuttx/configs/nucleus2g/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/nucleus2g/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/nucleus2g/usbserial/Make.defs b/nuttx/configs/nucleus2g/usbserial/Make.defs
new file mode 100644
index 000000000..92f540a1f
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbserial/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/nucleus2g/usbserial/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/nucleus2g/usbserial/appconfig b/nuttx/configs/nucleus2g/usbserial/appconfig
new file mode 100644
index 000000000..fe16aa81f
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbserial/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/nucleus2g/usbserial/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbserial
+
diff --git a/nuttx/configs/nucleus2g/usbserial/defconfig b/nuttx/configs/nucleus2g/usbserial/defconfig
new file mode 100755
index 000000000..36b1ff47b
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbserial/defconfig
@@ -0,0 +1,457 @@
+############################################################################
+# configs/nucleus2g/usbserial/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="nucleus2g"
+CONFIG_ARCH_BOARD_NUCLEUS2G=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="usbserial_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=15
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=y
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/nucleus2g/usbserial/ld.script b/nuttx/configs/nucleus2g/usbserial/ld.script
new file mode 100755
index 000000000..2fa9249ff
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbserial/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/nucleus2g/usbserial/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/nucleus2g/usbserial/setenv.sh b/nuttx/configs/nucleus2g/usbserial/setenv.sh
new file mode 100755
index 000000000..9333b3a2f
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbserial/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/nucleus2g/usbserial/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/nucleus2g/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/nucleus2g/usbstorage/Make.defs b/nuttx/configs/nucleus2g/usbstorage/Make.defs
new file mode 100644
index 000000000..c71349c74
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbstorage/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/nucleus2g/usbstorage/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/nucleus2g/usbstorage/appconfig b/nuttx/configs/nucleus2g/usbstorage/appconfig
new file mode 100644
index 000000000..9653e14a3
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/nucleus2g/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/nucleus2g/usbstorage/defconfig b/nuttx/configs/nucleus2g/usbstorage/defconfig
new file mode 100755
index 000000000..5dfe47457
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbstorage/defconfig
@@ -0,0 +1,458 @@
+############################################################################
+# configs/nucleus2g/usbstorage/defconfig
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1768=y
+CONFIG_ARCH_BOARD="nucleus2g"
+CONFIG_ARCH_BOARD_NUCLEUS2G=y
+CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=y
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART1_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=15
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/nucleus2g/usbstorage/ld.script b/nuttx/configs/nucleus2g/usbstorage/ld.script
new file mode 100755
index 000000000..a1056f8a7
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbstorage/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/nucleus2g/usbstorage/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/nucleus2g/usbstorage/setenv.sh b/nuttx/configs/nucleus2g/usbstorage/setenv.sh
new file mode 100755
index 000000000..e6f7197fd
--- /dev/null
+++ b/nuttx/configs/nucleus2g/usbstorage/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/nucleus2g/usbstorage/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/nucleus2g/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/Kconfig b/nuttx/configs/olimex-lpc1766stk/Kconfig
new file mode 100644
index 000000000..b86dd2342
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_LPC1766STK
+endif
diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt
new file mode 100644
index 000000000..19cf66167
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/README.txt
@@ -0,0 +1,979 @@
+README
+^^^^^^
+
+README for NuttX port to the Olimex LPC1766-STK development board
+
+Contents
+^^^^^^^^
+
+ Olimex LPC1766-STK development board
+ Development Environment
+ GNU Toolchain Options
+ IDEs
+ NuttX buildroot Toolchain
+ LEDs
+ Using OpenOCD and GDB with an FT2232 JTAG emulator
+ Olimex LPC1766-STK Configuration Options
+ USB Host Configuration
+ Configurations
+
+Olimex LPC1766-STK development board
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ GPIO Usage:
+ -----------
+
+ GPIO PIN SIGNAL NAME
+ -------------------------------- ---- --------------
+ P0[0]/RD1/TXD3/SDA1 46 RD1
+ P0[1]/TD1/RXD3/SCL1 47 TD1
+ P0[2]/TXD0/AD0[7] 98 TXD0
+ P0[3]/RXD0/AD0[6] 99 RXD0
+ P0[4]/I2SRX_CLK/RD2/CAP2[0] 81 LED2/ACC IRQ
+ P0[5]/I2SRX_WS/TD2/CAP2[1] 80 CENTER
+ P0[6]/I2SRX_SDA/SSEL1/MAT2[0] 79 SSEL1
+ P0[7]/I2STX_CLK/SCK1/MAT2[1] 78 SCK1
+ P0[8]/I2STX_WS/MISO1/MAT2[2] 77 MISO1
+ P0[9]/I2STX_SDA/MOSI1/MAT2[3] 76 MOSI1
+ P0[10]/TXD2/SDA2/MAT3[0] 48 SDA2
+ P0[11]/RXD2/SCL2/MAT3[1] 49 SCL2
+ P0[15]/TXD1/SCK0/SCK 62 TXD1
+ P0[16]/RXD1/SSEL0/SSEL 63 RXD1
+ P0[17]/CTS1/MISO0/MISO 61 CTS1
+ P0[18]/DCD1/MOSI0/MOSI 60 DCD1
+ P0[19]/DSR1/SDA1 59 DSR1
+ P0[20]/DTR1/SCL1 58 DTR1
+ P0[21]/RI1/RD1 57 MMC PWR
+ P0[22]/RTS1/TD1 56 RTS1
+ P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] 9 BUT1
+ P0[24]/AD0[1]/I2SRX_WS/CAP3[1] 8 TEMP
+ P0[25]/AD0[2]/I2SRX_SDA/TXD3 7 MIC IN
+ P0[26]/AD0[3]/AOUT/RXD3 6 AOUT
+ P0[27]/SDA0/USB_SDA 25 USB_SDA
+ P0[28]/SCL0/USB_SCL 24 USB_SCL
+ P0[29]/USB_D+ 29 USB_D+
+ P0[30]/USB_D- 30 USB_D-
+ P1[0]/ENET_TXD0 95 E_TXD0
+ P1[1]/ENET_TXD1 94 E_TXD1
+ P1[4]/ENET_TX_EN 93 E_TX_EN
+ P1[8]/ENET_CRS 92 E_CRS
+ P1[9]/ENET_RXD0 91 E_RXD0
+ P1[10]/ENET_RXD1 90 E_RXD1
+ P1[14]/ENET_RX_ER 89 E_RX_ER
+ P1[15]/ENET_REF_CLK 88 E_REF_CLK
+ P1[16]/ENET_MDC 87 E_MDC
+ P1[17]/ENET_MDIO 86 E_MDIO
+ P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] 32 USB_UP_LED
+ P1[19]/MC0A/#USB_PPWR/CAP1[1] 33 #USB_PPWR
+ P1[20]/MCFB0/PWM1[2]/SCK0 34 SCK0
+ P1[21]/MCABORT/PWM1[3]/SSEL0 35 SSEL0
+ P1[22]/MC0B/USB_PWRD/MAT1[0] 36 USBH_PWRD
+ P1[23]/MCFB1/PWM1[4]/MISO0 37 MISO0
+ P1[24]/MCFB2/PWM1[5]/MOSI0 38 MOSI0
+ P1[25]/MC1A/MAT1[1] 39 LED1
+ P1[26]/MC1B/PWM1[6]/CAP0[0] 40 CS_UEXT
+ P1[27]/CLKOUT/#USB_OVRCR/CAP0[1] 43 #USB_OVRCR
+ P1[28]/MC2A/PCAP1[0]/MAT0[0] 44 P1.28
+ P1[29]/MC2B/PCAP1[1]/MAT0[1] 45 P1.29
+ P1[30]/VBUS/AD0[4] 21 VBUS
+ P1[31]/SCK1/AD0[5] 20 AIN5
+ P2[0]/PWM1[1]/TXD1 75 UP
+ P2[1]/PWM1[2]/RXD1 74 DOWN
+ P2[2]/PWM1[3]/CTS1/TRACEDATA[3] 73 TRACE_D3
+ P2[3]/PWM1[4]/DCD1/TRACEDATA[2] 70 TRACE_D2
+ P2[4]/PWM1[5]/DSR1/TRACEDATA[1] 69 TRACE_D1
+ P2[5]/PWM1[6]/DTR1/TRACEDATA[0] 68 TRACE_D0
+ P2[6]/PCAP1[0]/RI1/TRACECLK 67 TRACE_CLK
+ P2[7]/RD2/RTS1 66 LEFT
+ P2[8]/TD2/TXD2 65 RIGHT
+ P2[9]/USB_CONNECT/RXD2 64 USBD_CONNECT
+ P2[10]/#EINT0/NMI 53 ISP_E4
+ P2[11]/#EINT1/I2STX_CLK 52 #EINT1
+ P2[12]/#EINT2/I2STX_WS 51 WAKE-UP
+ P2[13]/#EINT3/I2STX_SDA 50 BUT2
+ P3[25]/MAT0[0]/PWM1[2] 27 LCD_RST
+ P3[26]/STCLK/MAT0[1]/PWM1[3] 26 LCD_BL
+
+ Serial Console
+ --------------
+
+ The LPC1766-STK board has two serial connectors. One, RS232_0, connects to
+ the LPC1766 UART0. This is the DB-9 connector next to the power connector.
+ The other RS232_1, connect to the LPC1766 UART1. This is he DB-9 connector
+ next to the Ethernet connector.
+
+ Simple UART1 is the more flexible UART and since the needs for a serial
+ console are minimal, the more minimal UART0/RS232_0 is used for the NuttX
+ system console. Of course, this can be changed by editting the NuttX
+ configuration file as discussed below.
+
+ The serial console is configured as follows (57600 8N1):
+
+ BAUD: 57600
+ Number of Bits: 8
+ Parity: None
+ Stop bits: 1
+
+ You will need to connect a monitor program (Hyperterminal, Tera Term,
+ minicom, whatever) to UART0/RS232_0 and configure the serial port as
+ shown above.
+
+ NOTE: The ostest example works fine at 115200, but the other configurations
+ have problems at that rate (probably because they use the interrupt driven
+ serial driver). Other LPC17xx boards with the same clocking will run at
+ 115200.
+
+ LCD
+ ---
+
+ The LPC1766-STK has a Nokia 6100 132x132 LCD and either a Phillips PCF8833
+ or an Epson S1D15G10 LCD controller. The NuttX configuration may have to
+ be adjusted depending on which controller is used with the LCD. The
+ "LPC1766-STK development board Users Manual" states tha the board features
+ a "LCD NOKIA 6610 128x128 x12bit color TFT with Epson LCD controller."
+ But, referring to a different Olimex board, "Nokia 6100 LCD Display
+ Driver," Revision 1, James P. Lynch ("Nokia 6100 LCD Display Driver.pdf")
+ says:
+
+ "The major irritant in using this display is identifying the graphics
+ controller; there are two possibilities (Epson S1D15G00 or Philips
+ PCF8833). The LCD display sold by the German Web Shop Jelu has a Leadis
+ LDS176 controller but it is 100% compatible with the Philips PCF8833).
+ So how do you tell which controller you have? Some message boards have
+ suggested that the LCD display be disassembled and the controller chip
+ measured with a digital caliper – well that’s getting a bit extreme.
+
+ "Here’s what I know. The Olimex boards have both display controllers
+ possible; if the LCD has a GE-12 sticker on it, it’s a Philips PCF8833.
+ If it has a GE-8 sticker, it’s an Epson controller. The older Sparkfun
+ 6100 displays were Epson, their web site indicates that the newer ones
+ are an Epson clone. Sparkfun software examples sometimes refer to the
+ Philips controller so the whole issue has become a bit murky. The
+ trading companies in Honk Kong have no idea what is inside the displays
+ they are selling. A Nokia 6100 display that I purchased from Hong Kong
+ a couple of weeks ago had the Philips controller."
+
+ The LCD connects to the LPC1766 via SPI and two GPIOs. The two GPIOs are
+ noted above:
+
+ P1.21 is the SPI chip select, and
+ P3.25 is the LCD reset
+ P3.26 is PWM1 output used to control the backlight intensity.
+
+ MISO0 and MOSI0 are join via a 1K ohm resistor so the LCD appears to be
+ write only.
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery or devkitARM toolchain, you simply need add one of the
+ following configuration options to your .config (or defconfig) file:
+
+ CONFIG_LPC17_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LPC17_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_LPC17_DEVKITARM=y : devkitARM under Windows
+ CONFIG_LPC17_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_LPC17_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows)and devkitARM are Windows native toolchains.
+ The CodeSourcey (for Linux) and NuttX buildroot toolchains are Cygwin and/or
+ Linux native toolchains. There are several limitations to using a Windows based
+ toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/lpc17xx,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/lpc17x/lpc17_vectors.S.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh olimex-lpc1766stk/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a Cortex-M3 toolchain for Cygwin under Windows.
+
+ NOTE: This is an OABI toolchain.
+
+LEDs
+^^^^
+
+ If CONFIG_ARCH_LEDS is defined, then support for the LPC1766-STK LEDs will be
+ included in the build. See:
+
+ - configs/olimex-lpc1766stk/include/board.h - Defines LED constants, types and
+ prototypes the LED interface functions.
+
+ - configs/olimex-lpc1766stk/src/lpc1766stk_internal.h - GPIO settings for the LEDs.
+
+ - configs/olimex-lpc1766stk/src/up_leds.c - LED control logic.
+
+ The LPC1766-STK has two LEDs. If CONFIG_ARCH_LEDS is defined, these LEDs will
+ be controlled as follows for NuttX debug functionality (where NC means "No Change").
+ Basically,
+
+ LED1:
+ - OFF means that the OS is still initializing. Initialization is very fast so
+ if you see this at all, it probably means that the system is hanging up
+ somewhere in the initialization phases.
+ - ON means that the OS completed initialization.
+ - Glowing means that the LPC17 is running in a reduced power mode: LED1 is
+ turned off when the processor enters sleep mode and back on when it wakesup
+ up.
+
+ LED2:
+ - ON/OFF toggles means that various events are happening.
+ - GLowing: LED2 is turned on and off on every interrupt so even timer interrupts
+ should cause LED2 to glow faintly in the normal case.
+ - Flashing. If the LED2 is flashing at about 2Hz, that means that a crash
+ has occurred. If CONFIG_ARCH_STACKDUMP=y, you will get some diagnostic
+ information on the console to help debug what happened.
+
+ NOTE: LED2 is controlled by a jumper labeled: ACC_IRQ/LED2. That jump must be
+ in the LED2 position in order to support LED2.
+
+ LED1 LED2 Meaning
+ ------- -------- --------------------------------------------------------------------
+ OFF OFF Still initializing and there is no interrupt activity.
+ Initialization is very fast so if you see this, it probably means
+ that the system is hung up somewhere in the initialization phases.
+ OFF Glowing Still initializing (see above) but taking interrupts.
+ OFF ON This would mean that (1) initialization did not complete but the
+ software is hung, perhaps in an infinite loop, somewhere inside
+ of an interrupt handler.
+ OFF Flashing Ooops! We crashed before finishing initialization (or, perhaps
+ after initialization, during an interrupt while the LPC17xx was
+ sleeping -- see below).
+
+ ON OFF The system has completed initialization, but is apparently not taking
+ any interrupts.
+ ON Glowing The OS successfully initialized and is taking interrupts (but, for
+ some reason, is never entering a reduced power mode -- perhaps the
+ CPU is very busy?).
+ ON ON This would mean that (1) the OS complete initialization, but (2)
+ the software is hung, perhaps in an infinite loop, somewhere inside
+ of a signal or interrupt handler.
+ Glowing Glowing This is also a normal healthy state: The OS successfully initialized,
+ is running in reduced power mode, but taking interrupts. The glow
+ is very faint and you may have to dim the lights to see that LEDs are
+ active at all! See note below.
+ ON Flashing Ooops! We crashed sometime after initialization.
+
+ NOTE: In glowing/glowing case, you get some good subjective information about the
+ behavior of your system by looking at the level of the LED glow (or better, by
+ connecting O-Scope and calculating the actual duty):
+
+ 1. The intensity of the glow is determined by the duty of LED on/off toggle --
+ as the ON period becomes larger with respect the OFF period, the LED will
+ glow more brightly.
+ 2. LED2 is turned ON when entering an interrupt and turned OFF when returning from
+ the interrupt. A brighter LED2 means that the system is spending more time in
+ interrupt handling.
+ 3. LED1 is turned OFF just before the processor goes to sleep. The processor
+ sleeps until awakened by an interrupt. LED1 is turned back ON after the
+ processor is re-awakened -- actually after returning from the interrupt that
+ cause the processor to re-awaken (LED1 will be off during the execution of
+ that interrupt). So a brighter LED1 means that the processor is spending
+ less time sleeping.
+
+ When my STM32 sits IDLE -- doing absolutely nothing but processing timer interrupts --
+ I see the following:
+
+ 1. LED1 glows dimly due to the timer interrupts.
+ 2. But LED2 is even more dim! The LED ON time excludes the time processing the
+ interrupt that re-awakens the processing. So this tells me that the STM32 is
+ spending more time processing timer interrupts than doing any other kind of
+ processing. That, of course, makes sense if the system is truly idle and only
+ processing timer interrupts.
+
+Using OpenOCD and GDB with an FT2232 JTAG emulator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ Downloading OpenOCD
+
+ You can get information about OpenOCD here: http://openocd.berlios.de/web/
+ and you can download it from here. http://sourceforge.net/projects/openocd/files/.
+ To get the latest OpenOCD with more mature lpc17xx, you have to download
+ from the GIT archive.
+
+ git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
+
+ At present, there is only the older, frozen 0.4.0 version. These, of course,
+ may have changed since I wrote this.
+
+ Building OpenOCD under Cygwin:
+
+ You can build OpenOCD for Windows using the Cygwin tools. Below are a
+ few notes that worked as of November 7, 2010. Things may have changed
+ by the time you read this, but perhaps the following will be helpful to
+ you:
+
+ 1. Install Cygwin (http://www.cygwin.com/). My recommendation is to install
+ everything. There are many tools you will need and it is best just to
+ waste a little disk space and have everthing you need. Everything will
+ require a couple of gigbytes of disk space.
+
+ 2. Create a directory /home/OpenOCD.
+
+ 3. Get the FT2232 drivr from http://www.ftdichip.com/Drivers/D2XX.htm and
+ extract it into /home/OpenOCD/ftd2xx
+
+ $ pwd
+ /home/OpenOCD
+ $ ls
+ CDM20802 WHQL Certified.zip
+ $ mkdir ftd2xx
+ $ cd ftd2xx
+ $ unzip ..CDM20802\ WHQL\ Certified.zip
+ Archive: CDM20802 WHQL Certified.zip
+ ...
+
+ 3. Get the latest OpenOCD source
+
+ $ pwd
+ /home/OpenOCD
+ $ git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
+
+ You will then have the source code in /home/OpenOCD/openocd
+
+ 4. Build OpenOCD for the FT22322 interface
+
+ $ pwd
+ /home/OpenOCD/openocd
+ $ ./bootstrap
+
+ Jim is a tiny version of the Tcl scripting language. It is needed
+ by more recent versions of OpenOCD. Build libjim.a using the following
+ instructions:
+
+ $ git submodule init
+ $ git submodule update
+ $ cd jimtcl
+ $ ./configure --with-jim-ext=nvp
+ $ make
+ $ make install
+
+ Configure OpenOCD:
+
+ $ ./configure --enable-maintainer-mode --disable-werror --disable-shared \
+ --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/OpenOCD/ftd2xx \
+ LDFLAGS="-L/home/OpenOCD/openocd/jimtcl"
+
+ Then build OpenOCD and its HTML documentation:
+
+ $ make
+ $ make html
+
+ The result of the first make will be the "openocd.exe" will be
+ created in the folder /home/openocd/src. The following command
+ will install OpenOCD to a standard location (/usr/local/bin)
+ using using this command:
+
+ $ make install
+
+ Helper Scripts.
+
+ I have been using the Olimex ARM-USB-OCD JTAG debugger with the
+ LPC1766-STK (http://www.olimex.com). OpenOCD requires a configuration
+ file. I keep the one I used last here:
+
+ configs/olimex-lpc1766stk/tools/olimex.cfg
+
+ However, the "correct" configuration script to use with OpenOCD may
+ change as the features of OpenOCD evolve. So you should at least
+ compare that olimex.cfg file with configuration files in
+ /usr/local/share/openocd/scripts/target (or /home/OpenOCD/openocd/tcl/target).
+ As of this writing, there is no script for the lpc1766, but the
+ lpc1768 configurtion can be used after changing the flash size to
+ 256Kb. That is, change:
+
+ flash bank $_FLASHNAME lpc2000 0x0 0x80000 0 0 $_TARGETNAME ...
+
+ To:
+
+ flash bank $_FLASHNAME lpc2000 0x0 0x40000 0 0 $_TARGETNAME ...
+
+ There is also a script on the tools/ directory that I use to start
+ the OpenOCD daemon on my system called oocd.sh. That script will
+ probably require some modifications to work in another environment:
+
+ - Possibly the value of OPENOCD_PATH and TARGET_PATH
+ - It assumes that the correct script to use is the one at
+ configs/olimex-lpc1766stk/tools/olimex.cfg
+
+ Starting OpenOCD
+
+ Then you should be able to start the OpenOCD daemon like:
+
+ configs/olimex-lpc1766stk/tools/oocd.sh $PWD
+
+ If you use the setenv.sh file, that the path to oocd.sh will be added
+ to your PATH environment variabl. So, in that case, the command simplifies
+ to just:
+
+ oocd.sh $PWD
+
+ Where it is assumed that you are executing oocd.sh from the top-level
+ directory where NuttX is installed. $PWD will be the path to the
+ top-level NuttX directory.
+
+ Connecting GDB
+
+ Once the OpenOCD daemon has been started, you can connect to it via
+ GDB using the following GDB command:
+
+ arm-elf-gdb
+ (gdb) target remote localhost:3333
+
+ NOTE: The name of your GDB program may differ. For example, with the
+ CodeSourcery toolchain, the ARM GDB would be called arm-none-eabi-gdb.
+
+ After starting GDB, you can load the NuttX ELF file:
+
+ (gdb) symbol-file nuttx
+ (gdb) load nuttx
+
+ NOTES:
+ 1. Loading the symbol-file is only useful if you have built NuttX to
+ inclulde debug symbols (by setting CONFIG_DEBUG_SYMBOLS=y in the
+ .config file).
+ 2. I usually have to reset, halt, and 'load nuttx' a second time. For
+ some reason, the first time apparently does not fully program the
+ FLASH.
+ 3. The MCU must be halted prior to loading code using 'mon reset'
+ as described below.
+
+ OpenOCD will support several special 'monitor' commands. These
+ GDB commands will send comments to the OpenOCD monitor. Here
+ are a couple that you will need to use:
+
+ (gdb) monitor reset
+ (gdb) monitor halt
+
+ NOTES:
+ 1. The MCU must be halted using 'mon halt' prior to loading code.
+ 2. Reset will restart the processor after loading code.
+ 3. The 'monitor' command can be abbreviated as just 'mon'.
+
+Olimex LPC1766-STK Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=lpc17xx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_LPC1766=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=olimex-lpc1766stk (for the Olimex LPC1766-STK)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_LPC1766STK=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x10000000
+
+ CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_LPC17_MAINOSC=y
+ CONFIG_LPC17_PLL0=y
+ CONFIG_LPC17_PLL1=n
+ CONFIG_LPC17_ETHERNET=n
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_LPC17_USBOTG=n
+ CONFIG_LPC17_USBDEV=n
+ CONFIG_LPC17_UART0=y
+ CONFIG_LPC17_UART1=n
+ CONFIG_LPC17_UART2=n
+ CONFIG_LPC17_UART3=n
+ CONFIG_LPC17_CAN1=n
+ CONFIG_LPC17_CAN2=n
+ CONFIG_LPC17_SPI=n
+ CONFIG_LPC17_SSP0=n
+ CONFIG_LPC17_SSP1=n
+ CONFIG_LPC17_I2C0=n
+ CONFIG_LPC17_I2C1=n
+ CONFIG_LPC17_I2S=n
+ CONFIG_LPC17_TMR0=n
+ CONFIG_LPC17_TMR1=n
+ CONFIG_LPC17_TMR2=n
+ CONFIG_LPC17_TMR3=n
+ CONFIG_LPC17_RIT=n
+ CONFIG_LPC17_PWM=n
+ CONFIG_LPC17_MCPWM=n
+ CONFIG_LPC17_QEI=n
+ CONFIG_LPC17_RTC=n
+ CONFIG_LPC17_WDT=n
+ CONFIG_LPC17_ADC=n
+ CONFIG_LPC17_DAC=n
+ CONFIG_LPC17_GPDMA=n
+ CONFIG_LPC17_FLASH=n
+
+ LPC17xx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ LPC17xx specific CAN device driver settings. These settings all
+ require CONFIG_CAN:
+
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
+ CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
+ (the CCLK frequency is divided by this number to get the CAN clock).
+ Options = {1,2,4,6}. Default: 4.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+
+ LPC17xx specific PHY/Ethernet device driver settings. These setting
+ also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
+
+ CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+
+ CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ LPC17xx USB Device Configuration
+
+ CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
+ Handle USB Start-Of-Frame events.
+ Enable reading SOF from interrupt handler vs. simply reading on demand.
+ Probably a bad idea... Unless there is some issue with sampling the SOF
+ from hardware asynchronously.
+ CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
+ Enable high priority interrupts. I have no idea why you might want to
+ do that
+ CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
+ Number of DMA descriptors to allocate in SRAM.
+ CONFIG_LPC17_USBDEV_DMA
+ Enable lpc17xx-specific DMA support
+ CONFIG_LPC17_USBDEV_NOVBUS
+ Define if the hardware implementation does not support the VBUS signal
+ CONFIG_LPC17_USBDEV_NOLED
+ Define if the hardware implementation does not support the LED output
+
+ LPC17xx USB Host Configuration
+ CONFIG_USBHOST_OHCIRAM_SIZE
+ Total size of OHCI RAM (in AHB SRAM Bank 1)
+ CONFIG_USBHOST_NEDS
+ Number of endpoint descriptors
+ CONFIG_USBHOST_NTDS
+ Number of transfer descriptors
+ CONFIG_USBHOST_TDBUFFERS
+ Number of transfer descriptor buffers
+ CONFIG_USBHOST_TDBUFSIZE
+ Size of one transfer descriptor buffer
+ CONFIG_USBHOST_IOBUFSIZE
+ Size of one end-user I/O buffer. This can be zero if the
+ application can guarantee that all end-user I/O buffers
+ reside in AHB SRAM.
+
+USB Host Configuration
+^^^^^^^^^^^^^^^^^^^^^^
+
+The NuttShell (NSH) Nucleus 2G can be modified in order to support
+USB host operations. To make these modifications, do the following:
+
+1. First configure to build the NSH configuration from the top-level
+ NuttX directory:
+
+ cd tools
+ ./configure nucleus2g/nsh
+ cd ..
+
+2. Then edit the top-level .config file to enable USB host. Make the
+ following changes:
+
+ CONFIG_LPC17_USBHOST=n
+ CONFIG_USBHOST=n
+ CONFIG_SCHED_WORKQUEUE=y
+
+When this change is made, NSH should be extended to support USB flash
+devices. When a FLASH device is inserted, you should see a device
+appear in the /dev (pseudo) directory. The device name should be
+like /dev/sda, /dev/sdb, etc. The USB mass storage device, is present
+it can be mounted from the NSH command line like:
+
+ ls /dev
+ mount -t vfat /dev/sda /mnt/flash
+
+Files on the connect USB flash device should then be accessible under
+the mountpoint /mnt/flash.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Olimex LPC1766-STK configuration is maintained in a
+sudirectory and can be selected as follow:
+
+ cd tools
+ ./configure.sh olimex-lpc1766stk/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ftpc:
+ This is a simple FTP client shell used to exercise the capabilities
+ of the FTPC library (apps/netutils/ftpc). This example is configured
+ to that it will only work as a "built-in" program that can be run from
+ NSH when CONFIG_NSH_BUILTIN_APPS is defined.
+
+ From NSH, the startup command sequence is then:
+
+ nsh> mount -t vfat /dev/mmcsd0 /tmp # Mount the SD card at /tmp
+ nsh> cd /tmp # cd into the /tmp directory
+ nsh> ftpc xx.xx.xx.xx[:pp] # Start the FTP client
+ nfc> login <name> <password> # Log into the FTP server
+ nfc> help # See a list of FTP commands
+
+ where xx.xx.xx.xx is the IP address of the FTP server and pp is an
+ optional port number (default is the standard FTP port number 21).
+
+ NOTES:
+
+ 1. Support for FAT long file names is built-in but can easily be
+ removed if you are concerned about Microsoft patent issues (see the
+ section "FAT Long File Names" in the top-level COPYING file).
+
+ CONFIG_FS_FAT=y
+ CONFIG_FAT_LCNAMES=y <-- Long file name support
+ CONFIG_FAT_LFN=y
+ CONFIG_FAT_MAXFNAME=32
+ CONFIG_FS_NXFFS=n
+ CONFIG_FS_ROMFS=n
+
+ 2. You may also want to define the following in your configuration file.
+ Otherwise, you will have not feedback about what is going on:
+
+ CONFIG_DEBUG=y
+ CONFIG_DEBUG_VERBOSE=y
+ CONFIG_DEBUG_FTPC=y
+
+ hidkbd:
+ This configuration directory, performs a simple test of the USB host
+ HID keyboard class driver using the test logic in apps/examples/hidkbd.
+
+ nettest:
+ This configuration directory may be used to enable networking using the
+ LPC17xx's Ethernet controller. It uses apps/examples/nettest to excercise the
+ TCP/IP network.
+
+ nsh:
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+ Support for the board's SPI-based MicroSD card is included.
+
+ NOTE: If you start the program with no SD card inserted, there will be
+ a substantial delay. This is because there is no hardware support to sense
+ whether or not an SD card is inserted. As a result, the driver has to
+ go through many retries and timeouts before it finally decides that there
+ is not SD card in the slot.
+
+ Configuration Notes:
+
+ 1. Uses the buildroot toolchaing (CONFIG_LPC17_BUILDROOT=y). But that is
+ easily reconfigured (see above)
+ 2. Support for FAT long file names is built-in but can easily be
+ removed if you are concerned about Microsoft patent issues (see the
+ section "FAT Long File Names" in the top-level COPYING file).
+
+ CONFIG_FS_FAT=y
+ CONFIG_FAT_LCNAMES=y <-- Long file name support
+ CONFIG_FAT_LFN=y
+ CONFIG_FAT_MAXFNAME=32
+ CONFIG_FS_NXFFS=n
+ CONFIG_FS_ROMFS=n
+
+ 3. Includes logic to support a button test (apps/examples/buttons). To
+ enable the button test, make the following changes in the .config
+ after configuring:
+
+ -CONFIG_ARCH_BUTTONS=n
+ +CONFIG_ARCH_BUTTONS=y
+
+ -CONFIG_GPIO_IRQ=n
+ -CONFIG_ARCH_IRQBUTTONS=n
+ +CONFIG_GPIO_IRQ=y
+ +CONFIG_ARCH_IRQBUTTONS=y
+
+ 4. This example supports the CAN loopback test (apps/examples/can) but this
+ must be manually enabled by selecting:
+
+ CONFIG_CAN=y : Enable the generic CAN infrastructure
+ CONFIG_LPC17_CAN1=y : Enable CAN1
+ CONFIG_CAN_LOOPBACK=y : Enable CAN loopback mode
+
+ See also apps/examples/README.txt
+
+ Special CAN-only debug options:
+
+ CONFIG_DEBUG_CAN
+ CONFIG_CAN_REGDEBUG
+
+ nx:
+ An example using the NuttX graphics system (NX). This example uses
+ the Nokia 6100 LCD driver. NOTE: The Nokia 6100 driver does not
+ work on this board as of this writing.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ slip-httpd:
+ This configuration is identical to the thttpd configuration except that
+ it uses the SLIP data link layer via a serial driver instead of the
+ Ethernet data link layer. The Ethernet driver is disabled; SLIP IP
+ packets are exchanged on UART1; UART0 is still the serial console.
+
+ 1. Configure and build the slip-httpd configuration.
+ 2. Connect to a Linux box (assuming /dev/ttyS0)
+ 3. Reset on the target side and attach SLIP on the Linux side:
+
+ $ modprobe slip
+ $ slattach -L -p slip -s 57600 /dev/ttyS0 &
+
+ This should create an interface with a name like sl0, or sl1, etc.
+ Add -d to get debug output. This will show the interface name.
+
+ NOTE: The -L option is included to suppress use of hardware flow
+ control. This is necessary because I haven't figured out how to
+ use the UART1 hardware flow control yet.
+
+ NOTE: The Linux slip module hard-codes its MTU size to 296. So you
+ might as well set CONFIG_NET_BUFSIZE to 296 as well.
+
+ 4. After turning over the line to the SLIP driver, you must configure
+ the network interface. Again, you do this using the standard
+ ifconfig and route commands. Assume that we have connected to a
+ host PC with address 192.168.0.101 from your target with address
+ 10.0.0.2. On the Linux PC you would execute the following as root:
+
+ $ ifconfig sl0 10.0.0.1 pointopoint 10.0.0.2 up
+ $ route add 10.0.0.2 dev sl0
+
+ Assuming the SLIP is attached to device sl0.
+
+ 5. For monitoring/debugging traffic:
+
+ $ tcpdump -n -nn -i sl0 -x -X -s 1500
+
+ NOTE: Only UART1 supports the hardware handshake. If hardware
+ handshake is not available, then you might try the slattach option
+ -L which is supposed to enable "3-wire operation."
+
+ NOTE: This configurat only works with VERBOSE debug disabled. For some
+ reason, certain debug statements hang(?).
+
+ NOTE: This example does not use UART1's hardware flow control. UART1
+ hardware flow control is partially implemented but does not behave as
+ expected. It needs a little more work.
+
+ thttpd:
+ This builds the THTTPD web server example using the THTTPD and
+ the apps/examples/thttpd application.
+
+ usbserial:
+ This configuration directory exercises the USB serial class
+ driver at apps/examples/usbserial. See apps/examples/README.txt for
+ more information.
+
+ usbstorage:
+ This configuration directory exercises the USB mass storage
+ class driver at apps/examples/usbstorage. See apps/examples/README.txt
+ for more information.
+
diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/Make.defs b/nuttx/configs/olimex-lpc1766stk/ftpc/Make.defs
new file mode 100644
index 000000000..178287e8a
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ftpc/Make.defs
@@ -0,0 +1,166 @@
+############################################################################
+# configs/olimex-lpc1766stk/ftpc/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ftpc/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ftpc/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/appconfig b/nuttx/configs/olimex-lpc1766stk/ftpc/appconfig
new file mode 100644
index 000000000..41b612b3e
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ftpc/appconfig
@@ -0,0 +1,57 @@
+############################################################################
+# configs/olimex-lpc1766stk/ftpc/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# Built-in applications
+
+CONFIGURED_APPS += examples/ftpc
+
+# NSH and FTPC libraries
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+CONFIGURED_APPS += netutils/ftpc
+
+# Optional networking support
+
+CONFIGURED_APPS += netutils/uiplib
+
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+
diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig
new file mode 100755
index 000000000..c34f0b999
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig
@@ -0,0 +1,548 @@
+############################################################################
+# configs/olimex-lpc1766stk/ftpc/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=y
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_EMACRAM_SIZE=8448
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ftpc_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_FTPC=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=2
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=576
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=n
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=1536
+CONFIG_USBHOST_NEDS=2
+CONFIG_USBHOST_NTDS=3
+CONFIG_USBHOST_TDBUFFERS=3
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=512
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# THTTPD settings
+#
+CONFIG_THTTPD_PORT=80
+CONFIG_THTTPD_IPADDR=0x0a000002
+CONFIG_THTTPD_SERVER_ADDRESS="http://www.nuttx.org"
+CONFIG_THTTPD_SERVER_SOFTWARE="thttpd/2.25b 29dec2003-NuttX"
+CONFIG_THTTPD_PATH="/mnt/www"
+CONFIG_THTTPD_CGI_PATH="/mnt/www/cgi-bin"
+CONFIG_THTTPD_CGI_PATTERN="/mnt/www/cgi-bin/*"
+CONFIG_THTTPD_CGI_PRIORITY=50
+CONFIG_THTTPD_CGI_STACKSIZE=1024
+CONFIG_THTTPD_CGI_BYTECOUNT=20000
+CONFIG_THTTPD_CGI_TIMELIMIT=0
+CONFIG_THTTPD_CHARSET="iso-8859-1"
+CONFIG_THTTPD_IOBUFFERSIZE=1024
+#CONFIG_THTTPD_INDEX_NAMES
+CONFIG_AUTH_FILE=n
+CONFIG_THTTPD_LISTEN_BACKLOG=8
+CONFIG_THTTPD_LINGER_MSEC=500
+CONFIG_THTTPD_OCCASIONAL_MSEC=120
+CONFIG_THTTPD_IDLE_READ_LIMIT_SEC=300
+CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC=300
+CONFIG_THTTPD_TILDE_MAP1=n
+CONFIG_THTTPD_TILDE_MAP2=n
+CONFIG_THTTPD_GENERATE_INDICES=n
+CONFIG_THTTPD_URLPATTERN=n
+
+#
+# Additional settings for examples/thttpd
+#
+CONFIG_EXAMPLE_THTTPD_NOMAC=y
+CONFIG_EXAMPLE_THTTPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_THTTPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+# Disable several other NSH commands (this is only for testing FTPC)
+CONFIG_NSH_DISABLE_WGET=y
+CONFIG_NSH_DISABLE_PUT=y
+CONFIG_NSH_DISABLE_GET=y
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/ld.script b/nuttx/configs/olimex-lpc1766stk/ftpc/ld.script
new file mode 100755
index 000000000..59b80c9bd
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ftpc/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/ftpc/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/setenv.sh b/nuttx/configs/olimex-lpc1766stk/ftpc/setenv.sh
new file mode 100755
index 000000000..85d20db32
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ftpc/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/ftpc/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/Make.defs b/nuttx/configs/olimex-lpc1766stk/hidkbd/Make.defs
new file mode 100644
index 000000000..50c8515ce
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/hidkbd/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hidkbd/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hidkbd/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig
new file mode 100644
index 000000000..79a7c50ab
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-lpc1766stk/hidkbd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/hidkbd
+
diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig
new file mode 100755
index 000000000..10dc25101
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig
@@ -0,0 +1,499 @@
+############################################################################
+# configs/olimex-lpc1766stk/hidkbd/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=y
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_EMACRAM_SIZE=8192
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="hidkbd_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=y
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=y
+CONFIG_USBHOST_INT_DISABLE=n
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=1536
+CONFIG_USBHOST_NEDS=2
+CONFIG_USBHOST_NTDS=3
+CONFIG_USBHOST_TDBUFFERS=3
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=512
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/ld.script b/nuttx/configs/olimex-lpc1766stk/hidkbd/ld.script
new file mode 100755
index 000000000..c6c97d402
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/hidkbd/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh b/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh
new file mode 100755
index 000000000..7bdba25d7
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/hidkbd/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/include/board.h b/nuttx/configs/olimex-lpc1766stk/include/board.h
new file mode 100644
index 000000000..94fd74fee
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/include/board.h
@@ -0,0 +1,462 @@
+/************************************************************************************
+ * configs/olimex-lpc1766stk/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+# include <nuttx/irq.h>
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Clocking *************************************************************************/
+/* NOTE: The following definitions require lpc17_syscon.h. It is not included here
+ * because the including C file may not have that file in its include path.
+ */
+
+#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
+#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
+#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency */
+#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
+
+/* This is the clock setup we configure for:
+ *
+ * SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
+ * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6
+ */
+
+#define LPC17_CCLK 80000000 /* 80Mhz */
+
+/* Select the main oscillator as the frequency source. SYSCLK is then the frequency
+ * of the main oscillator.
+ */
+
+#undef CONFIG_LPC17_MAINOSC
+#define CONFIG_LPC17_MAINOSC 1
+#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
+
+/* Select the main oscillator and CCLK divider. The output of the divider is CCLK.
+ * The input to the divider (PLLCLK) will be determined by the PLL output.
+ */
+
+#define BOARD_CCLKCFG_DIVIDER 6
+#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
+
+/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
+ *
+ * Source clock: Main oscillator
+ * PLL0 Multiplier value (M): 20
+ * PLL0 Pre-divider value (N): 1
+ *
+ * PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
+ */
+
+#undef CONFIG_LPC17_PLL0
+#define CONFIG_LPC17_PLL0 1
+#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
+
+#define BOARD_PLL0CFG_MSEL 20
+#define BOARD_PLL0CFG_NSEL 1
+#define BOARD_PLL0CFG_VALUE \
+ (((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
+
+/* PLL1 -- Not used. */
+
+#undef CONFIG_LPC17_PLL1
+#define BOARD_PLL1CFG_MSEL 36
+#define BOARD_PLL1CFG_NSEL 1
+#define BOARD_PLL1CFG_VALUE \
+ (((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
+ ((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
+
+/* USB divider. This divider is used when PLL1 is not enabled to get the
+ * USB clock from PLL0:
+ *
+ * USBCLK = PLL0CLK / 10 = 48MHz
+ */
+
+#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
+
+/* FLASH Configuration */
+
+#undef CONFIG_LP17_FLASH
+#define CONFIG_LP17_FLASH 1
+#define BOARD_FLASHCFG_VALUE 0x0000303a
+
+/* Ethernet configuration */
+
+//#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV44
+#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV20
+
+/* LED definitions ******************************************************************/
+/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
+ * any way. The following definitions are used to access individual LEDs.
+ *
+ * LED1 -- Connected to P1[25]
+ * LED2 -- Connected to P0[4]
+ */
+
+/* LED index values for use with lpc17_setled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_NLEDS 2
+
+/* LED bits for use with lpc17_setleds() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 3 LEDs
+ * on board the Olimex LPC1766-STK. The following definitions
+ * describe how NuttX controls the LEDs:
+ */
+ /* LED1 LED2 */
+#define LED_STARTED 0 /* OFF OFF = Still initializing */
+#define LED_HEAPALLOCATE 0 /* OFF OFF = Still initializing */
+#define LED_IRQSENABLED 0 /* OFF OFF = Still initializing */
+#define LED_STACKCREATED 1 /* ON OFF = Initialization complete */
+#define LED_INIRQ 2 /* N/C ON = In an interrupt handler */
+#define LED_SIGNAL 2 /* N/C ON = In a signal handler (glowing) */
+#define LED_ASSERTION 2 /* N/C ON = In an assertion */
+#define LED_PANIC 2 /* N/C ON = Oops! We crashed. (flashing) */
+#define LED_IDLE 3 /* OFF N/C = LPC17 in sleep mode (LED1 glowing) */
+
+/* Button definitions ***************************************************************/
+/* The LPC1766-STK supports several buttons. All will read "1" when open and "0"
+ * when closed
+ *
+ * BUT1 -- Connected to P0[23]
+ * BUT2 -- Connected to P2[13]
+ * WAKE-UP -- Connected to P2[12]
+ *
+ * And a Joystick
+ *
+ * CENTER -- Connected to P0[4]
+ * DOWN -- Connected to P2[1]
+ * LEFT -- Connected to P2[7]
+ * RIGHT -- Connected to P2[8]
+ * UP -- Connected to P2[0]
+ */
+
+#define BOARD_BUTTON_1 0
+#define BOARD_BUTTON_2 1
+#define BOARD_BUTTON_WAKEUP 2
+
+#define BOARD_JOYSTICK_CENTER 3
+#define BOARD_JOYSTICK_UP 4
+#define BOARD_JOYSTICK_DOWN 5
+#define BOARD_JOYSTICK_LEFT 6
+#define BOARD_JOYSTICK_RIGHT 7
+
+#define BOARD_NUM_BUTTONS 8
+
+#define BOARD_BUTTON_BUTTON1_BIT (1 << BOARD_BUTTON_1)
+#define BOARD_BUTTON_BUTTON2_BIT (1 << BOARD_BUTTON_2)
+#define BOARD_BUTTON_WAKEUP_BIT (1 << BOARD_BUTTON_WAKEUP)
+
+#define BOARD_JOYSTICK_CENTER_BIT (1 << BOARD_JOYSTICK_CENTER)
+#define BOARD_JOYSTICK_UP_BIT (1 << BOARD_JOYSTICK_UP)
+#define BOARD_JOYSTICK_DOWN_BIT (1 << BOARD_JOYSTICK_DOWN)
+#define BOARD_JOYSTICK_LEFT_BIT (1 << BOARD_JOYSTICK_LEFT)
+#define BOARD_JOYSTICK_RIGHT_BIT (1 << BOARD_JOYSTICK_RIGHT)
+
+/* Alternate pin selections *********************************************************/
+
+/* CAN1 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[0]/RD1/TXD3/SDA1 46 RD1
+ * P0[1]/TD1/RXD3/SCL1 47 TD1
+ */
+
+#define GPIO_CAN1_RD GPIO_CAN1_RD_1
+#define GPIO_CAN1_TD GPIO_CAN1_TD_1
+
+/* UART0 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[2]/TXD0/AD0[7] 98 TXD0
+ * P0[3]/RXD0/AD0[6] 99 RXD0
+ */
+
+/* UART1 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[15]/TXD1/SCK0/SCK 62 TXD1
+ * P0[16]/RXD1/SSEL0/SSEL 63 RXD1
+ * P0[17]/CTS1/MISO0/MISO 61 CTS1
+ * P0[18]/DCD1/MOSI0/MOSI 60 DCD1
+ * P0[19]/DSR1/SDA1 59 DSR1
+ * P0[20]/DTR1/SCL1 58 DTR1
+ * P0[22]/RTS1/TD1 56 RTS1
+ */
+
+#define GPIO_UART1_TXD GPIO_UART1_TXD_1
+#define GPIO_UART1_RXD GPIO_UART1_RXD_1
+#define GPIO_UART1_CTS GPIO_UART1_CTS_1
+#define GPIO_UART1_DCD GPIO_UART1_DCD_1
+#define GPIO_UART1_DSR GPIO_UART1_DSR_1
+#define GPIO_UART1_DTR GPIO_UART1_DTR_1
+#define GPIO_UART1_RTS GPIO_UART1_RTS_1
+
+/* SSP0 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P1[21]/MCABORT/PWM1[3]/SSEL0 35 SSEL0
+ * P1[20]/MCFB0/PWM1[2]/SCK0 34 SCK0
+ * P1[23]/MCFB1/PWM1[4]/MISO0 37 MISO0
+ * P1[24]/MCFB2/PWM1[5]/MOSI0 38 MOSI0
+ */
+
+#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_2
+#define GPIO_SSP0_SCK GPIO_SSP0_SCK_2
+#define GPIO_SSP0_MISO GPIO_SSP0_MISO_2
+#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_2
+
+/* SSP1 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] 79 SSEL1
+ * P0[7]/I2STX_CLK/SCK1/MAT2[1] 78 SCK1
+ * P0[8]/I2STX_WS/MISO1/MAT2[2] 77 MISO1
+ * P0[9]/I2STX_SDA/MOSI1/MAT2[3] 76 MOSI1
+ */
+
+#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1
+
+/* I2C2 GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[10]/TXD2/SDA2/MAT3[0] 48 SDA2
+ * P0[11]/RXD2/SCL2/MAT3[1] 49 SCL2
+ */
+
+/* AD GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] 8 TEMP
+ * P0[25]/AD0[2]/I2SRX_SDA/TXD3 7 MIC IN
+
+/* USB GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[27]/SDA0/USB_SDA 25 USB_SDA
+ * P0[28]/SCL0/USB_SCL 24 USB_SCL
+ * P0[29]/USB_D+ 29 USB_D+
+ * P0[30]/USB_D- 30 USB_D-
+ * P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] 32 USB_UP_LED
+ * P1[19]/MC0A/#USB_PPWR/CAP1[1] 33 #USB_PPWR
+ * P1[22]/MC0B/USB_PWRD/MAT1[0] 36 USBH_PWRD
+ * P1[27]/CLKOUT/#USB_OVRCR/CAP0[1] 43 #USB_OVRCR
+ * P1[30]/VBUS/AD0[4] 21 VBUS
+ * P2[9]/USB_CONNECT/RXD2 64 USBD_CONNECT
+ */
+
+#ifdef GPIO_USB_PPWR /* We can only redefine this if they have been defined */
+
+/* The Olimex LPC1766-STK has 10K pull-ups on PPWR and OVRCR and a 100k
+ * pull-down on PWRD so we should make sure that the outputs float.
+ */
+
+# undef GPIO_USB_PPWR
+# define GPIO_USB_PPWR (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN19)
+# undef GPIO_USB_OVRCR
+# define GPIO_USB_OVRCR (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN27)
+# undef GPIO_USB_PWRD
+# define GPIO_USB_PWRD (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN22)
+
+/* In host mode (only) there are also 15K pull-downs on D+ and D- */
+
+# ifdef CONFIG_USBHOST
+# undef GPIO_USB_DP
+# define GPIO_USB_DP (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN29)
+# undef GPIO_USB_DM
+# define GPIO_USB_DM (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN30)
+# endif
+#endif
+
+/* Ethernet GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P1[0]/ENET_TXD0 95 E_TXD0
+ * P1[1]/ENET_TXD1 94 E_TXD1
+ * P1[4]/ENET_TX_EN 93 E_TX_EN
+ * P1[8]/ENET_CRS 92 E_CRS
+ * P1[9]/ENET_RXD0 91 E_RXD0
+ * P1[10]/ENET_RXD1 90 E_RXD1
+ * P1[14]/ENET_RX_ER 89 E_RX_ER
+ * P1[15]/ENET_REF_CLK 88 E_REF_CLK
+ * P1[16]/ENET_MDC 87 E_MDC
+ * P1[17]/ENET_MDIO 86 E_MDIO
+ */
+
+#define GPIO_ENET_MDC GPIO_ENET_MDC_1
+#define GPIO_ENET_MDIO GPIO_ENET_MDIO_1
+
+/* Trace GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P2[2]/PWM1[3]/CTS1/TRACEDATA[3] 73 TRACE_D3
+ * P2[3]/PWM1[4]/DCD1/TRACEDATA[2] 70 TRACE_D2
+ * P2[4]/PWM1[5]/DSR1/TRACEDATA[1] 69 TRACE_D1
+ * P2[5]/PWM1[6]/DTR1/TRACEDATA[0] 68 TRACE_D0
+ * P2[6]/PCAP1[0]/RI1/TRACECLK 67 TRACE_CLK
+ */
+
+/* EINT GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P2[11]/#EINT1/I2STX_CLK 52 #EINT1
+ */
+
+/* ?
+ * P0[26]/AD0[3]/AOUT/RXD3 6 AOUT
+ * P1[31]/SCK1/AD0[5] 20 AIN5
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void lpc17_boardinitialize(void);
+
+/************************************************************************************
+ * Name: lpc17_ledinit, lpc17_setled, and lpc17_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
+ * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * control the LEDs from user applications.
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void lpc17_ledinit(void);
+EXTERN void lpc17_setled(int led, bool ledon);
+EXTERN void lpc17_setleds(uint8_t ledset);
+#endif
+
+/************************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the current state of all buttons or
+ * up_irqbutton() may be called to register button interrupt handlers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+
+/************************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the current state of all buttons.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to collect
+ * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit
+ * associated with a button. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT
+ * definitions above for the meaning of each bit.
+ *
+ ************************************************************************************/
+
+EXTERN uint8_t up_buttons(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_irqbutton() may be called to register button interrupt handlers.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will be called
+ * when a button is depressed or released. The ID value is a button enumeration
+ * value that uniquely identifies a button resource. See the BOARD_BUTTON_* and
+ * BOARD_JOYSTICK_* definitions in above for the meaning of enumeration values
+ * The previous interrupt handler address is returned (so that it may restored, if
+ * so desired).
+ *
+ * Note that up_irqbutton() also enables button interrupts. Button interrupts
+ * will remain enabled after the interrupt handler is attached. Interrupts may
+ * be disabled (and detached) by calling up_irqbutton with irqhandler equal to
+ * NULL.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/Make.defs b/nuttx/configs/olimex-lpc1766stk/nettest/Make.defs
new file mode 100644
index 000000000..69e01144b
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nettest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/nettest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/appconfig b/nuttx/configs/olimex-lpc1766stk/nettest/appconfig
new file mode 100644
index 000000000..a54371a1d
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nettest/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/olimex-lpc1766stk/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/defconfig b/nuttx/configs/olimex-lpc1766stk/nettest/defconfig
new file mode 100755
index 000000000..6ac19b8e7
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nettest/defconfig
@@ -0,0 +1,478 @@
+############################################################################
+# configs/olimex-lpc1766stk/nettest/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_EMACRAM_SIZE=8192
+CONFIG_NET_NTXDESC=9
+CONFIG_NET_NRXDESC=9
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/ld.script b/nuttx/configs/olimex-lpc1766stk/nettest/ld.script
new file mode 100755
index 000000000..cc05746ba
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nettest/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/nettest/ld.script
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/setenv.sh b/nuttx/configs/olimex-lpc1766stk/nettest/setenv.sh
new file mode 100755
index 000000000..58951dc84
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nettest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/nettest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/Make.defs b/nuttx/configs/olimex-lpc1766stk/nsh/Make.defs
new file mode 100644
index 000000000..241d3644a
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/appconfig b/nuttx/configs/olimex-lpc1766stk/nsh/appconfig
new file mode 100644
index 000000000..b535ca869
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nsh/appconfig
@@ -0,0 +1,66 @@
+############################################################################
+# configs/olimex-lpc1766stk/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CONFIGURED_APPS += examples/buttons
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+
diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig
new file mode 100755
index 000000000..37e2b9bf0
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig
@@ -0,0 +1,523 @@
+############################################################################
+# configs/olimex-lpc1766stk/nsh/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=y
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_EMACRAM_SIZE=8192
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_GPIO=n
+CONFIG_DEBUG_CAN=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=30
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN_REGDEBUG=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=n
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=1536
+CONFIG_USBHOST_NEDS=2
+CONFIG_USBHOST_NTDS=3
+CONFIG_USBHOST_TDBUFFERS=3
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=512
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/ld.script b/nuttx/configs/olimex-lpc1766stk/nsh/ld.script
new file mode 100755
index 000000000..5f6adbecd
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nsh/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/setenv.sh b/nuttx/configs/olimex-lpc1766stk/nsh/setenv.sh
new file mode 100755
index 000000000..4b9bec6d0
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/nx/Make.defs b/nuttx/configs/olimex-lpc1766stk/nx/Make.defs
new file mode 100644
index 000000000..d6e00b56b
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nx/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/nx/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/nx/appconfig b/nuttx/configs/olimex-lpc1766stk/nx/appconfig
new file mode 100644
index 000000000..24d364197
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-lpc1766stk/nx/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/olimex-lpc1766stk/nx/defconfig b/nuttx/configs/olimex-lpc1766stk/nx/defconfig
new file mode 100755
index 000000000..a3a912b2a
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nx/defconfig
@@ -0,0 +1,573 @@
+############################################################################
+# configs/olimex-lpc1766stk/nx/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=y
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General SPI interface configuration
+#
+CONFIG_SPI_CMDDATA=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_SSP_DEBUG=n
+CONFIG_SSP_VERBOSE=n
+CONFIG_LCD_REGDEBUG=n
+
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=5
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=y
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=255
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=8
+CONFIG_NXTK_BORDERCOLOR2=4
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# RiT P14201 OLED Driver Configuration
+#
+CONFIG_LCD_P14201=n
+CONFIG_P14201_SPIMODE=2
+CONFIG_P14201_FREQUENCY=3500000
+CONFIG_P14201_NINTERFACES=1
+CONFIG_P14201_FRAMEBUFFER=y
+
+#
+# Nokia LCD Driver
+#
+# Nokia 6100 Configuration Settings:
+#
+CONFIG_LCD_NOKIA6100=y
+#CONFIG_NOKIA6100_SPIMODE
+#CONFIG_NOKIA6100_FREQUENCY
+#CONFIG_NOKIA6100_NINTERFACES
+CONFIG_NOKIA6100_BPP=8
+CONFIG_NOKIA6100_S1D15G10=y
+CONFIG_NOKIA6100_PCF8833=n
+CONFIG_NOKIA6100_BLINIT=40
+CONFIG_LCD_MAXCONTRAST=63
+CONFIG_LCD_MAXPOWER=127
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x02
+CONFIG_EXAMPLES_NX_COLOR1=0xdf
+CONFIG_EXAMPLES_NX_COLOR2=0xbe
+CONFIG_EXAMPLES_NX_TBCOLOR=0x92
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x00
+CONFIG_EXAMPLES_NX_BPP=8
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=y
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/nx/ld.script b/nuttx/configs/olimex-lpc1766stk/nx/ld.script
new file mode 100755
index 000000000..a4ad7e35b
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nx/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/nx/ld.script
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/nx/setenv.sh b/nuttx/configs/olimex-lpc1766stk/nx/setenv.sh
new file mode 100755
index 000000000..a2027d727
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/nx/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/nx/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/Make.defs b/nuttx/configs/olimex-lpc1766stk/ostest/Make.defs
new file mode 100644
index 000000000..f5cc92b55
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/ostest/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/appconfig b/nuttx/configs/olimex-lpc1766stk/ostest/appconfig
new file mode 100644
index 000000000..b83368c47
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-lpc1766stk/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/defconfig b/nuttx/configs/olimex-lpc1766stk/ostest/defconfig
new file mode 100755
index 000000000..a01564222
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ostest/defconfig
@@ -0,0 +1,483 @@
+############################################################################
+# configs/olimex-lpc1766stk/ostest/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/ld.script b/nuttx/configs/olimex-lpc1766stk/ostest/ld.script
new file mode 100755
index 000000000..323f1ec1d
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ostest/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/ostest/ld.script
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/setenv.sh b/nuttx/configs/olimex-lpc1766stk/ostest/setenv.sh
new file mode 100755
index 000000000..996cefc4e
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/ostest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/ostest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/Make.defs b/nuttx/configs/olimex-lpc1766stk/slip-httpd/Make.defs
new file mode 100644
index 000000000..ccdc4879f
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/Make.defs
@@ -0,0 +1,166 @@
+############################################################################
+# configs/olimex-lpc1766stk/slip-httpd/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/slip-httpd/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/slip-httpd/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/appconfig b/nuttx/configs/olimex-lpc1766stk/slip-httpd/appconfig
new file mode 100644
index 000000000..2daaefbce
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/olimex-lpc1766stk/slip-httpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/thttpd
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/thttpd
diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig b/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig
new file mode 100755
index 000000000..f2074597c
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig
@@ -0,0 +1,521 @@
+############################################################################
+# configs/olimex-lpc1766stk/slip-httpd/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=y
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART1_FLOWCONTROL=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="thttp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=23
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_SLIP=y
+CONFIG_NET_NOINTS=y
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=296
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# THTTPD settings
+#
+CONFIG_THTTPD_PORT=80
+CONFIG_THTTPD_IPADDR=0x0a000002
+CONFIG_THTTPD_SERVER_ADDRESS="http://www.nuttx.org"
+CONFIG_THTTPD_SERVER_SOFTWARE="thttpd/2.25b 29dec2003-NuttX"
+CONFIG_THTTPD_PATH="/mnt/www"
+CONFIG_THTTPD_CGI_PATH="/mnt/www/cgi-bin"
+CONFIG_THTTPD_CGI_PATTERN="/mnt/www/cgi-bin/*"
+CONFIG_THTTPD_CGI_PRIORITY=50
+CONFIG_THTTPD_CGI_STACKSIZE=1024
+CONFIG_THTTPD_CGI_BYTECOUNT=20000
+CONFIG_THTTPD_CGI_TIMELIMIT=0
+CONFIG_THTTPD_CHARSET="iso-8859-1"
+CONFIG_THTTPD_IOBUFFERSIZE=1024
+#CONFIG_THTTPD_INDEX_NAMES
+CONFIG_AUTH_FILE=n
+CONFIG_THTTPD_LISTEN_BACKLOG=8
+CONFIG_THTTPD_LINGER_MSEC=500
+CONFIG_THTTPD_OCCASIONAL_MSEC=120
+CONFIG_THTTPD_IDLE_READ_LIMIT_SEC=300
+CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC=300
+CONFIG_THTTPD_TILDE_MAP1=n
+CONFIG_THTTPD_TILDE_MAP2=n
+CONFIG_THTTPD_GENERATE_INDICES=n
+CONFIG_THTTPD_URLPATTERN=n
+
+#
+# Additional settings for examples/thttpd
+#
+CONFIG_EXAMPLE_THTTPD_NOMAC=y
+CONFIG_EXAMPLE_THTTPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_THTTPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=8192
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/ld.script b/nuttx/configs/olimex-lpc1766stk/slip-httpd/ld.script
new file mode 100755
index 000000000..43d2662c8
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/slip-httpd/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/setenv.sh b/nuttx/configs/olimex-lpc1766stk/slip-httpd/setenv.sh
new file mode 100755
index 000000000..546ca1e3a
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/slip-httpd/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/src/Makefile b/nuttx/configs/olimex-lpc1766stk/src/Makefile
new file mode 100644
index 000000000..1d7e049c6
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/Makefile
@@ -0,0 +1,104 @@
+############################################################################
+# configs/olimex-lpc1766stk/src/Makefile
+#
+# Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c up_ssp.c
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_NX_LCDDRIVER),y)
+CSRCS += up_lcd.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CSRCS += up_can.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/olimex-lpc1766stk/src/lpc1766stk_internal.h b/nuttx/configs/olimex-lpc1766stk/src/lpc1766stk_internal.h
new file mode 100644
index 000000000..31159de52
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/lpc1766stk_internal.h
@@ -0,0 +1,266 @@
+/************************************************************************************
+ * configs/olimex-lpc1766stk/src/lpc1766stk_internal.h
+ * arch/arm/src/board/lpc1766stk_internal.n
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_OLIMEX_LPC1766STK_SRC_LPC1766STK_INTERNAL_H
+#define _CONFIGS_OLIMEX_LPC1766STK_SRC_LPC1766STK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* LPC1766-STK GPIO Pin Definitions *************************************************/
+/* Board GPIO Usage:
+ *
+ * GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[0]/RD1/TXD3/SDA1 46 RD1
+ * P0[1]/TD1/RXD3/SCL1 47 TD1
+ * P0[2]/TXD0/AD0[7] 98 TXD0
+ * P0[3]/RXD0/AD0[6] 99 RXD0
+ * P0[4]/I2SRX_CLK/RD2/CAP2[0] 81 LED2/ACC IRQ
+ * P0[5]/I2SRX_WS/TD2/CAP2[1] 80 CENTER
+ * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] 79 SSEL1
+ * P0[7]/I2STX_CLK/SCK1/MAT2[1] 78 SCK1
+ * P0[8]/I2STX_WS/MISO1/MAT2[2] 77 MISO1
+ * P0[9]/I2STX_SDA/MOSI1/MAT2[3] 76 MOSI1
+ * P0[10]/TXD2/SDA2/MAT3[0] 48 SDA2
+ * P0[11]/RXD2/SCL2/MAT3[1] 49 SCL2
+ * P0[15]/TXD1/SCK0/SCK 62 TXD1
+ * P0[16]/RXD1/SSEL0/SSEL 63 RXD1
+ * P0[17]/CTS1/MISO0/MISO 61 CTS1
+ * P0[18]/DCD1/MOSI0/MOSI 60 DCD1
+ * P0[19]/DSR1/SDA1 59 DSR1
+ * P0[20]/DTR1/SCL1 58 DTR1
+ * P0[21]/RI1/RD1 57 MMC PWR
+ * P0[22]/RTS1/TD1 56 RTS1
+ * P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] 9 BUT1
+ * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] 8 TEMP
+ * P0[25]/AD0[2]/I2SRX_SDA/TXD3 7 MIC IN
+ * P0[26]/AD0[3]/AOUT/RXD3 6 AOUT
+ * P0[27]/SDA0/USB_SDA 25 USB_SDA
+ * P0[28]/SCL0/USB_SCL 24 USB_SCL
+ * P0[29]/USB_D+ 29 USB_D+
+ * P0[30]/USB_D- 30 USB_D-
+ * P1[0]/ENET_TXD0 95 E_TXD0
+ * P1[1]/ENET_TXD1 94 E_TXD1
+ * P1[4]/ENET_TX_EN 93 E_TX_EN
+ * P1[8]/ENET_CRS 92 E_CRS
+ * P1[9]/ENET_RXD0 91 E_RXD0
+ * P1[10]/ENET_RXD1 90 E_RXD1
+ * P1[14]/ENET_RX_ER 89 E_RX_ER
+ * P1[15]/ENET_REF_CLK 88 E_REF_CLK
+ * P1[16]/ENET_MDC 87 E_MDC
+ * P1[17]/ENET_MDIO 86 E_MDIO
+ * P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] 32 USB_UP_LED
+ * P1[19]/MC0A/#USB_PPWR/CAP1[1] 33 #USB_PPWR
+ * P1[20]/MCFB0/PWM1[2]/SCK0 34 SCK0
+ * P1[21]/MCABORT/PWM1[3]/SSEL0 35 SSEL0
+ * P1[22]/MC0B/USB_PWRD/MAT1[0] 36 USBH_PWRD
+ * P1[23]/MCFB1/PWM1[4]/MISO0 37 MISO0
+ * P1[24]/MCFB2/PWM1[5]/MOSI0 38 MOSI0
+ * P1[25]/MC1A/MAT1[1] 39 LED1
+ * P1[26]/MC1B/PWM1[6]/CAP0[0] 40 CS_UEXT
+ * P1[27]/CLKOUT/#USB_OVRCR/CAP0[1] 43 #USB_OVRCR
+ * P1[28]/MC2A/PCAP1[0]/MAT0[0] 44 P1.28
+ * P1[29]/MC2B/PCAP1[1]/MAT0[1] 45 P1.29
+ * P1[30]/VBUS/AD0[4] 21 VBUS
+ * P1[31]/SCK1/AD0[5] 20 AIN5
+ * P2[0]/PWM1[1]/TXD1 75 UP
+ * P2[1]/PWM1[2]/RXD1 74 DOWN
+ * P2[2]/PWM1[3]/CTS1/TRACEDATA[3] 73 TRACE_D3
+ * P2[3]/PWM1[4]/DCD1/TRACEDATA[2] 70 TRACE_D2
+ * P2[4]/PWM1[5]/DSR1/TRACEDATA[1] 69 TRACE_D1
+ * P2[5]/PWM1[6]/DTR1/TRACEDATA[0] 68 TRACE_D0
+ * P2[6]/PCAP1[0]/RI1/TRACECLK 67 TRACE_CLK
+ * P2[7]/RD2/RTS1 66 LEFT
+ * P2[8]/TD2/TXD2 65 RIGHT
+ * P2[9]/USB_CONNECT/RXD2 64 USBD_CONNECT
+ * P2[10]/#EINT0/NMI 53 ISP_E4
+ * P2[11]/#EINT1/I2STX_CLK 52 #EINT1
+ * P2[12]/#EINT2/I2STX_WS 51 WAKE-UP
+ * P2[13]/#EINT3/I2STX_SDA 50 BUT2
+ * P3[25]/MAT0[0]/PWM1[2] 27 LCD_RST
+ * P3[26]/STCLK/MAT0[1]/PWM1[3] 26 LCD_BL
+ */
+
+/* LEDs GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P1[25]/MC1A/MAT1[1] 39 LED1
+ * P0[4]/I2SRX_CLK/RD2/CAP2[0] 81 LED2/ACC IRQ
+ *
+ * LEDs are connected to +3.3V through a diode on one side and must be pulled
+ * low (through a resistor) on the LPC17xx side in order to illuminuate them.
+ */
+
+#define LPC1766STK_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN25)
+#define LPC1766STK_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN4)
+
+/* Buttons GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] 9 BUT1
+ * P2[13]/#EINT3/I2STX_SDA 50 BUT2
+ * P2[12]/#EINT2/I2STX_WS 51 WAKE-UP
+ *
+ * NOTES:
+ * 1. Pull-ups are not required because the pins are already pulled-up by
+ * through resistors on the board.
+ * 2. All buttons are capable of supporting interrupts if up_irqbutton() is
+ * called to attach an interrupt handler. Interrupts are configured to
+ * occur on both edges.
+ */
+
+#define LPC1766STK_BUT1 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN23)
+#define LPC1766STK_BUT2 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN13)
+#define LPC1766STK_WAKEUP (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN12)
+
+/* Button IRQ numbers */
+
+#define LPC1766STK_BUT1_IRQ LPC17_IRQ_P0p23
+#define LPC1766STK_BUT2_IRQ LPC17_IRQ_P2p13
+#define LPC1766STK_WAKEUP_IRQ LPC17_IRQ_P2p12
+
+/* Joystick GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[5]/I2SRX_WS/TD2/CAP2[1] 80 CENTER
+ * P2[0]/PWM1[1]/TXD1 75 UP
+ * P2[1]/PWM1[2]/RXD1 74 DOWN
+ * P2[7]/RD2/RTS1 66 LEFT
+ * P2[8]/TD2/TXD2 65 RIGHT
+ *
+ * NOTES:
+ * 1. Pull-ups are not required because the pins are already pulled-up by
+ * through resistors on the board.
+ * 2. All buttons are capable of supporting interrupts if up_irqbutton() is
+ * called to attach an interrupt handler. Interrupts are configured to
+ * occur on both edges.
+ */
+
+#define LPC1766STK_CENTER (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN5)
+#define LPC1766STK_UP (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN0)
+#define LPC1766STK_DOWN (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN1)
+#define LPC1766STK_LEFT (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN7)
+#define LPC1766STK_RIGHT (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN8)
+
+/* Joystick IRQ numbers */
+
+#define LPC1766STK_CENTER_IRQ LPC17_IRQ_P0p5
+#define LPC1766STK_UP_IRQ LPC17_IRQ_P2p0
+#define LPC1766STK_DOWN_IRQ LPC17_IRQ_P2p1
+#define LPC1766STK_LEFT_IRQ LPC17_IRQ_P2p7
+#define LPC1766STK_RIGHT_IRQ LPC17_IRQ_P2p8
+
+/* Nokia LCD GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P1[21]/MCABORT/PWM1[3]/SSEL0 35 SSEL0
+ * P1[20]/MCFB0/PWM1[2]/SCK0 34 SCK0
+ * P1[23]/MCFB1/PWM1[4]/MISO0 37 MISO0
+ * P1[24]/MCFB2/PWM1[5]/MOSI0 38 MOSI0
+ * P3[25]/MAT0[0]/PWM1[2] 27 LCD_RST
+ * P3[26]/STCLK/MAT0[1]/PWM1[3] 26 LCD_BL (PWM1)
+ */
+
+#define LPC1766STK_LCD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN21)
+#define LPC1766STK_LCD_RST (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT3 | GPIO_PIN25)
+#define LPC1766STK_LCD_BL GPIO_PWM1p3_3
+#define GPIO_PWM1p3 GPIO_PWM1p3_3
+
+/* SD/MMC GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] 79 SSEL1 (active low)
+ * P0[7]/I2STX_CLK/SCK1/MAT2[1] 78 SCK1
+ * P0[8]/I2STX_WS/MISO1/MAT2[2] 77 MISO1
+ * P0[9]/I2STX_SDA/MOSI1/MAT2[3] 76 MOSI1
+ * P0[21]/RI1/RD1 57 MMC PWR (active low)
+ */
+
+#define LPC1766STK_MMC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN6)
+#define LPC1766STK_MMC_PWR (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)
+
+/* AD GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] 8 TEMP
+ * P0[25]/AD0[2]/I2SRX_SDA/TXD3 7 MIC IN
+ */
+
+#define LPC1766STK_TEMP GPIO_AD0p1
+#define LPC1766STK_MIC_IN GPIO_AD0p2
+
+/* UEXT GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P1[26]/MC1B/PWM1[6]/CAP0[0] 40 CS_UEXT
+ */
+
+#define LPC1766STK_CS_UEXT (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN26)
+
+/* ISP? GPIO PIN SIGNAL NAME
+ * -------------------------------- ---- --------------
+ * P2[10]/#EINT0/NMI 53 ISP_E4
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Olimex LPC1766-STK board.
+ *
+ ************************************************************************************/
+
+void weak_function lpc17_sspinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_OLIMEX_LPC1766STK_SRC_LPC1766STK_INTERNAL_H */
+
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_boot.c b/nuttx/configs/olimex-lpc1766stk/src/up_boot.c
new file mode 100644
index 000000000..9d4c3ad3b
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/olimex-lpc1766stk/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+#include "lpc1766stk_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void lpc17_boardinitialize(void)
+{
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function lpc17_sspinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+ if (lpc17_sspinitialize)
+ {
+ lpc17_sspinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c
new file mode 100644
index 000000000..bcafc7337
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c
@@ -0,0 +1,228 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/src/up_buttons.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include <arch/board/board.h>
+
+#include "lpc17_internal.h"
+#include "lpc1766stk_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
+ * the BUTTON_* and JOYSTICK_* definitions in board.h
+ */
+
+static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
+{
+ LPC1766STK_BUT1, LPC1766STK_BUT2, LPC1766STK_WAKEUP, LPC1766STK_CENTER,
+ LPC1766STK_UP, LPC1766STK_DOWN, LPC1766STK_LEFT, LPC1766STK_RIGHT
+};
+
+/* This array defines all of the interupt handlers current attached to
+ * button events.
+ */
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+static xcpt_t g_buttonisr[BOARD_NUM_BUTTONS];
+
+/* This array provides the mapping from button ID numbers to button IRQ
+ * numbers.
+ */
+
+static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
+{
+ LPC1766STK_BUT1_IRQ, LPC1766STK_BUT2_IRQ, LPC1766STK_WAKEUP_IRQ,
+ LPC1766STK_CENTER_IRQ, LPC1766STK_UP_IRQ, LPC1766STK_DOWN_IRQ,
+ LPC1766STK_LEFT_IRQ, LPC1766STK_RIGHT_IRQ
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as interrupting inputs. */
+
+ for (i = 0; i < BOARD_NUM_BUTTONS; i++)
+ {
+ lpc17_configgpio(g_buttoncfg[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons.
+ *
+ * up_buttons() may be called at any time to harvest the state of every
+ * button. The state of the buttons is returned as a bitset with one
+ * bit corresponding to each button: If the bit is set, then the button
+ * is pressed. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < BOARD_NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed. */
+
+ bool released = lpc17_gpioread(g_buttoncfg[i]);
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_irqbutton() may be called to register button interrupt handlers.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BOARD_BUTTON_* and BOARD_JOYSTICK_* definitions in board.h for the meaning
+ * of enumeration values. The previous interrupt handler address is returned
+ * (so that it may restored, if so desired).
+ *
+ * Note that up_irqbutton() also enables button interrupts. Button
+ * interrupts will remain enabled after the interrupt handler is attached.
+ * Interrupts may be disabled (and detached) by calling up_irqbutton with
+ * irqhandler equal to NULL.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+ irqstate_t flags;
+ int irq;
+
+ /* Verify that the button ID is within range */
+
+ if ((unsigned)id < BOARD_NUM_BUTTONS)
+ {
+ /* Return the current button handler and set the new interrupt handler */
+
+ oldhandler = g_buttonisr[id];
+ g_buttonisr[id] = irqhandler;
+
+ /* Disable interrupts until we are done */
+
+ flags = irqsave();
+
+ /* Configure the interrupt. Either attach and enable the new
+ * interrupt or disable and detach the old interrupt handler.
+ */
+
+ irq = g_buttonirq[id];
+ if (irqhandler)
+ {
+ /* Attach then enable the new interrupt handler */
+
+ (void)irq_attach(irq, irqhandler);
+ up_enable_irq(irq);
+ }
+ else
+ {
+ /* Disable then then detach the the old interrupt handler */
+
+ up_disable_irq(irq);
+ (void)irq_detach(irq);
+ }
+ irqrestore(flags);
+ }
+ return oldhandler;
+}
+#endif
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_can.c b/nuttx/configs/olimex-lpc1766stk/src/up_can.c
new file mode 100644
index 000000000..f947c827e
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_can.c
@@ -0,0 +1,146 @@
+/************************************************************************************
+ * configs/solimex-lpc1766stk/src/up_can.c
+ * arch/arm/src/board/up_can.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/can.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "lpc17_internal.h"
+#include "lpc17_can.h"
+#include "lpc1766stk_internal.h"
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2))
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+
+#if defined(CONFIG_LPC17_CAN1) && defined(CONFIG_LPC17_CAN2)
+# warning "Both CAN1 and CAN2 are enabled. Assuming only CAN1."
+# undef CONFIG_LPC17_CAN2
+#endif
+
+#ifdef CONFIG_LPC17_CAN2
+# warning "CAN2 is not connected on the LPC1766-STK"
+#endif
+
+#ifdef CONFIG_LPC17_CAN1
+# define CAN_PORT 1
+#else
+# define CAN_PORT 2
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: can_devinit
+ *
+ * Description:
+ * All LPC17 architectures must provide the following interface to work with
+ * examples/can.
+ *
+ ************************************************************************************/
+
+int can_devinit(void)
+{
+ static bool initialized = false;
+ struct can_dev_s *can;
+ int ret;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Call lpc17_caninitialize() to get an instance of the CAN interface */
+
+ can = lpc17_caninitialize(CAN_PORT);
+ if (can == NULL)
+ {
+ candbg("ERROR: Failed to get CAN interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the CAN driver at "/dev/can0" */
+
+ ret = can_register("/dev/can0", can);
+ if (ret < 0)
+ {
+ candbg("ERROR: can_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_CAN && (CONFIG_LPC17_CAN1 || CONFIG_LPC17_CAN2) */
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c b/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c
new file mode 100644
index 000000000..93923b91a
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c
@@ -0,0 +1,265 @@
+/****************************************************************************
+ * config/olimex-lpc1766stk/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSPBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/nokia6100.h>
+
+#include "up_arch.h"
+#include "lpc17_syscon.h"
+#include "lpc17_pwm.h"
+#include "lpc17_internal.h"
+#include "lpc1766stk_internal.h"
+
+#if defined(CONFIG_NX_LCDDRIVER) && defined(CONFIG_LCD_NOKIA6100) && defined(CONFIG_LPC17_SSP0)
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Check power setting */
+
+#if !defined(CONFIG_LCD_MAXPOWER) || CONFIG_LCD_MAXPOWER != 127
+# error "CONFIG_LCD_MAXPOWER must be 127"
+#endif
+
+/* Backlight OFF PWM setting */
+
+#define NOKIA_BACKLIGHT_OFF 0x40
+
+/* Define the CONFIG_LCD_NOKIADBG to enable detailed debug output (stuff you
+ * would never want to see unless you are debugging this file).
+ *
+ * Verbose debug must also be enabled
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_LCD_NOKIADBG
+#endif
+
+#ifdef CONFIG_LCD_NOKIADBG
+# define lcddbg(format, arg...) vdbg(format, ##arg)
+# define lcd_dumpgpio(m) lpc17_dumpgpio(LPC1766STK_LCD_RST, m)
+#else
+# define lcddbg(x...)
+# define lcd_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nokia_blinitialize
+ *
+ * Description:
+ * Initialize PWM1 to manage the LCD backlight.
+ *
+ ****************************************************************************/
+
+void nokia_blinitialize(void)
+{
+ uint32_t regval;
+
+ /* Enable clocking of PWM1 */
+
+ regval = getreg32(LPC17_SYSCON_PCONP);
+ regval |= SYSCON_PCONP_PCPWM1;
+ putreg32(regval, LPC17_SYSCON_PCONP);
+
+ /* Disable and reset PWM1 */
+
+ regval = getreg32(LPC17_PWM1_TCR);
+ regval &= ~(PWM_TCR_PWMEN|PWM_TCR_CNTREN);
+ regval |= PWM_TCR_CNTRRST;
+ putreg32(regval, LPC17_PWM1_TCR);
+
+ /* Put PWM1 in timer mode */
+
+ regval = getreg32(LPC17_PWM1_CTCR);
+ regval &= ~PWM_CTCR_MODE_MASK;
+ regval |= PWM_CTCR_MODE_TIMER;
+ putreg32(regval, LPC17_PWM1_CTCR);
+
+ /* Reset on MR0 */
+
+ putreg32(PWM_MCR_MR0R, LPC17_PWM1_MCR);
+
+ /* Single edge controlled mod for PWM3 and enable output */
+
+ regval = getreg32(LPC17_PWM1_PCR);
+ regval &= ~PWM_PCR_SEL3;
+ regval |= PWM_PCR_ENA3;
+ putreg32(regval, LPC17_PWM1_PCR);
+
+ /* Clear prescaler */
+
+ putreg32(0, LPC17_PWM1_PR);
+
+ /* Set 8-bit resolution */
+
+ putreg32(0xff, LPC17_PWM1_MCR);
+
+ /* Enable PWM match 1 latch */
+
+ regval = getreg32(LPC17_PWM1_LER);
+ regval |= PWM_LER_M0EN;
+ putreg32(regval, LPC17_PWM1_LER);
+
+ /* Clear match register 3 */
+
+ putreg32(0, LPC17_PWM1_MR3);
+
+ /* Enable PWM1 */
+
+ regval |= PWM_LER_M3EN;
+ putreg32(regval, LPC17_PWM1_LER);
+
+ regval = getreg32(LPC17_PWM1_TCR);
+ regval &= ~(PWM_TCR_CNTRRST);
+ regval |= (PWM_TCR_PWMEN|PWM_TCR_CNTREN);
+ putreg32(regval, LPC17_PWM1_TCR);
+
+ nokia_backlight(0);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_nxdrvinit
+ *
+ * Description:
+ * Called NX initialization logic to configure the LCD.
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
+{
+ FAR struct spi_dev_s *spi;
+ FAR struct lcd_dev_s *dev;
+
+ /* Configure the LCD GPIOs */
+
+ lcd_dumpgpio("up_nxdrvinit: On entry");
+ lpc17_configgpio(LPC1766STK_LCD_RST);
+ lpc17_configgpio(LPC1766STK_LCD_BL);
+ lcd_dumpgpio("up_nxdrvinit: After GPIO setup");
+
+ /* Reset the LCD */
+
+ lpc17_gpiowrite(LPC1766STK_LCD_RST, false);
+ up_udelay(10);
+ lpc17_gpiowrite(LPC1766STK_LCD_RST, true);
+ up_mdelay(5);
+
+ /* Configure PWM1 to support the backlight */
+
+ nokia_blinitialize();
+
+ /* Get the SSP port (configure as a Freescale SPI port) */
+
+ spi = up_spiinitialize(0);
+ if (!spi)
+ {
+ glldbg("Failed to initialize SSP port 0\n");
+ }
+ else
+ {
+ /* Bind the SSP port to the LCD */
+
+ dev = nokia_lcdinitialize(spi, devno);
+ if (!dev)
+ {
+ glldbg("Failed to bind SSP port 0 to LCD %d: %d\n", devno);
+ }
+ else
+ {
+ gllvdbg("Bound SSP port 0 to LCD %d\n", devno);
+
+ /* And turn the LCD on (CONFIG_LCD_MAXPOWER should be 1) */
+
+ (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
+ return dev;
+ }
+ }
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: nokia_backlight
+ *
+ * Description:
+ * The Nokia 6100 backlight is controlled by logic outside of the LCD
+ * assembly. This function must be provided by board specific logic to
+ * manage the backlight. This function will receive a power value (0:
+ * full off - CONFIG_LCD_MAXPOWER: full on) and should set the backlight
+ * accordingly.
+ *
+ * On the Olimex LPC1766STK, the backlight level is controlled by PWM1.
+ *
+ ****************************************************************************/
+
+int nokia_backlight(unsigned int power)
+{
+ uint32_t regval;
+
+ putreg32(NOKIA_BACKLIGHT_OFF + power, LPC17_PWM1_MR3);
+
+ regval = getreg32(LPC17_PWM1_LER);
+ regval |= PWM_LER_M3EN;
+ putreg32(regval, LPC17_PWM1_LER);
+ return OK;
+}
+
+#endif /* CONFIG_NX_LCDDRIVER && CONFIG_LCD_NOKIA6100 && CONFIG_LPC17_SSP0 */
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_leds.c b/nuttx/configs/olimex-lpc1766stk/src/up_leds.c
new file mode 100644
index 000000000..75c6a8ce0
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_leds.c
@@ -0,0 +1,210 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "lpc17_internal.h"
+
+#include "lpc1766stk_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef LED_VERBOSE
+# define led_dumpgpio(m) lpc17_dumpgpio(???, m)
+#else
+# define led_dumpgpio(m)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+static bool g_uninitialized = true;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc17_ledinit/up_ledinit
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void lpc17_ledinit(void) /* Name when invoked externally */
+#else
+void up_ledinit(void) /* Name when invoked via up_boot.c */
+#endif
+{
+ /* Configure all LED GPIO lines */
+
+ led_dumpgpio("up_ledinit() Entry)");
+
+ lpc17_configgpio(LPC1766STK_LED1);
+ lpc17_configgpio(LPC1766STK_LED2);
+
+ led_dumpgpio("up_ledinit() Exit");
+}
+
+/****************************************************************************
+ * Name: lpc17_setled
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void lpc17_setled(int led, bool ledon)
+{
+ if (led == BOARD_LED1)
+ {
+ lpc17_gpiowrite(LPC1766STK_LED1, !ledon);
+ }
+ else if (led == BOARD_LED2)
+ {
+ lpc17_gpiowrite(LPC1766STK_LED2, !ledon);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc17_setleds
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void lpc17_setleds(uint8_t ledset)
+{
+ lpc17_gpiowrite(LPC1766STK_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ lpc17_gpiowrite(LPC1766STK_LED2, (ledset & BOARD_LED2_BIT) == 0);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledon(int led)
+{
+ switch (led)
+ {
+ default:
+ case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
+ lpc17_gpiowrite(LPC1766STK_LED1, true);
+ lpc17_gpiowrite(LPC1766STK_LED2, true);
+ break;
+
+ case 1 : /* STACKCREATED */
+ lpc17_gpiowrite(LPC1766STK_LED1, false);
+ lpc17_gpiowrite(LPC1766STK_LED2, true);
+ g_uninitialized = false;
+ break;
+
+ case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
+ lpc17_gpiowrite(LPC1766STK_LED2, false);
+ break;
+
+ case 3 : /* IDLE */
+ lpc17_gpiowrite(LPC1766STK_LED1, true);
+ break;
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledoff(int led)
+{
+ switch (led)
+ {
+ default:
+ case 0 : /* STARTED, HEAPALLOCATE, IRQSENABLED */
+ case 1 : /* STACKCREATED */
+ lpc17_gpiowrite(LPC1766STK_LED1, true);
+
+ case 2 : /* INIRQ, SIGNAL, ASSERTION, PANIC */
+ lpc17_gpiowrite(LPC1766STK_LED2, true);
+ break;
+
+ case 3 : /* IDLE */
+ lpc17_gpiowrite(LPC1766STK_LED1, g_uninitialized);
+ break;
+ }
+}
+#endif
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c b/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c
new file mode 100644
index 000000000..036350ded
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c
@@ -0,0 +1,329 @@
+/****************************************************************************
+ * config/olimex-lpc1766stk/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+#include <nuttx/usb/usbhost.h>
+
+#include "lpc17_internal.h"
+#include "lpc1766stk_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LPC1766STK
+# define NSH_HAVEMMCSD 1
+# define NSH_HAVEUSBHOST 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
+# error "The LPC1766-STK MMC/SD is on SSP1"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 1
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The LPC1766-STK MMC/SD is only one slot (0)"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+# ifndef CONFIG_LPC17_SSP1
+# warning "CONFIG_LPC17_SSP1 is not enabled"
+# undef NSH_HAVEMMCSD
+# endif
+#else
+# error "Unrecognized board"
+# undef NSH_HAVEMMCSD
+# undef NSH_HAVEUSBHOST
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* USB Host */
+
+#ifdef CONFIG_USBHOST
+# ifndef CONFIG_LPC17_USBHOST
+# error "CONFIG_LPC17_USBHOST is not selected"
+# endif
+#endif
+
+#ifdef CONFIG_LPC17_USBHOST
+# ifndef CONFIG_USBHOST
+# warning "CONFIG_USBHOST is not selected"
+# endif
+#endif
+
+#if !defined(CONFIG_USBHOST) || !defined(CONFIG_LPC17_USBHOST)
+# undef NSH_HAVEUSBHOST
+#endif
+
+#ifdef NSH_HAVEUSBHOST
+# ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+# endif
+# ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+# endif
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ message("nsh_waiter: Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ message("nsh_waiter: %s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Name: nsh_sdinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int nsh_sdinitialize(void)
+{
+ FAR struct spi_dev_s *ssp;
+ int ret;
+
+ /* Enable power to the SD/MMC via a GPIO. LOW enables SD/MMC. */
+
+ lpc17_gpiowrite(LPC1766STK_MMC_PWR, false);
+
+ /* Get the SSP port */
+
+ ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!ssp)
+ {
+ message("nsh_archinitialize: Failed to initialize SSP port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ ret = -ENODEV;
+ goto errout;
+ }
+
+ message("Successfully initialized SSP port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SSP port to the slot */
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR,
+ CONFIG_NSH_MMCSDSLOTNO, ssp);
+ if (ret < 0)
+ {
+ message("nsh_sdinitialize: "
+ "Failed to bind SSP port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO, ret);
+ goto errout;
+ }
+
+ message("Successfuly bound SSP port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+
+ /* Disable power to the SD/MMC via a GPIO. HIGH disables SD/MMC. */
+
+errout:
+ lpc17_gpiowrite(LPC1766STK_MMC_PWR, true);
+ return ret;
+}
+#else
+# define nsh_sdinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbhostinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_usbhostinitialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ message("nsh_usbhostinitialize: Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ message("nsh_usbhostinitialize: Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ message("nsh_usbhostinitialize: Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ message("nsh_usbhostinitialize: Start nsh_waiter\n");
+
+#ifndef CONFIG_CUSTOM_STACK
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)nsh_waiter, (const char **)NULL);
+#else
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ (main_t)nsh_waiter, (const char **)NULL);
+#endif
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+ return -ENODEV;
+}
+#else
+# define nsh_usbhostinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ int ret;
+
+ /* Initialize SPI-based microSD */
+
+ ret = nsh_sdinitialize();
+ if (ret == OK)
+ {
+ /* Initialize USB host */
+
+ ret = nsh_usbhostinitialize();
+ }
+ return ret;
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c b/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c
new file mode 100644
index 000000000..272a17065
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c
@@ -0,0 +1,380 @@
+/************************************************************************************
+ * configs/olimex-lpc1766stk/src/up_ssp.c
+ * arch/arm/src/board/up_ssp.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#ifdef CONFIG_SPI_CALLBACK
+#include <nuttx/irq.h>
+#endif
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "lpc17_internal.h"
+#include "lpc1766stk_internal.h"
+
+#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration ************************************************************/
+
+#ifdef CONFIG_SPI_CALLBACK
+# ifndef CONFIG_GPIO_IRQ
+# warning "CONFIG_GPIO_IRQ is required to support CONFIG_SPI_CALLBACK"
+# endif
+#endif
+
+/* Debug ********************************************************************/
+/* The following enable debug output from this file (needs CONFIG_DEBUG too).
+ *
+ * CONFIG_SSP_DEBUG - Define to enable basic SSP debug
+ * CONFIG_SSP_VERBOSE - Define to enable verbose SSP debug
+ */
+
+#ifdef CONFIG_SSP_DEBUG
+# define sspdbg lldbg
+# ifdef CONFIG_SSP_VERBOSE
+# define sspvdbg lldbg
+# else
+# define sspvdbg(x...)
+# endif
+#else
+# undef CONFIG_SSP_VERBOSE
+# define sspdbg(x...)
+# define sspvdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef CONFIG_SSP_VERBOSE
+# define ssp_dumpssp0gpio(m) lpc17_dumpgpio(LPC1766STK_LCD_CS, m)
+# define ssp_dumpssp1gpio(m) lpc17_dumpgpio(LPC1766STK_MMC_CS, m)
+#else
+# define ssp_dumpssp0gpio(m)
+# define ssp_dumpssp1gpio(m)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+
+/* This structure describes on media change callback */
+
+#ifdef CONFIG_SPI_CALLBACK
+struct lpc17_mediachange_s
+{
+ spi_mediachange_t callback; /* The media change callback */
+ FAR void *arg; /* Callback argument */
+};
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* Registered media change callback */
+
+#ifdef CONFIG_SPI_CALLBACK
+#ifdef CONFIG_LPC17_SSP0
+static struct lpc17_mediachange_s g_ssp0callback;
+#endif
+#ifdef CONFIG_LPC17_SSP1
+static struct lpc17_mediachange_s g_ssp1callback;
+#endif
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: ssp_cdirqsetup
+ *
+ * Description:
+ * Setup to receive a card detection interrupt
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_SPI_CALLBACK
+static void ssp_cdirqsetup(int irq, xcpt_t irqhandler)
+{
+ irqstate_t flags;
+
+ /* Disable interrupts until we are done */
+
+ flags = irqsave();
+
+ /* Configure the interrupt. Either attach and enable the new
+ * interrupt or disable and detach the old interrupt handler.
+ */
+
+ if (irqhandler)
+ {
+ /* Attach then enable the new interrupt handler */
+
+ (void)irq_attach(irq, irqhandler);
+ up_enable_irq(irq);
+ }
+ else
+ {
+ /* Disable then then detach the the old interrupt handler */
+
+ up_disable_irq(irq);
+ (void)irq_detach(irq);
+ }
+}
+#endif
+
+/************************************************************************************
+ * Name: ssp0/1_cdinterrupt
+ *
+ * Description:
+ * Handle card detection interrupt
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_SPI_CALLBACK
+#ifdef CONFIG_LPC17_SSP0
+static int ssp0_cdinterrupt(int irq, FAR void *context)
+{
+ /* Invoke the media change callback */
+
+ if (g_ssp0callback.callback)
+ {
+ g_ssp0callback.callback(g_ssp0callback.arg);
+ }
+ return OK;
+}
+#endif
+
+#ifdef CONFIG_LPC17_SSP1
+static int ssp1_cdinterrupt(int irq, FAR void *context)
+{
+ /* Invoke the media change callback */
+
+ if (g_ssp1callback.callback)
+ {
+ g_ssp1callback.callback(g_ssp1callback.arg);
+ }
+ return OK;
+}
+#endif
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LPC1766-STK.
+ *
+ ************************************************************************************/
+
+void weak_function lpc17_sspinitialize(void)
+{
+ /* Configure the SSP0 chip select GPIOs. Only the Nokia LCD is connected to SSP0 */
+
+#ifdef CONFIG_LPC17_SSP0
+ ssp_dumpssp0gpio("BEFORE SSP0 Initialization");
+ lpc17_configgpio(LPC1766STK_LCD_CS);
+ ssp_dumpssp0gpio("AFTER SSP0 Initialization");
+#endif
+
+ /* Configure SSP1 chip select GPIOs. Only the SD/MMC card slot is connected to SSP1 */
+
+#ifdef CONFIG_LPC17_SSP1
+ ssp_dumpssp0gpio("BEFORE SSP1 Initialization");
+ lpc17_configgpio(LPC1766STK_MMC_CS);
+
+ /* Also configure the SD/MMC power GPIO (but leave power off). This really has
+ * nothing to do with SSP, but does belong with other SD/MMC GPIO configuration
+ * settings.
+ */
+
+ lpc17_configgpio(LPC1766STK_MMC_PWR);
+ ssp_dumpssp0gpio("AFTER SSP1 Initialization");
+#endif
+
+#ifdef CONFIG_SPI_CALLBACK
+ /* If there were any CD detect pins for the LPC1766-STK, this is where
+ * they would be configured.
+ */
+#endif
+}
+
+/************************************************************************************
+ * Name: lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
+ *
+ * Description:
+ * The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
+ * must be provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common LPC17xx logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in lpc17_boardinitialize() to configure SPI/SSP chip select
+ * pins.
+ * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC17_SSP0
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ if (devid == SPIDEV_DISPLAY)
+ {
+ /* Assert/de-assert the CS pin to the card */
+
+ ssp_dumpssp0gpio("lpc17_ssp0select() Entry");
+ lpc17_gpiowrite(LPC1766STK_LCD_CS, !selected);
+ ssp_dumpssp0gpio("lpc17_ssp0select() Exit");
+ }
+}
+
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning nothing\n");
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_LPC17_SSP1
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Assert/de-assert the CS pin to the card */
+
+ ssp_dumpssp1gpio("lpc17_ssp1select() Entry");
+ lpc17_gpiowrite(LPC1766STK_MMC_CS, !selected);
+ ssp_dumpssp1gpio("lpc17_ssp1select() Exit");
+ }
+}
+
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning SPI_STATUS_PRESENT\n");
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+/************************************************************************************
+ * Name: lpc17_ssp0/1register
+ *
+ * Description:
+ * If the board supports a card detect callback to inform the SPI-based
+ * MMC/SD drvier when an SD card is inserted or removed, then
+ * CONFIG_SPI_CALLBACK should be defined and the following function(s) must
+ * must be implemented. These functiosn implements the registercallback
+ * method of the SPI interface (see include/nuttx/spi.h for details)
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * callback - The funtion to call on the media change
+ * arg - A caller provided value to return with the callback
+ *
+ * Returned Value:
+ * 0 on success; negated errno on failure.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_SPI_CALLBACK
+#ifdef CONFIG_LPC17_SSP0
+ /* If there were any CD detect pins on the LPC1766-STK, this is how the
+ * would be configured.
+ */
+
+int lpc17_ssp0register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg)
+{
+ /* Save the callback information */
+
+#if 0
+ g_ssp0callback.callback = callback;
+ g_ssp0callback.arg = arg;
+
+ /* Setup the interrupt */
+
+ spi_cdirqsetup(LPC1766STK_SPICD_IRQ, ssp0_cdinterrupt);
+#endif
+ return OK;
+}
+#endif
+
+#ifdef CONFIG_LPC17_SSP1
+int lpc17_ssp1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg)
+{
+ /* Save the callback information */
+
+#if 0
+ g_ssp1callback.callback = callback;
+ g_ssp1callback.arg = arg;
+
+ /* Setup the interrupt */
+
+ spi_cdirqsetup(LPC1766STK_SPICD_IRQ, ssp1_cdinterrupt);
+#endif
+ return OK;
+}
+#endif
+#endif
+
+#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c b/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c
new file mode 100644
index 000000000..08c5fb887
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/src/up_usbmsc.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the LPC17xx MMC/SD SPI block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+#include "lpc17_internal.h"
+#include "lpc1766stk_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_LPC1766STK
+# undef LPC17XX_MMCSDSPIPORTNO
+# define LPC17XX_MMCSDSPIPORTNO 1
+# undef LPC17XX_MMCSDSLOTNO
+# define LPC17XX_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new LPC17xx boards here */
+# error "Unrecognized LPC17xx board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Enable power to the SD/MMC via a GPIO. LOW enables SD/MMC. */
+
+ lpc17_gpiowrite(LPC1766STK_MMC_PWR, false);
+
+ /* Get the SPI port */
+
+ message("usbmsc_archinitialize: Initializing SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+ ret = -ENODEV;
+ goto errout;
+ }
+
+ message("usbmsc_archinitialize: Successfully initialized SPI port %d\n",
+ LPC17XX_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("usbmsc_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, LPC17XX_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("usbmsc_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO, ret);
+ goto errout;
+ }
+
+ message("usbmsc_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
+ return OK;
+
+ /* Disable power to the SD/MMC via a GPIO. HIGH disables SD/MMC. */
+
+errout:
+ lpc17_gpiowrite(LPC1766STK_MMC_PWR, true);
+ return ret;}
diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/Make.defs b/nuttx/configs/olimex-lpc1766stk/thttpd/Make.defs
new file mode 100644
index 000000000..3f00495f5
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/thttpd/Make.defs
@@ -0,0 +1,166 @@
+############################################################################
+# configs/olimex-lpc1766stk/thttpd/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/thttpd/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+MKNXFLAT = mknxflat
+LDNXFLAT = ldnxflat
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/appconfig b/nuttx/configs/olimex-lpc1766stk/thttpd/appconfig
new file mode 100644
index 000000000..8357e2cb2
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/thttpd/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/olimex-lpc1766stk/thttpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/thttpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/thttpd
diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig
new file mode 100755
index 000000000..f69918025
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig
@@ -0,0 +1,516 @@
+############################################################################
+# configs/olimex-lpc1766stk/thttpd/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=y
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="thttp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=23
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=y
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=16
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# THTTPD settings
+#
+CONFIG_THTTPD_PORT=80
+CONFIG_THTTPD_IPADDR=0x0a000002
+CONFIG_THTTPD_SERVER_ADDRESS="http://www.nuttx.org"
+CONFIG_THTTPD_SERVER_SOFTWARE="thttpd/2.25b 29dec2003-NuttX"
+CONFIG_THTTPD_PATH="/mnt/www"
+CONFIG_THTTPD_CGI_PATH="/mnt/www/cgi-bin"
+CONFIG_THTTPD_CGI_PATTERN="/mnt/www/cgi-bin/*"
+CONFIG_THTTPD_CGI_PRIORITY=50
+CONFIG_THTTPD_CGI_STACKSIZE=1024
+CONFIG_THTTPD_CGI_BYTECOUNT=20000
+CONFIG_THTTPD_CGI_TIMELIMIT=0
+CONFIG_THTTPD_CHARSET="iso-8859-1"
+CONFIG_THTTPD_IOBUFFERSIZE=1024
+#CONFIG_THTTPD_INDEX_NAMES
+CONFIG_AUTH_FILE=n
+CONFIG_THTTPD_LISTEN_BACKLOG=8
+CONFIG_THTTPD_LINGER_MSEC=500
+CONFIG_THTTPD_OCCASIONAL_MSEC=120
+CONFIG_THTTPD_IDLE_READ_LIMIT_SEC=300
+CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC=300
+CONFIG_THTTPD_TILDE_MAP1=n
+CONFIG_THTTPD_TILDE_MAP2=n
+CONFIG_THTTPD_GENERATE_INDICES=n
+CONFIG_THTTPD_URLPATTERN=n
+
+#
+# Additional settings for examples/thttpd
+#
+CONFIG_EXAMPLE_THTTPD_NOMAC=y
+CONFIG_EXAMPLE_THTTPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_THTTPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=8192
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/ld.script b/nuttx/configs/olimex-lpc1766stk/thttpd/ld.script
new file mode 100755
index 000000000..9225b8da6
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/thttpd/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/thttpd/ld.script
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/setenv.sh b/nuttx/configs/olimex-lpc1766stk/thttpd/setenv.sh
new file mode 100755
index 000000000..09288f04c
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/thttpd/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/thttpd/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/tools/olimex.cfg b/nuttx/configs/olimex-lpc1766stk/tools/olimex.cfg
new file mode 100755
index 000000000..c8b5f7028
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/tools/olimex.cfg
@@ -0,0 +1,86 @@
+# NXP LPC1766 Cortex-M3 with 256kB Flash and 32kB+32kB Local On-Chip SRAM,
+
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG A"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15BA 0x0003
+
+# LPC17xx chips support both JTAG and SWD transports.
+# Adapt based on what transport is active.
+source [find target/swj-dp.tcl]
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME lpc1766
+}
+
+# After reset the chip is clocked by the ~4MHz internal RC oscillator.
+# When board-specific code (reset-init handler or device firmware)
+# configures another oscillator and/or PLL0, set CCLK to match; if
+# you don't, then flash erase and write operations may misbehave.
+# (The ROM code doing those updates cares about core clock speed...)
+#
+# CCLK is the core clock frequency in KHz
+if { [info exists CCLK ] } {
+ set _CCLK $CCLK
+} else {
+ set _CCLK 4000
+}
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ set _CPUTAPID 0x4ba00477
+}
+
+#delays on reset lines
+adapter_nsrst_delay 200
+jtag_ntrst_delay 200
+
+# LPC2000 & LPC1700 -> SRST causes TRST
+reset_config trst_and_srst srst_pulls_trst
+
+#swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
+jtag newtap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -chain-position $_TARGETNAME
+
+# LPC1766 has 32kB of SRAM In the ARMv7-M "Code" area (at 0x10000000)
+# and 32K more on AHB, in the ARMv7-M "SRAM" area, (at 0x2007c000).
+$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size 0x8000
+
+# LPC1766 has 256kB of flash memory, managed by ROM code (including a
+# boot loader which verifies the flash exception table's checksum).
+# flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum]
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME lpc2000 0x0 0x40000 0 0 $_TARGETNAME \
+ lpc1700 $_CCLK calc_checksum
+
+# Run with *real slow* clock by default since the
+# boot rom could have been playing with the PLL, so
+# we have no idea what clock the target is running at.
+jtag_khz 100
+
+$_TARGETNAME configure -event reset-init {
+ # Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
+ # "User Flash Mode" where interrupt vectors are _not_ remapped,
+ # and reside in flash instead).
+ #
+ # See Table 612. Memory Mapping Control register (MEMMAP - 0x400F C040) bit description
+ # Bit Symbol Value Description Reset
+ # value
+ # 0 MAP Memory map control. 0
+ # 0 Boot mode. A portion of the Boot ROM is mapped to address 0.
+ # 1 User mode. The on-chip Flash memory is mapped to address 0.
+ # 31:1 - Reserved. The value read from a reserved bit is not defined. NA
+ #
+ # http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1766&type=user
+
+ mww 0x400FC040 0x01
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/tools/oocd.sh b/nuttx/configs/olimex-lpc1766stk/tools/oocd.sh
new file mode 100755
index 000000000..b45d95b5d
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/tools/oocd.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# See configs/olimex-lpc1766stk/README.txt for information about
+# this file.
+
+TOPDIR=$1
+USAGE="$0 <TOPDIR> [-d]"
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ exit 1
+fi
+
+# Assume that OpenOCD was installed and at /usr/local/bin. Uncomment
+# the following to run directly from the build directory
+#OPENOCD_PATH="/home/OpenOCD/openocd/src"
+#TARGET_PATH="/home/OpenOCD/openocd/tcl"
+OPENOCD_PATH="/usr/local/bin"
+TARGET_PATH="/usr/local/share/openocd/scripts"
+
+OPENOCD_EXE=openocd.exe
+OPENOCD_CFG="${TOPDIR}/configs/olimex-lpc1766stk/tools/olimex.cfg"
+OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}"
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+if [ ! -d ${OPENOCD_PATH} ]; then
+ echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
+ exit 1
+fi
+if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
+ echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+fi
+if [ ! -f ${OPENOCD_CFG} ]; then
+ echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
+ exit 1
+fi
+
+echo "Starting OpenOCD"
+cd ${OPENOCD_PATH} || { echo "Failed to CD to ${OPENOCD_PATH}"; exit 1; }
+${OPENOCD_EXE} ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
+
+
+
+
diff --git a/nuttx/configs/olimex-lpc1766stk/tools/usb-driver.txt b/nuttx/configs/olimex-lpc1766stk/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/Make.defs b/nuttx/configs/olimex-lpc1766stk/usbserial/Make.defs
new file mode 100644
index 000000000..18e30e664
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbserial/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/usbserial/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbserial/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/appconfig b/nuttx/configs/olimex-lpc1766stk/usbserial/appconfig
new file mode 100644
index 000000000..2b73ffd79
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbserial/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-lpc1766stk/usbserial/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbserial
+
diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig b/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig
new file mode 100755
index 000000000..506ef91d7
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig
@@ -0,0 +1,484 @@
+############################################################################
+# configs/olimex-lpc1766stk/usbserial/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=y
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="usbserial_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=y
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/ld.script b/nuttx/configs/olimex-lpc1766stk/usbserial/ld.script
new file mode 100755
index 000000000..26e03a20e
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbserial/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/usbserial/ld.script
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/setenv.sh b/nuttx/configs/olimex-lpc1766stk/usbserial/setenv.sh
new file mode 100755
index 000000000..f755b6afe
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbserial/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/usbserial/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/Make.defs b/nuttx/configs/olimex-lpc1766stk/usbstorage/Make.defs
new file mode 100644
index 000000000..1999989f7
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/usbstorage/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/appconfig b/nuttx/configs/olimex-lpc1766stk/usbstorage/appconfig
new file mode 100644
index 000000000..073634d41
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-lpc1766stk/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig b/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig
new file mode 100755
index 000000000..eaf51a8f4
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig
@@ -0,0 +1,485 @@
+############################################################################
+# configs/olimex-lpc1766stk/usbstorage/defconfig
+#
+# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=n
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=y
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=y
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx Button interrupt support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_ARCH_IRQBUTTONS=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# LPC17xx USB Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="BUT1"
+CONFIG_EXAMPLE_BUTTONS_NAME1="BUT2"
+CONFIG_EXAMPLE_BUTTONS_NAME2="WAKE-UP"
+CONFIG_EXAMPLE_BUTTONS_NAME3="CENTER"
+CONFIG_EXAMPLE_BUTTONS_NAME4="UP"
+CONFIG_EXAMPLE_BUTTONS_NAME5="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME6="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="RIGHT"
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/ld.script b/nuttx/configs/olimex-lpc1766stk/usbstorage/ld.script
new file mode 100755
index 000000000..8c81ff85a
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/usbstorage/ld.script
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/setenv.sh b/nuttx/configs/olimex-lpc1766stk/usbstorage/setenv.sh
new file mode 100755
index 000000000..e41283c43
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/usbstorage/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/Make.defs b/nuttx/configs/olimex-lpc1766stk/wlan/Make.defs
new file mode 100644
index 000000000..0fcde7acc
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/wlan/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/olimex-lpc1766stk/wlan/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_LPC17_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_LPC17_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/wlan/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/wlan/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/appconfig b/nuttx/configs/olimex-lpc1766stk/wlan/appconfig
new file mode 100644
index 000000000..7fb2871aa
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/wlan/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/olimex-lpc1766stk/wlan/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/wlan
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/defconfig b/nuttx/configs/olimex-lpc1766stk/wlan/defconfig
new file mode 100755
index 000000000..4b7b2942d
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/wlan/defconfig
@@ -0,0 +1,491 @@
+############################################################################
+# configs/olimex-lpc1766stk/wlan/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="lpc17xx"
+CONFIG_ARCH_CHIP_LPC17XX=y
+CONFIG_ARCH_CHIP_LPC1766=y
+CONFIG_ARCH_BOARD="olimex-lpc1766stk"
+CONFIG_ARCH_BOARD_LPC1766STK=y
+CONFIG_BOARD_LOOPSPERMSEC=8111
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x10000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_LPC17_CODESOURCERYW=n
+CONFIG_LPC17_CODESOURCERYL=n
+CONFIG_LPC17_DEVKITARM=n
+CONFIG_LPC17_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_LPC17_ETHERNET=n
+CONFIG_LPC17_USBHOST=y
+CONFIG_LPC17_USBOTG=n
+CONFIG_LPC17_USBDEV=n
+CONFIG_LPC17_UART0=y
+CONFIG_LPC17_UART1=n
+CONFIG_LPC17_UART2=n
+CONFIG_LPC17_UART3=n
+CONFIG_LPC17_CAN1=n
+CONFIG_LPC17_CAN2=n
+CONFIG_LPC17_SPI=n
+CONFIG_LPC17_SSP0=n
+CONFIG_LPC17_SSP1=n
+CONFIG_LPC17_I2C0=n
+CONFIG_LPC17_I2C1=n
+CONFIG_LPC17_I2S=n
+CONFIG_LPC17_TMR0=n
+CONFIG_LPC17_TMR1=n
+CONFIG_LPC17_TMR2=n
+CONFIG_LPC17_TMR3=n
+CONFIG_LPC17_RIT=n
+CONFIG_LPC17_PWM=n
+CONFIG_LPC17_MCPWM=n
+CONFIG_LPC17_QEI=n
+CONFIG_LPC17_RTC=n
+CONFIG_LPC17_WDT=n
+CONFIG_LPC17_ADC=n
+CONFIG_LPC17_DAC=n
+CONFIG_LPC17_GPDMA=n
+
+#
+# LPC17xx specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=57600
+CONFIG_UART2_BAUD=57600
+CONFIG_UART3_BAUD=57600
+CONFIG_UART1_BAUD=57600
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# LPC17xx specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_REGDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="wlan_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=y
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=2
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+CONFIG_NET_WLAN=y
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=y
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# LPC17xx USB Device Configuration
+#
+CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n
+CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_LPC17_USBDEV_DMA=n
+CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0
+CONFIG_LPC17_USBDEV_DMAINTMASK=0
+
+#
+# LPC17xx USB Host Configuration
+#
+# OHCI RAM layout:
+#
+CONFIG_USBHOST_OHCIRAM_SIZE=2048
+CONFIG_USBHOST_NEDS=3
+CONFIG_USBHOST_NTDS=2
+CONFIG_USBHOST_TDBUFFERS=4
+CONFIG_USBHOST_TDBUFSIZE=128
+CONFIG_USBHOST_IOBUFSIZE=448
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for apps/examples/wlan
+#
+CONFIG_EXAMPLE_WLAN_DHCPC=n
+CONFIG_EXAMPLE_WLAN_NOMAC=n
+CONFIG_EXAMPLE_WLAN_IPADDR=0xc0a800c9
+CONFIG_EXAMPLE_WLAN_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_WLAN_NETMASK=0xffffff00
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+#
+# USB WLAN device identification
+#
+CONFIG_USB_WLAN_VID=0x0bda
+CONFIG_USB_WLAN_PID=0x8189
diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/ld.script b/nuttx/configs/olimex-lpc1766stk/wlan/ld.script
new file mode 100755
index 000000000..82fc20a44
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/wlan/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/olimex-lpc1766stk/wlan/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
+ * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
+ * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
+ * into the 32Kb CPU SRAM address range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh b/nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh
new file mode 100755
index 000000000..1b87dab69
--- /dev/null
+++ b/nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-lpc1766stk/wlan/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc2378/Kconfig b/nuttx/configs/olimex-lpc2378/Kconfig
new file mode 100644
index 000000000..962ea29de
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/Kconfig
@@ -0,0 +1,14 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+#
+
+if ARCH_BOARD_OLIMEXLPC2378
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/olimex-lpc2378/README.txt b/nuttx/configs/olimex-lpc2378/README.txt
new file mode 100644
index 000000000..9b28f1b3f
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/README.txt
@@ -0,0 +1,11 @@
+There's not much here:
+
+EXT1 - P3 0:7 are used for LEDs.
+
+UEXT pin 3/4 -TXD2/RXD2- is UART2.
+
+The board I have has the revision '-' of LPC2378 even though I got the board
+more than 2 years after the chip revision was released :-( .
+I can't get Nuttx to work if I fully enabled the MAM.
+
+I used FTDI ft232 usb-serial with nsh piping as seen on the screenshot.
diff --git a/nuttx/configs/olimex-lpc2378/include/README.txt b/nuttx/configs/olimex-lpc2378/include/README.txt
new file mode 100644
index 000000000..60f959c8f
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the OLIMEX-LPC2378 STK board.
diff --git a/nuttx/configs/olimex-lpc2378/include/board.h b/nuttx/configs/olimex-lpc2378/include/board.h
new file mode 100644
index 000000000..44919c46c
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/include/board.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+ * configs/olimex-lpc2378/include/board.h
+ *
+ * Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+ * Author: Rommel Marcelo
+ *
+ * This is part of the NuttX RTOS and based on the LPC2148 port:
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* If USB is enabled, PLL must be configured for 48MHz to provide USB clocking */
+//-- F_pll = (2 * M * F_in)/N
+//-- F_out = ((2 * (PLL_M + 1 ) * FOSC)/(0+1))/(CCLK_DIV+1) = 288/5 = 57 600 000 Hz
+//~ #ifdef CONFIG_USBDEV
+ //~ # define FOSC (12000000) /* Oscillator frequency */
+ //~ # define CCLK (57600000) /* CPU running clock */
+ //~ # define FCCO (288000000) /* CPU CCO clock */
+//~ #else
+ # define FOSC (12000000) /* Oscillator frequency */
+ # define CCLK (57600000) /* CPU running clock */
+ # define FCCO (288000000) /* CPU CCO clock */
+ //~ # define CCLK (72000000) /* CPU running clock */
+ //~ # define FCCO (360000000) /* CPU CCO clock */
+//~ #endif
+
+//~#define PLL_M ( (FCCO / (2 * FOSC))-1 )
+//~ #define PLL_N ( ((2 * PLL_M * FOSC) / FCCO)-1 )
+#define PLL_M 11
+#define PLL_N 0
+
+#define CCLK_DIV 4
+#define USBCLK_DIV 6
+
+ /* LED definitions **********************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+#ifdef __cplusplus
+ }
+#endif
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/olimex-lpc2378/nsh/Make.defs b/nuttx/configs/olimex-lpc2378/nsh/Make.defs
new file mode 100644
index 000000000..c970a93d1
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/nsh/Make.defs
@@ -0,0 +1,180 @@
+##############################################################################
+# configs/olimex-lpc2378/nsh/Make.defs
+#
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+# Author: Rommel Marcelo
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_OLIMEX_LPC2378_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_OLIMEX_LPC2378_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ("${CONFIG_DEBUG}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc2378/nsh/appconfig b/nuttx/configs/olimex-lpc2378/nsh/appconfig
new file mode 100644
index 000000000..3d90550d5
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/olimex-lpc2378/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/olimex-lpc2378/nsh/defconfig b/nuttx/configs/olimex-lpc2378/nsh/defconfig
new file mode 100755
index 000000000..98cd2b5fe
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/nsh/defconfig
@@ -0,0 +1,266 @@
+############################################################################
+# configs/olimex-lpc2378/nsh/defconfig
+#
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+# Author: Rommel Marcelo
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc2378"
+CONFIG_ARCH_CHIP_LPC2378=y
+CONFIG_ARCH_BOARD="olimex-lpc2378"
+CONFIG_ARCH_BOARD_OLIMEXLPC2378=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=
+CONFIG_ARCH_STACKDUMP=y
+
+# Identify toolchain and linker options
+#
+CONFIG_OLIMEX_LPC2378_CODESOURCERYW=n
+CONFIG_OLIMEX_LPC2378_CODESOURCERYL=y
+CONFIG_OLIMEX_LPC2378_DEVKITARM=n
+CONFIG_OLIMEX_LPC2378_BUILDROOT=n
+
+#
+# LPC2378 specific chip initialization
+#CONFIG_PLL_CLKSRC - identifies the clock source to use
+# IRC = 0, MAIN = 1, RTC = 2
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_PLL_CLKSRC= 1
+CONFIG_MAM_SETUP=y
+#TODO: CONFIG_EMC_SETUP=n
+CONFIG_ADC_SETUP=n
+CONFIG_USBDEV=n
+CONFIG_UART0=y
+CONFIG_UART2=y
+
+#
+# LPC23xx specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=128
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=128
+CONFIG_UART2_RXBUFSIZE=256
+
+# Baud Rate
+CONFIG_UART0_BAUD=9600
+CONFIG_UART2_BAUD=576000
+# Data Bits
+CONFIG_UART0_BITS=8
+CONFIG_UART2_BITS=8
+# Parity Bits
+CONFIG_UART0_PARITY=0
+CONFIG_UART2_PARITY=0
+# 2 Stop Bits ?
+CONFIG_UART0_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+#CONFIG_DEBUG_MM=y
+#CONFIG_DEBUG_SCHED=y
+CONFIG_DEBUG_FS=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=8
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# Settings for examples/hello
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+# Settings for examples/serloop
+CONFIG_EXAMPLES_SERLOOP_BUFIO=
+
+#
+# Settings for examples/nsh
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+
+# Stack and heap information
+#
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc2378/nsh/ld.script b/nuttx/configs/olimex-lpc2378/nsh/ld.script
new file mode 100755
index 000000000..d591fcd66
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/nsh/ld.script
@@ -0,0 +1,165 @@
+/****************************************************************************
+ * configs/olimex-lpc2378/nsh/ld.script
+ *
+ * Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+ * Author: Rommel Marcelo
+ *
+ * This is part of the NuttX RTOS and based on the LPC2148 port:
+ *
+ * Copyright (C) 2010, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+MEMORY
+{
+ ROM (rx) : ORIGIN = 0x00000000, LENGTH = (512k-8k) /* Flash: 512k - boot code */
+ RAM (rw) : ORIGIN = 0x40000000, LENGTH = (32k-32) /* SRAM: 32k - IAP work */
+ URAM (rw) : ORIGIN = 0x7FD00000, LENGTH = (8k) /* USB RAM: 8k */
+ ERAM (rw) : ORIGIN = 0x7FE00000, LENGTH = (16k) /* Ethernet RAM: 16k */
+ BRAM (rw) : ORIGIN = 0xE0084000, LENGTH = (2k) /* Battery RAM: 2k */
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors) /* Startup code */
+ *(.text .text.*) /* remaining code */
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*) /* read-only data (constants) */
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ . = ALIGN(4);
+ } > ROM
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+ . = ALIGN(4);
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > RAM AT > ROM
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > RAM
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > RAM
+ __exidx_end = ABSOLUTE(.);
+
+/* .bss section which is initialized by 0 */
+ /* This section will be filled with zero by startup code */
+ .bss (NOLOAD) :
+ {
+ _sbss = ABSOLUTE(.) ;
+ *(.bss)
+ *(.bss.*)
+ *(.gnu.linkonce.b*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > RAM
+
+ .usbram (NOLOAD) :
+ {
+ __usbram_start = . ;
+ __usbram_start__ = . ;
+ *(.usbram)
+ . = ALIGN(4);
+ } > URAM
+
+ .etherram (NOLOAD) :
+ {
+ __etherram_start = . ;
+ __etherram_start__ = . ;
+ *(.etherram)
+ . = ALIGN(4);
+ } > ERAM
+
+ .batteryram (NOLOAD) :
+ {
+ __batteryram_start = . ;
+ __batteryram_start__ = . ;
+ *(.batteryram)
+ . = ALIGN(4);
+ } > BRAM
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+}
diff --git a/nuttx/configs/olimex-lpc2378/nsh/setenv.sh b/nuttx/configs/olimex-lpc2378/nsh/setenv.sh
new file mode 100755
index 000000000..9a2e92e43
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/nsh/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/olimex-lpc2378/ostest/setenv.sh
+#
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+# Author: Rommel Marcelo
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export LPC23XXSCRIPTS="$WD/configs/olimex-lpc2378/scripts"
+export PATH="${BUILDROOT_BIN}:${LPC23XXSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc2378/ostest/Make.defs b/nuttx/configs/olimex-lpc2378/ostest/Make.defs
new file mode 100644
index 000000000..ea4192908
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/ostest/Make.defs
@@ -0,0 +1,180 @@
+##############################################################################
+# configs/olimex-lpc2378/ostest/Make.defs
+#
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+# Author: Rommel Marcelo
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_OLIMEX_LPC2378_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_OLIMEX_LPC2378_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+endif
+ifeq ($(CONFIG_OLIMEX_LPC2378_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ("${CONFIG_DEBUG}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-lpc2378/ostest/appconfig b/nuttx/configs/olimex-lpc2378/ostest/appconfig
new file mode 100644
index 000000000..e74529116
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-lpc2378/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/olimex-lpc2378/ostest/defconfig b/nuttx/configs/olimex-lpc2378/ostest/defconfig
new file mode 100755
index 000000000..df6c0e1cb
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/ostest/defconfig
@@ -0,0 +1,266 @@
+############################################################################
+# configs/olimex-lpc2378/ostest/defconfig
+#
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+# Author: Rommel Marcelo
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="lpc2378"
+CONFIG_ARCH_CHIP_LPC2378=y
+CONFIG_ARCH_BOARD="olimex-lpc2378"
+CONFIG_ARCH_BOARD_OLIMEXLPC2378=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=3270
+CONFIG_ARCH_LEDS=y
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x40000000
+CONFIG_ARCH_INTERRUPTSTACK=
+CONFIG_ARCH_STACKDUMP=y
+
+# Identify toolchain and linker options
+#
+CONFIG_OLIMEX_LPC2378_CODESOURCERYW=n
+CONFIG_OLIMEX_LPC2378_CODESOURCERYL=y
+CONFIG_OLIMEX_LPC2378_DEVKITARM=n
+CONFIG_OLIMEX_LPC2378_BUILDROOT=n
+
+#
+# LPC2378 specific chip initialization
+#CONFIG_PLL_CLKSRC - identifies the clock source to use
+# IRC = 0, MAIN = 1, RTC = 2
+#
+CONFIG_EXTMEM_MODE=n
+CONFIG_RAM_MODE=n
+CONFIG_CODE_BASE=0x00000000
+CONFIG_PLL_SETUP=y
+CONFIG_PLL_CLKSRC= 1
+CONFIG_MAM_SETUP=y
+#TODO: CONFIG_EMC_SETUP=n
+CONFIG_ADC_SETUP=n
+CONFIG_USBDEV=n
+CONFIG_UART0=y
+CONFIG_UART2=y
+
+#
+# LPC23xx specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=128
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=128
+CONFIG_UART2_RXBUFSIZE=256
+
+# Baud Rate
+CONFIG_UART0_BAUD=9600
+CONFIG_UART2_BAUD=576000
+# Data Bits
+CONFIG_UART0_BITS=8
+CONFIG_UART2_BITS=8
+# Parity Bits
+CONFIG_UART0_PARITY=0
+CONFIG_UART2_PARITY=0
+# 2 Stop Bits ?
+CONFIG_UART0_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+#CONFIG_DEBUG_MM=y
+#CONFIG_DEBUG_SCHED=y
+#CONFIG_DEBUG_FS=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=13
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=20000000
+
+#
+# Settings for examples/hello
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+# Settings for examples/serloop
+CONFIG_EXAMPLES_SERLOOP_BUFIO=
+
+#
+# Settings for examples/nsh
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+
+# Stack and heap information
+#
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-lpc2378/ostest/ld.script b/nuttx/configs/olimex-lpc2378/ostest/ld.script
new file mode 100755
index 000000000..e9ffbb450
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/ostest/ld.script
@@ -0,0 +1,166 @@
+/****************************************************************************
+ * configs/olimex-lpc2378/ostest/ld.script
+ *
+ * Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+ * Author: Rommel Marcelo
+ *
+ * This is part of the NuttX RTOS and based on the LPC2148 port:
+ *
+ * Copyright (C) 2010, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+MEMORY
+{
+ ROM (rx) : ORIGIN = 0x00000000, LENGTH = (512k-8k) /* Flash: 512k - boot code */
+ RAM (rw) : ORIGIN = 0x40000000, LENGTH = (32k-32) /* SRAM: 32k - IAP work */
+ URAM (rw) : ORIGIN = 0x7FD00000, LENGTH = (8k) /* USB RAM: 8k */
+ ERAM (rw) : ORIGIN = 0x7FE00000, LENGTH = (16k) /* Ethernet RAM: 16k */
+ BRAM (rw) : ORIGIN = 0xE0084000, LENGTH = (2k) /* Battery RAM: 2k */
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors) /* Startup code */
+ *(.text .text.*) /* remaining code */
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*) /* read-only data (constants) */
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ . = ALIGN(4);
+ } > ROM
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+ . = ALIGN(4);
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > RAM AT > ROM
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > RAM
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > RAM
+ __exidx_end = ABSOLUTE(.);
+
+
+/* .bss section which is initialized by 0 */
+ /* This section will be filled with zero by startup code */
+ .bss (NOLOAD) :
+ {
+ _sbss = ABSOLUTE(.) ;
+ *(.bss)
+ *(.bss.*)
+ *(.gnu.linkonce.b*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > RAM
+
+ .usbram (NOLOAD) :
+ {
+ __usbram_start = . ;
+ __usbram_start__ = . ;
+ *(.usbram)
+ . = ALIGN(4);
+ } > URAM
+
+ .etherram (NOLOAD) :
+ {
+ __etherram_start = . ;
+ __etherram_start__ = . ;
+ *(.etherram)
+ . = ALIGN(4);
+ } > ERAM
+
+ .batteryram (NOLOAD) :
+ {
+ __batteryram_start = . ;
+ __batteryram_start__ = . ;
+ *(.batteryram)
+ . = ALIGN(4);
+ } > BRAM
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+}
diff --git a/nuttx/configs/olimex-lpc2378/ostest/setenv.sh b/nuttx/configs/olimex-lpc2378/ostest/setenv.sh
new file mode 100755
index 000000000..73bf3d223
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/ostest/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/olimex-lpc2378/ostest/setenv.sh
+#
+# Author: Rommel Marcelo
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export LPC23XXSCRIPTS="$WD/configs/olimex-lpc2378/scripts"
+export PATH="${BUILDROOT_BIN}:${LPC23XXSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-lpc2378/src/Makefile b/nuttx/configs/olimex-lpc2378/src/Makefile
new file mode 100644
index 000000000..a9fa9fc70
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/src/Makefile
@@ -0,0 +1,93 @@
+############################################################################
+# configs/mcu123-lpc214x/src/Makefile
+#
+# Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+# Author: Rommel Marcelo
+#
+# This is part of the NuttX RTOS and based on the LPC2148 port:
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/sched}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
+endif
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c
+#CSRCS += up_spi.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/olimex-lpc2378/src/up_leds.c b/nuttx/configs/olimex-lpc2378/src/up_leds.c
new file mode 100644
index 000000000..a5bb955f5
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/src/up_leds.c
@@ -0,0 +1,141 @@
+/****************************************************************************
+ * configs/olimex-lpc2378/src/up_leds.c
+ *
+ * Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+ * Author: Rommel Marcelo
+ *
+ * This is part of the NuttX RTOS and based on the LPC2148 port:
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <sys/types.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+//~ #define LPC23XX_FIO_BASE 0x3fffc000 /* Fast I/O 0 base address */
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* P3.0 : P0.7 PINSEL6 LEDS 1-8 */
+#define LEDBIT(led) (0x01 << (led))
+#define ALL_LEDS (0xFF)
+#define STATLED (0x08)
+//~ #ifdef CONFIG_LPC23XX_FIO
+# define putled8(v,o) putreg8((v), (LPC23XX_FIO_BASE+(o)))
+# define putled32(v,r) putreg32((v),(LPC23XX_FIO_BASE+(r)))
+# define CLRLEDS putled(ALL_LEDS,FIO3CLR0_OFFSET)
+
+# define LED_SET_OFFSET FIO3SET0_OFFSET
+# define LED_CLR_OFFSET FIO3CLR0_OFFSET
+# define LED_DIR_OFFSET FIO3DIR0_OFFSET
+# define LED_MASK_OFFSET FIO3MASK0_OFFSET
+
+//~ #else
+//~ # define putled(v,r) putreg32((v),(LPC23XX_GPIO1_BASE+(r)))
+//~ # define CLRLEDS putled(STATLED,LPC23XX_GPIO1_SET_OFFSET)
+//~
+//~ # define LED_SET_OFFSET LPC23XX_GPIO_SET_OFFSET
+//~ # define LED_CLR_OFFSET LPC23XX_GPIO_CLR_OFFSET
+//~ # define LED_DIR_OFFSET LPC23XX_GPIO_DIR_OFFSET
+//~ #endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Funtions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Initilize GIOs P1.16-P1.23 */
+
+ putled8(ALL_LEDS, LED_DIR_OFFSET);
+ putled8(ALL_LEDS, LED_CLR_OFFSET);
+ putled8(LEDBIT(0), LED_SET_OFFSET);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ putled8(~(LEDBIT(led)), LED_MASK_OFFSET);
+ putled8(LEDBIT(led), LED_SET_OFFSET);
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ putled8(LEDBIT(led), LED_CLR_OFFSET);
+}
+
+/****************************************************************************
+ * olimex board STATUS LED
+ ****************************************************************************/
+
+void up_statledoff(void)
+{
+ putled8(~STATLED, FIO1MASK2_OFFSET);
+ putled8(STATLED, FIO1CLR2_OFFSET);
+}
+
+void up_statledon(void)
+{
+ putled8(~STATLED, FIO1MASK2_OFFSET);
+ putled8(STATLED, FIO1SET2_OFFSET);
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/olimex-lpc2378/src/up_nsh.c b/nuttx/configs/olimex-lpc2378/src/up_nsh.c
new file mode 100644
index 000000000..6279a7668
--- /dev/null
+++ b/nuttx/configs/olimex-lpc2378/src/up_nsh.c
@@ -0,0 +1,114 @@
+/****************************************************************************
+ * config/olimex-lpc2378/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+ * Author: Rommel Marcelo
+ *
+ * This is part of the NuttX RTOS and based on the LPC2148 port:
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#undef NSH_HAVEUSBDEV
+#undef NSH_HAVEMMCSD
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ return OK;
+}
diff --git a/nuttx/configs/olimex-stm32-p107/Kconfig b/nuttx/configs/olimex-stm32-p107/Kconfig
new file mode 100644
index 000000000..b0b8a29d6
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_OLIMEX_STM32P107
+endif
diff --git a/nuttx/configs/olimex-stm32-p107/include/board.h b/nuttx/configs/olimex-stm32-p107/include/board.h
new file mode 100644
index 000000000..2fe6e5aaf
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/include/board.h
@@ -0,0 +1,117 @@
+/************************************************************************************
+ * configs/olimex-stm32-p107/include/board.h
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#define BOARD_CFGR_MCO_SOURCE RCC_CFGR_PLL3CLK
+
+/* Clocking *************************************************************************/
+
+/* On-board crystal frequency is 25MHz (HSE) */
+
+#define STM32_BOARD_XTAL 25000000ul
+#define STM32_PLL_FREQUENCY (72000000)
+#define STM32_SYSCLK_FREQUENCY STM32_PLL_FREQUENCY
+
+#define STM32_HCLK_FREQUENCY STM32_PLL_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB2 clock (PCLK2) is HCLK (72MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
+#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_APB2_CLKIN (STM32_PCLK2_FREQUENCY) /* Timers 2-7, 12-14 */
+
+/* APB2 timers 1 and 8 will receive PCLK2. */
+
+#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
+
+/* APB1 clock (PCLK1) is HCLK/2 (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd2
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB1 timers 2-4 will be twice PCLK1 (I presume the remaining will receive PCLK1) */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_board_clockconfig
+ *
+ * Description:
+ * Any STM32 board may replace the "standard" board clock configuration logic with
+ * its own, custom clock cofiguration logic.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
+void stm32_board_clockconfig(void);
+#endif
diff --git a/nuttx/configs/olimex-stm32-p107/nsh/Make.defs b/nuttx/configs/olimex-stm32-p107/nsh/Make.defs
new file mode 100644
index 000000000..422d48fb7
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/nsh/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/olimex-stm32-p107/nsh/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-stm32-p107/nsh/appconfig b/nuttx/configs/olimex-stm32-p107/nsh/appconfig
new file mode 100644
index 000000000..99e845ffb
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/nsh/appconfig
@@ -0,0 +1,54 @@
+############################################################################
+# configs/olimex-stm32-p107/nsh/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+CONFIGURED_APPS += examples/nsh
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+# CONFIGURED_APPS += netutils/resolv
+# CONFIGURED_APPS += netutils/webclient
+# CONFIGURED_APPS += netutils/tftpc
+# CONFIGURED_APPS += netutils/ftpc
+# CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
diff --git a/nuttx/configs/olimex-stm32-p107/nsh/defconfig b/nuttx/configs/olimex-stm32-p107/nsh/defconfig
new file mode 100644
index 000000000..91e757cf1
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/nsh/defconfig
@@ -0,0 +1,559 @@
+############################################################################
+# configs/olimex-stm32-p107/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F107VC=y
+CONFIG_ARCH_BOARD="olimex-stm32-p107"
+CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# Alternate pin mappings
+#
+CONFIG_STM32_TIM1_FULL_REMAP=n
+CONFIG_STM32_TIM1_PARTIAL_REMAP=n
+CONFIG_STM32_TIM2_FULL_REMAP=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_1=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_2=n
+CONFIG_STM32_TIM3_FULL_REMAP=n
+CONFIG_STM32_TIM3_PARTIAL_REMAP=n
+CONFIG_STM32_TIM4_REMAP=n
+CONFIG_STM32_USART1_REMAP=n
+CONFIG_STM32_USART2_REMAP=y
+CONFIG_STM32_USART3_FULL_REMAP=n
+CONFIG_STM32_USART3_PARTIAL_REMAP=n
+CONFIG_STM32_SPI1_REMAP=n
+CONFIG_STM32_SPI3_REMAP=n
+CONFIG_STM32_I2C1_REMAP=n
+CONFIG_STM32_CAN1_REMAP1=y
+CONFIG_STM32_CAN1_REMAP2=n
+
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGFS=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_PWR=y
+
+# APB1 (low speed)
+
+CONFIG_STM32_BKP=n
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_WWDG=n
+
+# APB2 (high speed)
+
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_NET=y
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+ONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=1020
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=n
+#
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#
+CONFIG_NET_STATISTICS=n
+#
+CONFIG_NET_BROADCAST=n
+#
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+#
+
+#
+# STM32F107vc Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=n
+CONFIG_STM32_RMII=y
+CONFIG_STM32_RMII_MCO=y
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=y
+CONFIG_NSH_DISABLEBG=y
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0xc0a80232
+CONFIG_NSH_DRIPADDR=0xc0a80201
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+CONFIG_NSH_DISABLE_GET=y
+CONFIG_NSH_DISABLE_PUT=y
+CONFIG_NSH_DISABLE_WGET=y
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+
+#
+# STM32F10xxx specific CAN device driver settings
+#
+CONFIG_CAN=y
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+# ISO-11783 requires the baud to be set to 250K
+CONFIG_CAN1_BAUD=700000
+# ISO-11783 requires the sample point to be within 75 to 80%
+CONFIG_CAN_TSEG1=12
+CONFIG_CAN_TSEG2=3
+
+CONFIG_EXAMPLES_CAN_READONLY=y
+CONFIG_EXAMPLES_CAN_WRITEONLY=n
+CONFIG_EXAMPLES_CAN_NMSGS=4
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-stm32-p107/nsh/setenv.sh b/nuttx/configs/olimex-stm32-p107/nsh/setenv.sh
new file mode 100755
index 000000000..004f025b8
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/nsh/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/olimex-stm32-p107/nsh/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-stm32-p107/ostest/Make.defs b/nuttx/configs/olimex-stm32-p107/ostest/Make.defs
new file mode 100644
index 000000000..36f9d83be
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/ostest/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/olimex-stm32-p107/ostest/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-stm32-p107/ostest/appconfig b/nuttx/configs/olimex-stm32-p107/ostest/appconfig
new file mode 100644
index 000000000..fca902395
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/ostest/appconfig
@@ -0,0 +1,38 @@
+############################################################################
+# configs/olimex-stm32-p107/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
diff --git a/nuttx/configs/olimex-stm32-p107/ostest/defconfig b/nuttx/configs/olimex-stm32-p107/ostest/defconfig
new file mode 100644
index 000000000..0a8d66455
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/ostest/defconfig
@@ -0,0 +1,513 @@
+############################################################################
+# configs/olimex-stm32-p107/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F107VC=y
+CONFIG_ARCH_BOARD="olimex-stm32-p107"
+CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Alternate pin mappings
+#
+CONFIG_STM32_TIM1_FULL_REMAP=n
+CONFIG_STM32_TIM1_PARTIAL_REMAP=n
+CONFIG_STM32_TIM2_FULL_REMAP=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_1=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_2=n
+CONFIG_STM32_TIM3_FULL_REMAP=n
+CONFIG_STM32_TIM3_PARTIAL_REMAP=n
+CONFIG_STM32_TIM4_REMAP=n
+CONFIG_STM32_USART1_REMAP=n
+CONFIG_STM32_USART2_REMAP=y
+CONFIG_STM32_USART3_FULL_REMAP=n
+CONFIG_STM32_USART3_PARTIAL_REMAP=n
+CONFIG_STM32_SPI1_REMAP=n
+CONFIG_STM32_SPI3_REMAP=n
+CONFIG_STM32_I2C1_REMAP=n
+CONFIG_STM32_CAN1_REMAP1=y
+CONFIG_STM32_CAN1_REMAP2=n
+
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=n
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=y
+CONFIG_STM32_SPFD5408B_DISABLE=y
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# STM32F103Z specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=1
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-stm32-p107/ostest/setenv.sh b/nuttx/configs/olimex-stm32-p107/ostest/setenv.sh
new file mode 100755
index 000000000..fe40c0bc1
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/ostest/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/olimex-stm32-p107/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-stm32-p107/scripts/ld.script b/nuttx/configs/olimex-stm32-p107/scripts/ld.script
new file mode 100644
index 000000000..5037954ba
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/scripts/ld.script
@@ -0,0 +1,106 @@
+/****************************************************************************
+ * configs/olimex-stm32-p107/scripts/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F107VC has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-stm32-p107/scripts/ld.script.dfu b/nuttx/configs/olimex-stm32-p107/scripts/ld.script.dfu
new file mode 100644
index 000000000..87acb12f9
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/scripts/ld.script.dfu
@@ -0,0 +1,106 @@
+/****************************************************************************
+ * configs/olimex-stm32-p107/scripts/ld.script.dfu
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* Don't know if this is correct. Just 256K-48K (not testet) */
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 208K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-stm32-p107/src/Makefile b/nuttx/configs/olimex-stm32-p107/src/Makefile
new file mode 100644
index 000000000..85a0722f3
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/src/Makefile
@@ -0,0 +1,89 @@
+############################################################################
+# configs/olimex-stm32-p107/src/Makefile
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_CAN),y)
+CSRCS += up_can.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/olimex-stm32-p107/src/up_boot.c b/nuttx/configs/olimex-stm32-p107/src/up_boot.c
new file mode 100644
index 000000000..d8cba509e
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/src/up_boot.c
@@ -0,0 +1,181 @@
+/************************************************************************************
+ * configs/olimex-stm32-p107/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+}
+
+/************************************************************************************
+ * Name: stm32_board_clockconfig
+ *
+ * Description:
+ * Any STM32 board may replace the "standard" board clock configuration logic with
+ * its own, custom clock cofiguration logic.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
+void stm32_board_clockconfig(void)
+{
+ uint32_t regval;
+
+ regval = getreg32(STM32_RCC_CR);
+ regval &= ~RCC_CR_HSEBYP; /* Disable HSE clock bypass */
+ regval |= RCC_CR_HSEON; /* Enable HSE */
+ putreg32(regval, STM32_RCC_CR);
+
+ /* Set flash wait states
+ * Sysclk runs with 72MHz -> 2 waitstates.
+ * 0WS from 0-24MHz
+ * 1WS from 24-48MHz
+ * 2WS from 48-72MHz
+ */
+
+ regval = getreg32(STM32_FLASH_ACR);
+ regval &= ~FLASH_ACR_LATENCY_MASK;
+ regval |= (FLASH_ACR_LATENCY_2|FLASH_ACR_PRTFBE);
+ putreg32(regval, STM32_FLASH_ACR);
+
+ regval = getreg32(STM32_RCC_CFGR2);
+ regval &= ~(RCC_CFGR2_PREDIV2_MASK
+ | RCC_CFGR2_PLL2MUL_MASK
+ | RCC_CFGR2_PREDIV1SRC_MASK
+ | RCC_CFGR2_PREDIV1_MASK);
+ regval |= RCC_CFGR2_PREDIV2d5; /* 25MHz / 5 */
+ regval |= RCC_CFGR2_PLL2MULx8; /* 5MHz * 8 => 40MHz */
+ regval |= RCC_CFGR2_PREDIV1SRC_PLL2; /* Use PLL2 as input for PREDIV1 */
+ regval |= RCC_CFGR2_PREDIV1d5; /* 40MHz / 5 => 8MHz */
+ putreg32(regval, STM32_RCC_CFGR2);
+
+ /* Set the PCLK2 divider */
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~(RCC_CFGR_PPRE2_MASK | RCC_CFGR_HPRE_MASK);
+ regval |= STM32_RCC_CFGR_PPRE2;
+ regval |= RCC_CFGR_HPRE_SYSCLK;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ /* Set the PCLK1 divider */
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_PPRE1_MASK;
+ regval |= STM32_RCC_CFGR_PPRE1;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLL2ON;
+ putreg32(regval, STM32_RCC_CR);
+
+ /* Wait for PLL2 ready */
+
+ while((getreg32(STM32_RCC_CR) & RCC_CR_PLL2RDY) == 0);
+
+ /* Setup PLL3 for RMII clock on MCO */
+
+ regval = getreg32(STM32_RCC_CFGR2);
+ regval &= ~(RCC_CFGR2_PLL3MUL_MASK);
+ regval |= RCC_CFGR2_PLL3MULx10;
+ putreg32(regval, STM32_RCC_CFGR2);
+
+ /* Switch PLL3 on */
+
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLL3ON;
+ putreg32(regval, STM32_RCC_CR);
+
+ while ((getreg32(STM32_RCC_CR) & RCC_CR_PLL3RDY) == 0);
+
+ /* Set main PLL source 8MHz * 9 => 72MHz*/
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL_MASK);
+ regval |= (RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL_CLKx9);
+ putreg32(regval, STM32_RCC_CFGR);
+
+ /* Switch main PLL on */
+
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLLON;
+ putreg32(regval, STM32_RCC_CR);
+
+ while ((getreg32(STM32_RCC_CR) & RCC_CR_PLLRDY) == 0);
+
+ /* Select PLL as system clock source */
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_SW_MASK;
+ regval |= RCC_CFGR_SW_PLL;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ /* Wait until PLL is used as the system clock source */
+
+ while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_PLL) == 0);
+}
+#endif
diff --git a/nuttx/configs/olimex-stm32-p107/src/up_can.c b/nuttx/configs/olimex-stm32-p107/src/up_can.c
new file mode 100644
index 000000000..f750092a3
--- /dev/null
+++ b/nuttx/configs/olimex-stm32-p107/src/up_can.c
@@ -0,0 +1,132 @@
+/************************************************************************************
+ * configs/olimex-stm32-p107/src/up_can.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/can.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm32_can.h"
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+/* The STM32F107VC supports CAN1 and CAN2 */
+
+#define CAN_PORT 1
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: can_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/can.
+ *
+ ************************************************************************************/
+
+int can_devinit(void)
+{
+ static bool initialized = false;
+ struct can_dev_s *can;
+ int ret;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Call stm32_caninitialize() to get an instance of the CAN interface */
+
+ can = stm32_caninitialize(CAN_PORT);
+ if (can == NULL)
+ {
+ candbg("ERROR: Failed to get CAN interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the CAN driver at "/dev/can0" */
+
+ ret = can_register("/dev/can0", can);
+ if (ret < 0)
+ {
+ candbg("ERROR: can_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_CAN && CONFIG_STM32_CAN1 */
diff --git a/nuttx/configs/olimex-strp711/Kconfig b/nuttx/configs/olimex-strp711/Kconfig
new file mode 100644
index 000000000..9771aba6d
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_OLIMEX_STRP711
+endif
diff --git a/nuttx/configs/olimex-strp711/README.txt b/nuttx/configs/olimex-strp711/README.txt
new file mode 100644
index 000000000..2af0b1466
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/README.txt
@@ -0,0 +1,435 @@
+README File for the Olimex STR-P711 NuttX Port
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Contents
+^^^^^^^^
+
+ Olimex STR-P711
+ Features
+ Power Supply
+ GIO Usage
+ Jumpers
+ External Interrupts
+ Development Environment
+ GNU Toolchain Options
+ NuttX buildroot Toolchain
+ Linux OpenOCD with Wiggler JTAG
+ Windows OpenOCD will Olimex JTAG
+ MMC/SD Slot
+ ENC28J60 Module
+ Configurations
+ STR71x-Specific Configuration Settings
+
+Olimex STR-P711
+^^^^^^^^^^^^^^^
+ Features:
+
+ - MCU: STR711FR2T6 16/32 bit ARM7TDMIâ„¢ with 256K Bytes Program Flash,
+ 64K Bytes RAM, USB 2.0, RTC, 12 bit ADC, 4x UARTs, 2x I2C,2x SPI,
+ 5x 32bit TIMERS, 2x PWM, 2x CCR, WDT, up to 50MHz operation
+ - Standard JTAG connector with ARM 2x10 pin layout for programming/debugging
+ with ARM-JTAG
+ - USB connector
+ - Two channel RS232 interface and drivers
+ - SD/MMC card connector
+ - Two buttons
+ - Trimpot connected to ADC
+ - Two status LEDs
+ - Buzzer
+ - UEXT - 10 pin extension connector for Olimex addon peripherials like MP3,
+ RF2.4Ghz, RFID etc. modules
+ - 2x SPI connectors
+ - I2C connector
+ - On board voltage regulator 3.3V with up to 800mA current
+ - Single power supply: 6V AC or DC required, USB port can power the board
+ - Power supply LED
+ - Power supply filtering capacitor
+ - RESET circuit
+ - RESET button
+ - 4 Mhz crystal oscillator
+ - 32768 Hz crystal and RTC
+
+ Power Supply
+
+ 6V AC or DC (or powered from USB port)
+
+ GIO with on-board connections (others available for prototyping):
+
+ SIGNAL DESCRIPTION PIN
+ ------- --------------------- -----
+ MISO1 BSPI0 to MMC/SD P0.4
+ MOSI1 " " "" " " P0.5
+ SCLK1 " " "" " " P0.6
+ SS1 " " "" " " P0.7
+ U0RX UART 0 P0.8
+ U0TX " " " P0.9
+ U1RX UART 1 P0.10
+ U1TX " " " P0.11
+ BUZZ Buzzer P0.13
+ WAKE-UP Button P0.15
+ AIN0 Potentiometer (AN_TR) P1.3
+ LED1 LED 1 P1.8
+ LED2 LED 2 P1.9
+ WP MMC/SD write protect P1.10
+ USBOP USB P1.11
+ USBON " " P1.12
+ BUT Button P1.13
+ CP MMC/SD card present P1.15
+
+ Jumpers
+ STNBY Will pull pin 23 /STDBY low
+
+ External Interrupt (XTI) availability.
+
+ XTI TQFP64
+ LINE PIN SIGNAL * OLIMEX USAGE
+ ---- ------ ------------------------- - ------------------------
+ 2 -- P2.8 (Not available in TQFP64)
+ 3 -- P2.9 (Not available in TQFP64)
+ 4 -- P2.10 (Not available in TQFP64)
+ 5 25 P2.11 (Not available in TQFP64)
+ 6 42 P1.11/CANRX USBOP (to USB connector)
+ 7 47 P1.13/HCLK/I0.SCL CLK ??????????????
+ 8 48 P1.14/HRXD/I0.SDA BUT button (PL open, PU closed)
+ 9 53 P0.1/S0.MOSI/U3.RX * SPI0-3 MOSI0
+ 10 54 P0.2/S0.SCLK/I1.SCL * SPI0-5 SCLK0
+ 11 61 P0.6/S1.SCLK * SPI1-5 SCLK1 (also to MMC slot)
+ 12 63 P0.8/U0.RX/U0.TX U0.TX
+ 13 1 P0.10/U1.RX/U1.TX/SC.DATA U1.RX
+ 14 5 P0.13/U2.RX/T2.OCMPA BUZZ (to buzzer circult)
+ 15 20 P0.15/WAKEUP WAKE-UP button (PL open, PU closed)
+
+ * Only these pins are available at a
+ connector and are not dedicated to
+ other board functions.
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The NuttX buildroot Toolchain (see below).
+ 2. The CodeSourcery GNU toolchain,
+ 3. The devkitARM GNU toolchain, or
+
+ All testing has been conducted using the NuttX buildroot toolchain. To use
+ the CodeSourcery or devkitARM GNU toolchain, you simply need to build the
+ system as follows:
+
+ make # Will build for the NuttX buildroot toolchain
+ make CROSSDEV=arm-eabi- # Will build for the devkitARM toolchain
+ make CROSSDEV=arm-none-eabi- # Will build for the CodeSourcery toolchain
+ make CROSSDEV=arm-elf- # Will build for the NuttX buildroot toolchain
+
+ Of course, hard coding this CROSS_COMPILE value in Make.defs file will save
+ some repetitive typing.
+
+ NOTE: the CodeSourcery and devkitARM toolchains are Windows native toolchains.
+ The NuttX buildroot toolchain is a Cygwin toolchain. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context; make CROSSDEV=arm-none-eabi-
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the CodeSourcery toolchain.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) may not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the ARM toolchain (if
+ different from the default).
+
+ If you have no ARM toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+
+ 1. You must have already configured Nuttx in <some-dir>nuttx.
+
+ cd tools
+ ./configure.sh olimex-strp711/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/arm-defconfig .config
+ or
+ cp configs/arm7tdmi-defconfig-4.3.3 .config (Last tested with this toolchain)
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h so that the PATH variable includes the path to the
+ newly built binaries.
+
+Linux OpenOCD with Wiggler JTAG
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+For a debug environment, I am using OpenOCD with a Wiggler-clone JTAG interface. The
+following steps worked for me with a 20081028 OpenOCD snapshot.
+
+GENERAL STEPS:
+
+1. Check out OpenOCD
+
+ svn checkout svn://svn.berlios.de/openocd/trunk openocd
+
+2. Build OpenOCD
+
+ Read the INSTALL file from the files you just downloaded. You probably just need
+ to run:
+
+ ./bootstrap
+
+ Then configure OpenOCD using the configure script created by ./bootstrap.
+
+ ./configure --enable-parport
+
+ Build OpenOCD with:
+
+ make
+
+ Install OpenOCD. Since we used the default configuration the code will be
+ installed at /usr/local/bin/openocd. Other files will be installed at
+ /usr/local/lib/openocd (configuration files, scripts, etc.) and /usr/local/share/info
+ (online documentation accessable via 'info openocd'). You need root priviledges
+ to do the following:
+
+ make install.
+
+3. Setup
+
+ OpenOCD reads its configuration from the file openocd.cfg in the current directory
+ when started. You have two different options:
+
+ * Create a symbolic link named openocd.cfg to one of the configuration files in
+ /usr/local/lib/openocd, or
+
+ * Use a custom configuration file specified with the ‘-f <conf.file>’ command line
+ switch opeion when starting OpenOCD.
+
+ For the STR-P711, I have included bash scripts in the scripts sub-directory.
+
+4. Running OpenOCD
+
+ Make sure the ARM7TDMI board is powered and the JTAG cable is connected
+
+ Run 'src/openocd -d' (might be required to be root) and check for any errors
+ reported. The '-d' option enables debugging info.
+
+5. Telnet interface
+
+ telnet into port 4444 to get a command interface: 'telnet localhost 4444'
+
+6. GDB
+
+ start arm-elf-gdb
+ type 'file <executable.elf>' to load the executable
+ type 'set debug remote 1' to enable tracing of gdb protocol (if required)
+ type 'target remote localhost:3333' to connect to the target
+ The same commands from the telnet interface can now be accessed through the
+ 'monitor' command, e.g. 'monitor help'
+
+Windows OpenOCD will Olimex JTAG
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ I have been using the Olimex ARM-USB-OCD JTAG debugger with the STR-P711
+ (http://www.olimex.com). The OpenOCD configuration file is here:
+ scripts/oocd_ft2xx.cfg. There is also a script on the scripts/ directory that
+ I used to start the OpenOCD daemon on my system called oocd.sh. That
+ script would probably require some modifications to work in another
+ environment:
+
+ - possibly the value of OPENOCD_PATH
+ - If you are working under Linux you will need to change any
+ occurances of `cygpath -w blablabla` to just blablabla
+
+ The setenv.sh file includes some environment varialble settings
+ that are needed by oocd.sh. If you have $PATH and other environment
+ variables set up, then you should be able to start the OpenOCD daemon like:
+
+ oocd.sh
+
+ To use the Windows Olimex USB JTAG (or 'oocd.sh pp' to use the Wriggler
+ JTAG) where it is assumed that you are executing oocd.sh from the top level
+ level NuttX directory.
+
+ Once the OpenOCD daemon has been started, you can connect to it via
+ GDB using the following GDB command:
+
+ arm-elf-gdb
+ (gdb) target remote localhost:3333
+
+ And you can load the NuttX ELF file into FLASH:
+
+ (gdb) load nuttx
+
+ (There are also some files in the scripts/ directory that I used to
+ get OpenOCD working with a Wriggler clone... I never got that stuff
+ working).
+
+MMC/SD Slot
+^^^^^^^^^^^
+
+ STR-P711 PIN MMC/SD USAGE PIN CONFIGURATION
+ ------------ ---------------- -----------------------
+ P0.7/S1.SS 1 CD/DAT3/CS P.07 output
+ P0.5/S1.MOSI 2 CMD/DI MOSI1
+ --- 3 VSS1 ---
+ --- 4 VDD ---
+ P0.6/S1.SCLK 5 CLK/SCLK SLCK1
+ --- 6 VSS2 ---
+ P0.4/S1.MISO 7 DAT0/D0 MISO1
+ --- 8 DAT1/RES (Pulled up)
+ --- 9 DAT2/RES (Pulled up)
+
+ P1.10/USBCLK 10/14 WP P1.10 input
+ P1.15/HTXD 13/15 CP P1.15 input
+
+ Use of SPI1 doesn't conflict with anything. WP conflicts USB; CP conflicts
+ with NTXD.
+
+ENC28J60 Module
+^^^^^^^^^^^^^^^
+
+ The ENC28J60 module does not come on the Olimex-STR-P711, but this describes
+ how I have connected it. NOTE that the ENC28J60 requires an external interrupt
+ (XTI) pin. The only easily accessible XTI pins are on SPI0/1 so you can't have
+ both SPI0 and 1 together with this configuration.
+
+ Module CON5 QFN ENC2860 Description
+ --------------- -------------------------------------------------------
+ 1 J8-1 NET CS 5 ~CS Chip select input pin for SPI interface (active low)
+ 2 2 SCK 4 SCK Clock in pin for SPI interface
+ 3 3 MOSI 3 SI Data in pin for SPI interface
+ 4 4 MISO 2 SO Data out pin for SPI interface
+ 5 5 GND -- --- ---
+ 10 J9-1 3V3 -- --- ---
+ 9 2 WOL 1 ~WOL Unicast WOL filter
+ 8 3 NET INT 28 ~INT Interrupt output pin (active low)
+ 7 4 CLKOUT 27 CLKOUT Programmable clock output pin
+ 6 5 NET RST 6 ~RESET Active-low device Reset input
+
+ For the Olimex STR-P711, the ENC28J60 module is placed on SPI0 and uses
+ P0.3 for CS, P0.6 for an interrupt, and P0.4 as a reset:
+
+ Module CON5 Olimex STR-P711 Connection
+ --------------- -------------------------------------------------------
+ 1 J8-1 NET CS SPI0-2 P0.3 output P0.3/S0.SS/I1.SDA
+ 2 2 SCK SPI0-5 SCLK0 P0.2/S0.SCLK/I1.SCL
+ 3 3 MOSI SPI0-3 MOSI0 P0.0/S0.MOSI/U3.RX
+ 4 4 MISO SPI0-4 MISO0 P0.1/S0.MISO/U3.TX
+ 5 5 GND SPI0-1 GND
+ 10 J9-1 3V3 SPI0-6 3.3V
+ 9 2 WOL NC
+ 8 3 NET INT SPI1-5 P0.6 XTI 11 P0.6/S1.SCLK
+ 7 4 CLKOUT NC
+ 6 5 NET RST SPI1-4 P0.4 output P0.4/S1.MISO
+
+ UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
+ interrupt conflict with TIM1.
+
+ NOTE: As of this writing, the ENC28J60 does not function on the board.
+ The board just locks up when the ENC29J60 is powered. Most likely,
+ in sufficient current is provided via USB to power both the board and
+ the ENC28J60 (And I don't have the correct wall wart to power the
+ the board).
+
+Configurations:
+---------------
+
+ nettest:
+ This configuration directory may be used to enable networking using the
+ an Microchip ENC28J60 SPI ethernet module (see above for connection to
+ STR-P711.
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest.
+
+STR71x-Specific Configuration Settings
+--------------------------------------
+
+ CONFIG_STR71X_I2C0, CONFIG_STR71X_I2C1, CONFIG_STR71X_UART0, CONFIG_STR71X_UART1,
+ CONFIG_STR71X_UART2, CONFIG_STR71X_UART3, CONFIG_STR71X_USB, CONFIG_STR71X_CAN,
+ CONFIG_STR71X_BSPI0, CONFIG_STR71X_BSPI1, CONFIG_STR71X_HDLC, CONFIG_STR71X_XTI,
+ CONFIG_STR71X_GPIO0, CONFIG_STR71X_GPIO1, CONFIG_STR71X_GPIO2, CONFIG_STR71X_ADC12,
+ CONFIG_STR71X_CKOUT, CONFIG_STR71X_TIM1, CONFIG_STR71X_TIM2, CONFIG_STR71X_TIM3, and
+ CONFIG_STR71X_RTC
+ Select peripherals to initialize (Timer0 and EIC are always initialized)
+ CONFIG_UART_PRI, STR71X_BSPI_PRI, CONFIG_TIM_PRI, CONFIG_USB_PRI
+ Can be defined to set the priority of NuttX managed devices. Default is 1.
+ CONFIG_STR71X_BANK0, CONFIG_STR71X_BANK1, CONFIG_STR71X_BANK2, and CONFIG_STR71X_BANK3
+ Enable initialize of external memory banks 0-3.
+ CONFIG_STR71X_BANK0_SIZE, CONFIG_STR71X_BANK1_SIZE, CONFIG_STR71X_BANK2_SIZE, and
+ CONFIG_STR71X_BANK3_SIZE
+ If a particular external memory bank is configured, then its width must be provided.
+ 8 and 16 (bits) are the only valid options.
+ CONFIG_STR71X_BANK0_WAITSTATES, CONFIG_STR71X_BANK1_WAITSTATES,
+ CONFIG_STR71X_BANK2_WAITSTATES, and CONFIG_STR71X_BANK3_WAITSTATES
+ If a particular external memory bank is configured, then the number of waistates
+ for the bank must also be provided. Valid options are {0, .., 15}
+ CONFIG_STR71X_BIGEXTMEM
+ The default is to provide 20 bits of address for all external memory regions. If
+ any memory region is larger than 1Mb, then this option should be selected. In this
+ case, 24 bits of addressing will be used
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0
+ CONFIG_UARTn_2STOP - Two stop bits
+
diff --git a/nuttx/configs/olimex-strp711/include/README.txt b/nuttx/configs/olimex-strp711/include/README.txt
new file mode 100644
index 000000000..56c17205e
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Olimex STR-P711 board.
diff --git a/nuttx/configs/olimex-strp711/include/board.h b/nuttx/configs/olimex-strp711/include/board.h
new file mode 100644
index 000000000..1a68ec741
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/include/board.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+ * configs/olimex-strp711/include/board.h
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/****************************************************************************
+ * Features:
+ *
+ * - MCU: STR711FR2T6 16/32 bit ARM7TDMIâ„¢ with 256K Bytes Program Flash,
+ * 64K Bytes RAM, USB 2.0, RTC, 12 bit ADC, 4x UARTs, 2x I2C,2x SPI,
+ * 5x 32bit TIMERS, 2x PWM, 2x CCR, WDT, up to 50MHz operation
+ * - Standard JTAG connector with ARM 2x10 pin layout for programming/debugging
+ * with ARM-JTAG
+ * - USB connector
+ * - Two channel RS232 interface and drivers
+ * - SD/MMC card connector
+ * - Two buttons
+ * - Trimpot connected to ADC
+ * - Two status LEDs
+ * - Buzzer
+ * - UEXT - 10 pin extension connector for Olimex addon peripherials like MP3,
+ * RF2.4Ghz, RFID etc. modules
+ * - 2x SPI connectors
+ * - I2C connector
+ * - On board voltage regulator 3.3V with up to 800mA current
+ * - Single power supply: 6V AC or DC required, USB port can power the board
+ * - Power supply LED
+ * - Power supply filtering capacitor
+ * - RESET circuit
+ * - RESET button
+ * - 4 Mhz crystal oscillator
+ * - 32768 Hz crystal and RTC
+ *
+ ****************************************************************************/
+
+#ifndef _CONFIGS_OLIMEX_STRP711_BOARD_H
+#define _CONFIGS_OLIMEX_STRP711_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "chip.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+/* Main Oscillator Frequency = 4MHz */
+
+#define STR71X_RCCU_MAIN_OSC (4000000)
+
+/* RTC Oscillator Frequency = 32,768 Hz */
+
+#define STR71X_RCCU_RTC_OSC (32768)
+
+/* HCLK driving PLL2 */
+
+#define STR71X_PCU_HCLK_OSC (4000000) /* ? */
+
+/* PLL1 Setup:
+ *
+ * PLL1 input clock: CLK2 = Main OSC = 4MHz
+ * PLL1 output clock: PLL1OUT = 16 * CLK2 / 2 = 32MHz
+ * PLL1 output: CLK3 = PLL1OUT = 32MHz (hard coded selection)
+ * RCLK = CLK3 = 32MHz (hard coded selection)
+ * APB1 peripheral clock: PCLK1 = RCLK = 32MHz
+ * APB2 peripheral clock: PCLK2 = RCLK = 32MHz
+ * Main system clock: MCLK = RCLK = 32MHz
+ */
+
+#undef STR71X_PLL1IN_DIV2 /* Don't divide main OSC by two */
+#define STR71X_PLL1OUT_MUL 16 /* PLL1OUT = 16 * CLK2 */
+#define STR71X_PLL1OUT_DIV 2 /* PLL1OUT = CLK2 / 2 */
+#define STR71X_APB1_DIV 1 /* PCLK1 = RCLK */
+#define STR71X_APB2_DIV 1 /* PCLK2 = RCLK */
+#define STR71X_MCLK_DIV 1 /* MCLK = RCLK */
+
+/* PLL2 Setup -- only needed for HDLC or USB
+ *
+ * USB input: USB clock
+ * HCLK = 4MHz?
+ * USB clock = 12 * HCLK / 1 = 48 MHz
+ */
+
+#undef STR71X_USBIN_PLL2 /* USB input is USB clock */
+#define STR71X_PLL2OUT_MUL 12 /* PLL2OUT = 12 * HCLK */
+#define STR71X_PLL2OUT_DIV 1 /* PLL2OUT = HCLK / 1 */
+
+/* LED definitions **********************************************************/
+
+/* The Olimex board has only two LEDs, so following states are faked as
+ * follows
+ *
+ * SET CLEAR
+ * LED_STARTED (none) (n/a)
+ * LED_HEAPALLOCATE LED1 (n/a)
+ * LED_IRQSENABLED LED1 (n/a)
+ * LED_STACKCREATED LED1 (n/a)
+ * LED_INIRQ LED1+LED2 LED1
+ * LED_SIGNAL LED1+LED2 LED1
+ * LED_ASSERTION LED1+LED2 LED1
+ * LED_PANIC LED1+LED2* LED1
+ *
+ * *The previous state of LED2 will be retained
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Button definitions *******************************************************/
+
+/* The Olimex board has two buttons, one labled "BUT" and the other "WAKEUP" */
+
+#define BUT_BUTTON 1 /* Bit 0: BUT button is depressed */
+#define WAKEUP_BUTTON 2 /* Bit 1: WAKEUP button is depressed */
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* _CONFIGS_OLIMEX_STRP711_BOARD_H */
diff --git a/nuttx/configs/olimex-strp711/nettest/Make.defs b/nuttx/configs/olimex-strp711/nettest/Make.defs
new file mode 100644
index 000000000..f160c16f7
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nettest/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/olimex-strp711/nettest/Make.defs
+#
+# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-strp711/nettest/appconfig b/nuttx/configs/olimex-strp711/nettest/appconfig
new file mode 100644
index 000000000..bbe7abc02
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nettest/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/olimex-strp711/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/olimex-strp711/nettest/defconfig b/nuttx/configs/olimex-strp711/nettest/defconfig
new file mode 100755
index 000000000..f69d3f8cb
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nettest/defconfig
@@ -0,0 +1,398 @@
+############################################################################
+# configs/olimes-strp711/nettest/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="str71x"
+CONFIG_ARCH_CHIP_STR71X=y
+CONFIG_ARCH_BOARD="olimex-strp711"
+CONFIG_ARCH_BOARD_OLIMEX_STRP711=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=1431
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# STR71x specific boot/build settings
+#
+CONFIG_STR71X_I2C0=n
+CONFIG_STR71X_I2C1=n
+CONFIG_STR71X_UART0=y
+CONFIG_STR71X_UART1=y
+CONFIG_STR71X_UART2=n
+CONFIG_STR71X_UART3=n
+CONFIG_STR71X_USB=n
+CONFIG_STR71X_CAN=n
+CONFIG_STR71X_BSPI0=y
+CONFIG_STR71X_BSPI1=n
+CONFIG_STR71X_HDLC=n
+CONFIG_STR71X_XTI=y
+CONFIG_STR71X_GPIO0=y
+CONFIG_STR71X_GPIO1=y
+CONFIG_STR71X_GPIO2=n
+CONFIG_STR71X_ADC12=n
+CONFIG_STR71X_CKOUT=n
+CONFIG_STR71X_TIM1=n
+CONFIG_STR71X_TIM2=n
+CONFIG_STR71X_TIM3=n
+CONFIG_STR71X_RTC=n
+CONFIG_STR71X_BANK0=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK0_WAITSTATES=0
+CONFIG_STR71X_BANK1=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK1_WAITSTATES=0
+CONFIG_STR71X_BANK2=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK3_WAITSTATES=0
+CONFIG_STR71X_BANK3=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK2_WAITSTATES=0
+CONFIG_STR71X_BIGEXTMEM=n
+
+#
+# STR71x specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART2_BAUD=38400
+CONFIG_UART3_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# ENC28J60 configuration
+#
+CONFIG_ENC28J60=y
+#CONFIG_ENC28J60_SPIMODE
+CONFIG_ENC28J60_FREQUENCY=20000000
+CONFIG_ENC28J60_NINTERFACES=1
+CONFIG_ENC28J60_STATS=y
+CONFIG_ENC28J60_HALFDUPPLEX=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STR71X USB Configuration
+#
+CONFIG_STR71X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_STR71X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_STR71X_USBDEV_DMA=n
+CONFIG_STR71X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_STR71X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-strp711/nettest/ld.script b/nuttx/configs/olimex-strp711/nettest/ld.script
new file mode 100755
index 000000000..b3b5c6ff8
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nettest/ld.script
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/olimex-strp711/nettest/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The str71x has 256Kb of non-volatile memory beginning at address
+ * 0x4000:0000 for program storage (Bank0, an addition 16Kb is available
+ * for data storage in Bank1). The OS entry point is via the reset vector
+ * at address 0x00000000 where the FLASH is remapped at reset.
+ *
+ * The str71x has 64Kb of on-chip static RAM beginning at address
+ * 0x2000:0000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+/* The STR711 has 256Kb of FLASH beginning at address 0x4000:0000 and 64Kb
+ * of SRAM beginning at address 0x2000:0000
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x40000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-strp711/nettest/setenv.sh b/nuttx/configs/olimex-strp711/nettest/setenv.sh
new file mode 100755
index 000000000..bc47c3ed8
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nettest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-strp711/nettest/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export STR41XSCRIPTS="$WD/configs/olimex-strp711/scripts"
+export PATH="${BUILDROOT_BIN}:${STR41XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-strp711/nsh/Make.defs b/nuttx/configs/olimex-strp711/nsh/Make.defs
new file mode 100644
index 000000000..229da6bff
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nsh/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/olimex-strp711/nsh/Make.defs
+#
+# Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-strp711/nsh/appconfig b/nuttx/configs/olimex-strp711/nsh/appconfig
new file mode 100644
index 000000000..57fbdfeb3
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/olimex-strp711/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/olimex-strp711/nsh/defconfig b/nuttx/configs/olimex-strp711/nsh/defconfig
new file mode 100644
index 000000000..985e3690e
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nsh/defconfig
@@ -0,0 +1,369 @@
+############################################################################
+# configs/olimes-strp711/nsh/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="str71x"
+CONFIG_ARCH_CHIP_STR71X=y
+CONFIG_ARCH_BOARD="olimex-strp711"
+CONFIG_ARCH_BOARD_OLIMEX_STRP711=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=1431
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# STR71x specific boot/build settings
+#
+CONFIG_STR71X_I2C0=n
+CONFIG_STR71X_I2C1=n
+CONFIG_STR71X_UART0=y
+CONFIG_STR71X_UART1=y
+CONFIG_STR71X_UART2=n
+CONFIG_STR71X_UART3=n
+CONFIG_STR71X_USB=n
+CONFIG_STR71X_CAN=n
+CONFIG_STR71X_BSPI0=n
+CONFIG_STR71X_BSPI1=y
+CONFIG_STR71X_HDLC=n
+CONFIG_STR71X_XTI=n
+CONFIG_STR71X_GPIO0=y
+CONFIG_STR71X_GPIO1=y
+CONFIG_STR71X_GPIO2=n
+CONFIG_STR71X_ADC12=n
+CONFIG_STR71X_CKOUT=n
+CONFIG_STR71X_TIM1=n
+CONFIG_STR71X_TIM2=n
+CONFIG_STR71X_TIM3=n
+CONFIG_STR71X_RTC=n
+CONFIG_STR71X_BANK0=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK0_WAITSTATES=0
+CONFIG_STR71X_BANK1=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK1_WAITSTATES=0
+CONFIG_STR71X_BANK2=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK3_WAITSTATES=0
+CONFIG_STR71X_BANK3=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK2_WAITSTATES=0
+CONFIG_STR71X_BIGEXTMEM=n
+
+#
+# STR71x specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART2_BAUD=38400
+CONFIG_UART3_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=5
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STR71X USB Configuration
+#
+CONFIG_STR71X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_STR71X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_STR71X_USBDEV_DMA=n
+CONFIG_STR71X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_STR71X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-strp711/nsh/ld.script b/nuttx/configs/olimex-strp711/nsh/ld.script
new file mode 100644
index 000000000..7a95410f4
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nsh/ld.script
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/olimex-strp711/nsh/ld.script
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The str71x has 256Kb of non-volatile memory beginning at address
+ * 0x4000:0000 for program storage (Bank0, an addition 16Kb is available
+ * for data storage in Bank1). The OS entry point is via the reset vector
+ * at address 0x00000000 where the FLASH is remapped at reset.
+ *
+ * The str71x has 64Kb of on-chip static RAM beginning at address
+ * 0x2000:0000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+/* The STR711 has 256Kb of FLASH beginning at address 0x4000:0000 and 64Kb
+ * of SRAM beginning at address 0x2000:0000
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x40000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-strp711/nsh/setenv.sh b/nuttx/configs/olimex-strp711/nsh/setenv.sh
new file mode 100755
index 000000000..6724741f6
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-strp711/nsh/setenv.sh
+#
+# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export STR41XSCRIPTS="$WD/configs/olimex-strp711/scripts"
+export PATH="${BUILDROOT_BIN}:${STR41XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-strp711/ostest/Make.defs b/nuttx/configs/olimex-strp711/ostest/Make.defs
new file mode 100644
index 000000000..6c5632950
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/ostest/Make.defs
@@ -0,0 +1,161 @@
+##############################################################################
+# configs/olimex-strp711/ostest/Make.defs
+#
+# Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# The default value for CROSSDEV can be overridden from the make command line:
+# make -- Will build for the NuttX buildroot toolchain
+# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
+# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
+# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ($(ARCHCCMAJOR),4)
+ifneq ($(HOSTOS),Cygwin)
+OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
+endif
+endif
+
+ifeq ($(CROSSDEV),arm-elf-)
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+ MAXOPTIMIZATION = -Os
+else
+ WINTOOL = y
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ifeq ($(ARCHCCMAJOR),4)
+ ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
+else
+ ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
+ -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
+ -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/olimex-strp711/ostest/appconfig b/nuttx/configs/olimex-strp711/ostest/appconfig
new file mode 100644
index 000000000..422014304
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/olimex-strp711/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/olimex-strp711/ostest/defconfig b/nuttx/configs/olimex-strp711/ostest/defconfig
new file mode 100644
index 000000000..cdac22b9f
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/ostest/defconfig
@@ -0,0 +1,369 @@
+############################################################################
+# configs/olimes-strp711/ostest/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM7TDMI=y
+CONFIG_ARCH_CHIP="str71x"
+CONFIG_ARCH_CHIP_STR71X=y
+CONFIG_ARCH_BOARD="olimex-strp711"
+CONFIG_ARCH_BOARD_OLIMEX_STRP711=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=1431
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# STR71x specific boot/build settings
+#
+CONFIG_STR71X_I2C0=n
+CONFIG_STR71X_I2C1=n
+CONFIG_STR71X_UART0=y
+CONFIG_STR71X_UART1=y
+CONFIG_STR71X_UART2=n
+CONFIG_STR71X_UART3=n
+CONFIG_STR71X_USB=n
+CONFIG_STR71X_CAN=n
+CONFIG_STR71X_BSPI0=n
+CONFIG_STR71X_BSPI1=n
+CONFIG_STR71X_HDLC=n
+CONFIG_STR71X_XTI=n
+CONFIG_STR71X_GPIO0=y
+CONFIG_STR71X_GPIO1=y
+CONFIG_STR71X_GPIO2=n
+CONFIG_STR71X_ADC12=n
+CONFIG_STR71X_CKOUT=n
+CONFIG_STR71X_TIM1=n
+CONFIG_STR71X_TIM2=n
+CONFIG_STR71X_TIM3=n
+CONFIG_STR71X_RTC=n
+CONFIG_STR71X_BANK0=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK0_WAITSTATES=0
+CONFIG_STR71X_BANK1=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK1_WAITSTATES=0
+CONFIG_STR71X_BANK2=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK3_WAITSTATES=0
+CONFIG_STR71X_BANK3=n
+CONFIG_STR71X_BANK0_SIZE=16
+CONFIG_STR71X_BANK2_WAITSTATES=0
+CONFIG_STR71X_BIGEXTMEM=n
+
+#
+# STR71x specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART0_BAUD=38400
+CONFIG_UART1_BAUD=38400
+CONFIG_UART2_BAUD=38400
+CONFIG_UART3_BAUD=38400
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STR71X USB Configuration
+#
+CONFIG_STR71X_USBDEV_FRAME_INTERRUPT=n
+CONFIG_STR71X_USBDEV_EPFAST_INTERRUPT=n
+CONFIG_STR71X_USBDEV_DMA=n
+CONFIG_STR71X_USBDEV_NDMADESCRIPTORS=0
+CONFIG_STR71X_USBDEV_DMAINTMASK=0
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/olimex-strp711/ostest/ld.script b/nuttx/configs/olimex-strp711/ostest/ld.script
new file mode 100644
index 000000000..9a5c45745
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/ostest/ld.script
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/olimex-strp711/ostest/ld.script
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The str71x has 256Kb of non-volatile memory beginning at address
+ * 0x4000:0000 for program storage (Bank0, an addition 16Kb is available
+ * for data storage in Bank1). The OS entry point is via the reset vector
+ * at address 0x00000000 where the FLASH is remapped at reset.
+ *
+ * The str71x has 64Kb of on-chip static RAM beginning at address
+ * 0x2000:0000. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+/* The STR711 has 256Kb of FLASH beginning at address 0x4000:0000 and 64Kb
+ * of SRAM beginning at address 0x2000:0000
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x40000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ /* This is where the .data section is relocated for execution out
+ * FLASH. The .data section will be relocated from _eronly
+ * to _sdata at boot time.
+ */
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/olimex-strp711/ostest/setenv.sh b/nuttx/configs/olimex-strp711/ostest/setenv.sh
new file mode 100755
index 000000000..c9454d26f
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/ostest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/olimex-strp711/ostest/setenv.sh
+#
+# Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export STR41XSCRIPTS="$WD/configs/olimex-strp711/scripts"
+export PATH="${BUILDROOT_BIN}:${STR41XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/olimex-strp711/ostest/test-results.txt b/nuttx/configs/olimex-strp711/ostest/test-results.txt
new file mode 100644
index 000000000..035b45271
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/ostest/test-results.txt
@@ -0,0 +1,405 @@
+This is output from examples/ostest collected on June 3, 2009 on the Olimex STR-P711
+development board.
+====================================================================================
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+user_start: Exitting
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 2, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena edf0 edf0
+ordblks 2 2
+mxordblk c2d0 c2d0
+uordblks 1d00 1d00
+fordblks d0f0 d0f0
+user_main: Exitting
diff --git a/nuttx/configs/olimex-strp711/scripts/oocd-reset b/nuttx/configs/olimex-strp711/scripts/oocd-reset
new file mode 100644
index 000000000..11d7a3dd6
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/scripts/oocd-reset
@@ -0,0 +1,41 @@
+#
+# The following command wills be executed on
+# reset (because of run_and_init in the config-file)
+# - wait for target halt
+# - erase memory
+# - flash content of file main.bin into target-memory
+# - shutdown openocd
+#
+# created by Martin Thomas 8/2007
+# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects
+# based on information from Dominic Rath
+#
+
+arm7_9 dcc_downloads enable
+wait_halt
+sleep 10
+poll
+flash probe 0
+
+# STR710FZ2 erase all banks:
+#flash erase 0 0 9
+# STR710FZ2 erase first 5 banks (0-4)
+flash erase 0 0 4
+# if flash earse is not available in your OpenOCD-version use
+# flash erase_sector but also read the documentation on
+# flash auto_erase which can be used together with flash write_image
+
+flash write 0 main.bin 0x0
+# flash write may not be available in your OpenOCD-version
+# alternative: flash write_binary (flash write_binary <bank-num> <file> <offset>)
+# flash write_binary 0 main.bin 0x0
+# flash write_binary may not be available in your OpenOCD-version
+# alternatives: flash write_bank or flash write_image
+# syntax: flash write_image <file> [offset] [type] where type can
+# be ihex, bin, elf or s19
+# flash write_bank flash-bank bin-filename offset
+# i.e. flash write_bank 0 main.bin 0x0
+
+reset run
+sleep 10
+shutdown
diff --git a/nuttx/configs/olimex-strp711/scripts/oocd.sh b/nuttx/configs/olimex-strp711/scripts/oocd.sh
new file mode 100755
index 000000000..f0ba81761
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/scripts/oocd.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# Set up pathes to binaries, scripts, configuration files
+
+hostos=`uname -o 2>/dev/null || echo "Other"`
+if [ "X${hostos}" = "XCygwin" ]; then
+ installdir=/cygdrive/c/gccfd/openocd/bin
+ ft2exe=$installdir/openocd-ftd2xx.exe
+ ppexe=$installdir/openocd-ppdev.exe
+else
+ installdir=/usr/local/bin
+ ft2exe=$installdir/openocd
+ ppexe=$installdir/openocd
+ SUDO=sudo
+fi
+
+# The root to the top-level NuttX directory should be in an environment variable
+
+if [ -z $STR41XSCRIPTS ]; then
+ echo "Environment variable $STR41XSCRIPTS is not defined"
+ echo "Has NuttX been configured?"
+ echo "If so, try sourcing the setenv.sh script in the top-level directory"
+ exit 1
+fi
+
+# Check that at least one configuration file exists at that point
+if [ ! -f $STR41XSCRIPTS/oocd_ft2xx.cfg ]; then
+ echo "No configuration files found at $STR41XSCRIPTS"
+ echo "Path to configuration files unknown"
+ exit 1
+fi
+
+# Parse command line inputs
+
+usage="USAGE: $0 [-h] [-d] [-pp] [-ft2xx]"
+
+debug=no
+oocdcfg=$STR41XSCRIPTS/oocd_ft2xx.cfg
+openocd=$ft2exe
+while [ ! -z "$1" ]; do
+ case $1 in
+ -d )
+ debug=yes
+ set -x
+ ;;
+ -pp )
+ oocdcfg=$STR41XSCRIPTS/oocd_wiggler.cfg
+ openocd=$ppexe
+ ;;
+ -ft2xx )
+ oocdcfg=$STR41XSCRIPTS/oocd_ft2xx.cfg
+ openocd=$ft2exe
+ ;;
+ -h )
+ echo $usage
+ exit 0
+ ;;
+ * )
+ echo "Unrecognized option: $1"
+ echo $usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+# Setup debug options
+
+export options="-d 1"
+
+# Run OpenOCD -- here it is assumed (1) that you must have root priveleges to
+# execute OpenOCD and (2) that your user is listed in the /etc/sudoers file.
+
+$SUDO $openocd $options -f $oocdcfg
+if [ "X${hostos}" = "XCygwin" ]; then
+ $openocd $options -f `cygpath -w $oocdcfg`
+else
+ sudo $openocd $options -f $oocdcfg
+fi
diff --git a/nuttx/configs/olimex-strp711/scripts/oocd_flash.script b/nuttx/configs/olimex-strp711/scripts/oocd_flash.script
new file mode 100644
index 000000000..d07067544
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/scripts/oocd_flash.script
@@ -0,0 +1,26 @@
+#
+# The following command will be executed on reset
+# - wait for target halt
+# - erase memory
+# - flash content of file nuttx.bin into target-memory
+# - shutdown openocd
+#
+# Based on file originally created by Martin Thomas
+#
+
+arm7_9 dcc_downloads enable
+wait_halt
+sleep 10
+poll
+flash probe 0
+
+# STR710 erase all banks:
+#flash erase 0 0 9
+# STR710 erase first 4 banks (32kB)
+flash erase 0 0 4
+
+flash write 0 nuttx.bin 0x0
+reset run
+sleep 10
+shutdown
+
diff --git a/nuttx/configs/olimex-strp711/scripts/oocd_ft2xx.cfg b/nuttx/configs/olimex-strp711/scripts/oocd_ft2xx.cfg
new file mode 100755
index 000000000..a5c027bff
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/scripts/oocd_ft2xx.cfg
@@ -0,0 +1,37 @@
+#daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+#interface
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG A"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15BA 0x0003
+jtag_speed 0
+
+#use combined on interfaces or targets that can't set TRST/SRST separately
+reset_config trst_and_srst srst_pulls_trst
+
+#jtag scan chain
+#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
+jtag_device 4 0x1 0xf 0xe
+
+#target configuration
+daemon_startup reset
+
+#target <type> <startup mode>
+#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
+target arm7tdmi little run_and_halt 0 arm7tdmi
+run_and_halt_time 0 30
+
+working_area 0 0x2000C000 0x4000 nobackup
+
+#flash bank <driver> <base> <size> <chip_width> <bus_width>
+flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
+#flash bank cfi 0x60000000 0x00400000 2 2 0
+
+#Script used for FLASH programming
+#target_script 0 reset str71x_flashprogram.ocd
+
+# For more information about the configuration files, take a look at:
+# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger
diff --git a/nuttx/configs/olimex-strp711/scripts/oocd_wiggler.cfg b/nuttx/configs/olimex-strp711/scripts/oocd_wiggler.cfg
new file mode 100644
index 000000000..ece900669
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/scripts/oocd_wiggler.cfg
@@ -0,0 +1,46 @@
+# Daemon configuration
+telnet_port 4444
+gdb_port 3333
+
+# Interface - Wiggler-Type JTAG-device (see /usr/local/lib/openocd/interface/parport.cfg)
+interface parport
+parport_port 0x378
+parport_cable wiggler
+jtag_speed 0
+jtag_nsrst_delay 20
+jtag_ntrst_delay 20
+
+# Start the OpenOCD daemon and reset the processor
+init
+reset halt
+
+# (See /usr/local/lib/openocd/target/str710.cfg)
+# Start slow, speed up after reset
+jtag_khz 10
+
+# Use combined on interfaces or targets that can't set TRST/SRST separately
+reset_config trst_and_srst srst_pulls_trst
+
+# Jtag scan chain
+# format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
+jtag_device 4 0x1 0xf 0xe
+
+# target <type> <startup mode>
+# target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
+target arm7tdmi little 0 arm7tdmi
+[new_target_name] configure -event reset-start { jtag_khz 10 }
+[new_target_name] configure -event reset-init { jtag_khz 6000 }
+[new_target_name] configure -event old-gdb_program_config { script event/str710_program.script }
+
+target_script 0 reset oocd_flash.script
+
+# Flash-configuration STR710FZ2/STR711FR2:
+# internal flash at address 0x40000000 size 256kB (0x40000)
+# internal ram at address 0x20000000 size 64kB (0x10000)
+# a 16kB working area inside RAM:
+working_area 0 0x2000C000 0x4000 nobackup
+
+# Flash bank str7x <base> <size> 0 0 <target#> <variant>
+flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
+flash bank str7x 0x400C0000 0x00004000 0 0 0 STR71x
+
diff --git a/nuttx/configs/olimex-strp711/scripts/usb-driver.txt b/nuttx/configs/olimex-strp711/scripts/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/scripts/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/olimex-strp711/src/Makefile b/nuttx/configs/olimex-strp711/src/Makefile
new file mode 100644
index 000000000..95073eca1
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/Makefile
@@ -0,0 +1,90 @@
+############################################################################
+# configs/olimex-strp711/src/Makefile
+#
+# Copyright (C) 2007-2008, 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/sched}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched
+endif
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_spi.c up_leds.c up_buttons.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_ENC28J60),y)
+CSRCS += up_enc28j60.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/olimex-strp711/src/README.txt b/nuttx/configs/olimex-strp711/src/README.txt
new file mode 100644
index 000000000..238283302
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/README.txt
@@ -0,0 +1,2 @@
+This directory contains drivers unique to the Olimex STR-P711 board.
+
diff --git a/nuttx/configs/olimex-strp711/src/up_buttons.c b/nuttx/configs/olimex-strp711/src/up_buttons.c
new file mode 100644
index 000000000..e8737954c
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/up_buttons.c
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * configs/olimex-strp711/src/up_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* The Olimex board has two buttons, one labled "BUT" and the other "WAKEUP"
+ *
+ * P0.15: WAKEUP button
+ * P1.13: BUT button
+ */
+
+#define STR71X_BUTBUTTON_GPIO1 (0x2000)
+#define STR71X_WAKEUPBUTTON_GPIO0 (0x8000)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+void up_buttoninit(void)
+{
+ uint16_t reg16;
+
+ /* Configure the GPIO0 & 1 pins as inputs */
+
+ reg16 = getreg16(STR71X_GPIO0_PC0);
+ reg16 |= STR71X_WAKEUPBUTTON_GPIO0;
+ putreg16(reg16, STR71X_GPIO0_PC0);
+
+ reg16 = getreg16(STR71X_GPIO0_PC1);
+ reg16 &= ~STR71X_WAKEUPBUTTON_GPIO0;
+ putreg16(reg16, STR71X_GPIO0_PC1);
+
+ reg16 = getreg16(STR71X_GPIO0_PC2);
+ reg16 &= ~STR71X_WAKEUPBUTTON_GPIO0;
+ putreg16(reg16, STR71X_GPIO0_PC2);
+
+ reg16 = getreg16(STR71X_GPIO1_PC0);
+ reg16 |= STR71X_BUTBUTTON_GPIO1;
+ putreg16(reg16, STR71X_GPIO1_PC0);
+
+ reg16 = getreg16(STR71X_GPIO1_PC1);
+ reg16 &= ~STR71X_BUTBUTTON_GPIO1;
+ putreg16(reg16, STR71X_GPIO1_PC1);
+
+ reg16 = getreg16(STR71X_GPIO1_PC2);
+ reg16 &= ~STR71X_BUTBUTTON_GPIO1;
+ putreg16(reg16, STR71X_GPIO1_PC2);
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+
+ if ((getreg16(STR71X_GPIO0_PD) & STR71X_WAKEUPBUTTON_GPIO0) != 0)
+ {
+ ret |= WAKEUP_BUTTON;
+ }
+
+ if ((getreg16(STR71X_GPIO1_PD) & STR71X_BUTBUTTON_GPIO1) != 0)
+ {
+ ret |= BUT_BUTTON;
+ }
+
+ return ret;
+}
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/olimex-strp711/src/up_enc28j60.c b/nuttx/configs/olimex-strp711/src/up_enc28j60.c
new file mode 100644
index 000000000..68ab0e785
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/up_enc28j60.c
@@ -0,0 +1,251 @@
+/****************************************************************************
+ * configs/olimex-strp711/src/up_enc28j60.c
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/*
+ * ENC28J60 Module
+ *
+ * The ENC28J60 module does not come on the Olimex-STR-P711, but this
+ * describes how I have connected it. NOTE that the ENC28J60 requires an
+ * external interrupt (XTI) pin. The only easily accessible XTI pins are on
+ * SPI0/1 so you can't have both SPI0 and 1 together with this configuration.
+ *
+ * Module CON5 QFN ENC2860 Description
+ * --------------- -------------------------------------------------------
+ * 1 J8-1 NET CS 5 ~CS Chip select input pin for SPI interface (active low)
+ * 2 2 SCK 4 SCK Clock in pin for SPI interface
+ * 3 3 MOSI 3 SI Data in pin for SPI interface
+ * 4 4 MISO 2 SO Data out pin for SPI interface
+ * 5 5 GND -- --- ---
+ * 10 J9-1 3V3 -- --- ---
+ * 9 2 WOL 1 ~WOL Unicast WOL filter
+ * 8 3 NET INT 28 ~INT Interrupt output pin (active low)
+ * 7 4 CLKOUT 27 CLKOUT Programmable clock output pin
+ * 6 5 NET RST 6 ~RESET Active-low device Reset input
+ *
+ * For the Olimex STR-P711, the ENC28J60 module is placed on SPI0 and uses
+ * P0.3 for CS, P0.6 for an interrupt, and P0.4 as a reset:
+ *
+ * Module CON5 Olimex STR-P711 Connection
+ * --------------- -------------------------------------------------------
+ * 1 J8-1 NET CS SPI0-2 P0.3 output P0.3/S0.SS/I1.SDA
+ * 2 2 SCK SPI0-5 SCLK0 P0.2/S0.SCLK/I1.SCL
+ * 3 3 MOSI SPI0-3 MOSI0 P0.0/S0.MOSI/U3.RX
+ * 4 4 MISO SPI0-4 MISO0 P0.1/S0.MISO/U3.TX
+ * 5 5 GND SPI0-1 GND
+ * 10 J9-1 3V3 SPI0-6 3.3V
+ * 9 2 WOL NC
+ * 8 3 NET INT SPI1-5 P0.6 XTI 11 P0.6/S1.SCLK
+ * 7 4 CLKOUT NC
+ * 6 5 NET RST SPI1-4 P0.4 output P0.4/S1.MISO
+ *
+ * UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
+ * interrupt conflict with TMR1.
+ */
+
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/net/enc28j60.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "str71x_internal.h"
+
+#ifdef CONFIG_ENC28J60
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* We assume that the ENC28J60 is on SPI0 */
+
+#ifndef CONFIG_STR71X_BSPI0
+# error "Need CONFIG_STR71X_BSPI0 in the configuration"
+#endif
+
+#ifndef CONFIG_STR71X_XTI
+# error "Need CONFIG_STR71X_XTI in the configuration"
+#endif
+
+/* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
+ * interrupt conflict with BSPI1.
+ */
+
+#ifdef CONFIG_STR71X_UART3
+# error "CONFIG_STR71X_UART3 cannot be used in this configuration"
+#endif
+
+#ifdef CONFIG_STR71X_I2C1
+# error "CONFIG_STR71X_I2C1 cannot be used in this configuration"
+#endif
+
+#ifdef CONFIG_STR71X_BSP1
+# error "CONFIG_STR71X_BSP1 cannot be used in this configuration"
+#endif
+
+/* SPI Assumptions **********************************************************/
+
+#define ENC28J60_SPI_PORTNO 0 /* On SPI0 */
+#define ENC28J60_DEVNO 0 /* Only one ENC28J60 */
+#define ENC28J60_IRQ STR71X_IRQ_PORT0p6 /* XTI Line 11: P0.6 */
+
+/* ENC28J60 additional pins *************************************************
+ *
+ * NOTE: The ENC28J60 is a 3.3V part; however, it was designed to be
+ * easily integrated into 5V systems. The SPI CS, SCK and SI inputs,
+ * as well as the RESET pin, are all 5V tolerant. On the other hand,
+ * if the host controller is operated at 5V, it quite likely will
+ * not be within specifications when its SPI and interrupt inputs
+ * are driven by the 3.3V CMOS outputs on the ENC28J60. A
+ * unidirectional level translator would be necessary.
+ */
+
+# define ENC_GPIO0_CS (1 << 3) /* Chip select (P0.3) */
+# define ENC_GPIO0_NETRST (1 << 4) /* Reset (P0.4) */
+# define ENC_GPIO0_NETINT (1 << 6) /* Interrupt (P0.6) */
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int up_attach(FAR struct enc_lower_s *lower, xcpt_t handler);
+static void up_enable(FAR struct enc_lower_s *lower);
+static void up_disable(FAR struct enc_lower_s *lower);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* The ENC28J60 normal provides interrupts to the MCU via a GPIO pin. The
+ * following structure provides an MCU-independent mechanixm for controlling
+ * the ENC28J60 GPIO interrupt.
+ */
+
+static const struct enc_lower_s g_enclower =
+{
+ .attach = up_attach,
+ .enable = up_enable,
+ .disable = up_disable
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: struct enc_lower_s methods
+ ****************************************************************************/
+
+static int up_attach(FAR const struct enc_lower_s *lower, xcpt_t handler)
+{
+ return irq_attach(ENC28J60_IRQ, handler)
+}
+
+static void up_enable(FAR const struct enc_lower_s *lower)
+{
+ up_enable_irq(ENC28J60_IRQ);
+}
+
+static void up_disable(FAR const struct enc_lower_s *lower)
+{
+ up_disable_irq(ENC28J60_IRQ);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_netinitialize
+ ****************************************************************************/
+
+void up_netinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ uint16_t reg16;
+ int ret;
+
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(ENC28J60_SPI_PORTNO);
+ if (!spi)
+ {
+ nlldbg("Failed to initialize SPI port %d\n", ENC28J60_SPI_PORTNO);
+ return;
+ }
+
+ /* Configure the XTI for the ENC28J60 interrupt. */
+
+ ret = str71x_xticonfig(ENC28J60_IRQ, false);
+ if (ret < 0)
+ {
+ nlldbg("Failed configure interrupt for IRQ %d: %d\n", ENC28J60_IRQ, ret);
+ return;
+ }
+
+ /* Take ENC28J60 out of reset (active low)*/
+
+ reg16 = getreg16(STR71X_GPIO0_PD);
+ reg16 &= ~ENC_GPIO0_NETRST;
+ putreg16(reg16, STR71X_GPIO0_PD);
+
+ /* Bind the SPI port to the ENC28J60 driver */
+
+ ret = enc_initialize(spi, &g_enclower, ENC28J60_DEVNO);
+ if (ret < 0)
+ {
+ nlldbg("Failed to bind SPI port %d ENC28J60 device %d: %d\n",
+ ENC28J60_SPI_PORTNO, ENC28J60_DEVNO, ret);
+ return;
+ }
+
+ nllvdbg("Bound SPI port %d to ENC28J60 device %d\n",
+ ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
+}
+#endif /* CONFIG_ENC28J60 */
diff --git a/nuttx/configs/olimex-strp711/src/up_leds.c b/nuttx/configs/olimex-strp711/src/up_leds.c
new file mode 100644
index 000000000..2d099f6bc
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/up_leds.c
@@ -0,0 +1,218 @@
+/****************************************************************************
+ * configs/olimex-strp711/src/up_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* There are two LEDs are connected to P1.8 & 9 */
+
+#if defined(CONFIG_ARCH_LEDS) && !defined(CONFIG_STR71X_GPIO1)
+# error "LEDs require GPIO1"
+#endif
+
+#define STR71X_LED1GPIO1_BIT (0x0100)
+#define STR71X_LED2GPIO1_BIT (0x0200)
+#define STR71X_LEDGPIO1_BITS (STR71X_LED1GPIO1_BIT|STR71X_LED2GPIO1_BIT)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static uint16_t g_led2set;
+static uint16_t g_led2clr;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+static void up_setleds(uint16_t setbits, uint16_t clearbits)
+{
+ uint16_t reg16;
+
+ /* Save the state of LED2 for later */
+
+ g_led2set = setbits & STR71X_LED2GPIO1_BIT;
+ g_led2clr = clearbits & STR71X_LED2GPIO1_BIT;
+
+ /* Set and clear bits as directed */
+
+ reg16 = getreg16(STR71X_GPIO1_PD);
+ reg16 &= ~clearbits;
+ reg16 |= setbits;
+ putreg16(reg16, STR71X_GPIO1_PD);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ uint16_t reg16;
+
+ /* Set normal function output */
+
+ reg16 = getreg16(STR71X_GPIO1_PC0);
+ reg16 |= STR71X_LEDGPIO1_BITS;
+ putreg16(reg16, STR71X_GPIO1_PC0);
+
+ reg16 = getreg16(STR71X_GPIO1_PC1);
+ reg16 &= ~STR71X_LEDGPIO1_BITS;
+ putreg16(reg16, STR71X_GPIO1_PC1);
+
+ reg16 = getreg16(STR71X_GPIO1_PC2);
+ reg16 |= STR71X_LEDGPIO1_BITS;
+ putreg16(reg16, STR71X_GPIO1_PC2);
+
+ /* Clear the LEDs (1 clears; 0 sets) */
+
+ reg16 = getreg16(STR71X_GPIO1_PD);
+ reg16 |= STR71X_LEDGPIO1_BITS;
+ putreg16(reg16, STR71X_GPIO1_PD);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ /* The Olimex board has only two LEDs, so following states are faked as
+ * follows
+ *
+ * SET CLEAR
+ * LED_STARTED (none) (n/a)
+ * LED_HEAPALLOCATE LED1 (n/a)
+ * LED_IRQSENABLED LED1 (n/a)
+ * LED_STACKCREATED LED1 (n/a)
+ * LED_INIRQ LED1+LED2 LED1
+ * LED_SIGNAL LED1+LED2 LED1
+ * LED_ASSERTION LED1+LED2 LED1
+ * LED_PANIC LED1+LED2* LED1
+ *
+ * *The previous state of LED2 will be retained
+ */
+
+ switch (led)
+ {
+ default:
+ case LED_STARTED:
+ up_setleds(0, STR71X_LED1GPIO1_BIT|STR71X_LED2GPIO1_BIT); /* Clear LED1&2 */
+ break;
+
+ case LED_HEAPALLOCATE:
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ up_setleds(STR71X_LED1GPIO1_BIT, STR71X_LED2GPIO1_BIT); /* Set LED1, clear LED2 */
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ up_setleds(STR71X_LED1GPIO1_BIT|STR71X_LED2GPIO1_BIT, 0); /* Set LED1&2 */
+ break;
+
+ case LED_PANIC:
+ up_setleds(STR71X_LED2GPIO1_BIT|g_led2set, g_led2set); /* Set LED1, preserve LED2 */
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ /* The Olimex board has only two LEDs, so following states are faked as
+ * follows
+ *
+ * SET CLEAR
+ * LED_STARTED (none) (n/a)
+ * LED_HEAPALLOCATE LED1 (n/a)
+ * LED_IRQSENABLED LED1 (n/a)
+ * LED_STACKCREATED LED1 (n/a)
+ * LED_INIRQ LED1+LED2 LED1
+ * LED_SIGNAL LED1+LED2 LED1
+ * LED_ASSERTION LED1+LED2 LED1
+ * LED_PANIC LED1+LED2* LED1
+ *
+ * *The previous state of LED2 will be retained
+ */
+
+ switch (led)
+ {
+ default:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
+ break;
+
+ case LED_INIRQ:
+ case LED_SIGNAL:
+ case LED_ASSERTION:
+ up_setleds(STR71X_LED1GPIO1_BIT, STR71X_LED2GPIO1_BIT); /* Set LED1, clear LED2 */
+ break;
+
+ case LED_PANIC:
+ up_setleds(g_led2set, STR71X_LED1GPIO1_BIT|g_led2clr); /* Clear LED1, preserve LED2 */
+ break;
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/olimex-strp711/src/up_nsh.c b/nuttx/configs/olimex-strp711/src/up_nsh.c
new file mode 100644
index 000000000..21c3efb83
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/up_nsh.c
@@ -0,0 +1,167 @@
+/****************************************************************************
+ * config/olimex-strp711/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_OLIMEX_STRP711
+# define NSH_HAVEUSBDEV 1
+# ifdef CONFIG_STR71X_BSPI1
+# define NSH_HAVEMMCSD 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
+# error "The Olimex STR-P711 MMC/SD is on BSPI1"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 0
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The Olimex STR-P711 MMC/SD is on BSPI1 slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+# else
+# undef NSH_HAVEMMCSD
+# endif
+#else
+ /* Add configuration for new STR71x boards here */
+# error "Unrecognized STR71x board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+#ifdef NSH_HAVEMMCSD
+
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ message("nsh_archinitialize: Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
+#endif
+
+ return OK;
+}
diff --git a/nuttx/configs/olimex-strp711/src/up_spi.c b/nuttx/configs/olimex-strp711/src/up_spi.c
new file mode 100644
index 000000000..452a43fb7
--- /dev/null
+++ b/nuttx/configs/olimex-strp711/src/up_spi.c
@@ -0,0 +1,1121 @@
+/****************************************************************************
+ * config/olimex-strp711/src/up_spi.c
+ *
+ * Copyright (C) 2008-2010,2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+
+#include <arch/board/board.h>
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+
+#include "up_internal.h"
+#include "up_arch.h"
+
+#include "chip.h"
+#include "str71x_internal.h"
+
+#if defined(CONFIG_STR71X_BSPI0) || defined(CONFIG_STR71X_BSPI1)
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_STR714X_BSPI0_TXFIFO_DEPTH
+# define CONFIG_STR714X_BSPI0_TXFIFO_DEPTH 8
+#endif
+
+#ifndef CONFIG_STR714X_BSPI0_RXFIFO_DEPTH
+# define CONFIG_STR714X_BSPI0_RXFIFO_DEPTH 8
+#endif
+
+#ifndef CONFIG_STR714X_BSPI1_TXFIFO_DEPTH
+# define CONFIG_STR714X_BSPI1_TXFIFO_DEPTH 8
+#endif
+
+#ifndef CONFIG_STR714X_BSPI1_RXFIFO_DEPTH
+# define CONFIG_STR714X_BSPI1_RXFIFO_DEPTH 8
+#endif
+
+#if defined(CONFIG_STR71X_UART3) && defined (CONFIG_STR71X_BSPI0)
+# warning "BSPI0 GPIO usage conflicts with UART3"
+#endif
+
+#if defined(CONFIG_STR71X_IC21) && defined (CONFIG_STR71X_BSPI0)
+# warning "BSPI0 GPIO usage conflicts with IC21"
+#endif
+
+#if defined(CONFIG_STR71X_HDLC) && defined (CONFIG_STR71X_BSPI1)
+# warning "BSPI1 GPIO usage conflicts with HDLC"
+#endif
+
+/****************************************************************************
+ * On the Olimex-STR-STR-P711, BSPI0 is not connected on board, but is
+ * available on a header for use in the prototyping area. BSPI connects
+ * to the MMC/SD card slot.
+ *
+ * GPIO pin configurations (STR710/STR711,2,5).
+ * BSP0:
+ * PIN NORMAL ALTERNATE Olimex-STR-STR-P711 Connection
+ * 123/52 P0.0 S0.MISO * UEXT-3 (Not connected on board)
+ * 124/53 P0.1 S0.MOSI * UEXT-4 " " " " "" " "
+ * 125/54 P0.2 S0.SCLK ** UEXT-5 " " " " "" " "
+ * 126/55 P0.3 ~SO.SS ** UEXT-6 " " " " "" " "
+ *
+ * * Programming the AF function selects UART3 by default. BSPI must be
+ * enabled with the SPI_EN bit in the BOOTCR register
+ * ** Programming the AF function selects I2C1 by default. BSPI must be
+ * enabled with the SPI_EN bit in the BOOTCR register
+ *
+ * BSP1
+ * PIN NORMAL ALTERNATE Olimex-STR-STR-P711 Connection
+ * 127/56 P0.4 S1.MISO SD_CARDBOT DAT0/D0
+ * 140/60 P0.5 S1.MOSI SD_CARDBOT CMD/DI
+ * 141/61 P0.6 S1.SCLK SD_CARDBOT CLK/SCLK
+ * 142/62 P0.7 ~S1.SS SD_CARDBOT CD/DAT/CS
+ *
+ * Two GPIO pins also connect to the MMC/SD slot:
+ *
+ * PIN NORMAL ALTERNATE Olimex-STR-STR-P711 Connection
+ * 106/46 P1.10 USB clock MMC/SD write protect (WP)
+ * 111/49 P1.15 HDLC xmit MMC/SD card present (CP)
+ *
+ ****************************************************************************/
+
+/* SPI0 *********************************************************************/
+
+#define BSPI0_GPIO0_MISO (1 << 0)
+#define BSPI0_GPIO0_MOSI (1 << 1)
+#define BSPI0_GPIO0_SCLK (1 << 2)
+#define BSPI0_GPIO0_SS (1 << 3) /* Not used */
+
+#define BSPI0_GPIO0_ALT (BSPI0_GPIO0_MISO|BSPI0_GPIO0_MOSI|BSPI0_GPIO0_SCLK)
+
+/* ENC28J60 Module
+ *
+ * The ENC28J60 module does not come on the Olimex-STR-P711, but this describes
+ * how I have connected it. NOTE that the ENC28J60 requires an external interrupt
+ * (XTI) pin. The only easily accessible XTI pins are on SPI0/1 so you can't have
+ * both SPI0 and 1 together with this configuration.
+ *
+ * STR-P711 PIN PIN CONFIGURATION ENC28J60 CONNECTION
+ * ----------------------- ----------------- -----------------------
+ * P0.3/S0.SS/I1.SDA P0.3 output CON5 1 J8-1 NET CS
+ * P0.2/S0.SCLK/I1.SCL SCLK0 2 2 SCK
+ * P0.0/S0.MOSI/U3.RX MOSI0 3 3 MOSI
+ * P0.1/S0.MISO/U3.TX MISO0 4 4 MISO
+ * GND GND 5 5 GND
+ * 3.3V 3.3V 10 J9-1 3V3
+ * NC NC 9 2 WOL
+ * P0.6/S1.SCLK P0.6 input 8 3 NET INT
+ * NC NC 7 4 CLKOUT
+ * P0.4/S1.MISO P0.4 output 6 5 NET RST
+ */
+
+#ifdef CONFIG_ENC28J60
+
+/* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
+ * interrupt conflict with BSPI1
+ */
+
+# ifdef CONFIG_STR71X_BSPI1
+# warning "CONFIG_STR71X_BSPI1 cannot be used in this configuration"
+# endif
+
+/* ENC28J60 additional pins
+ *
+ * NOTE: The ENC28J60 is a 3.3V part; however, it was designed to be
+ * easily integrated into 5V systems. The SPI CS, SCK and SI inputs,
+ * as well as the RESET pin, are all 5V tolerant. On the other hand,
+ * if the host controller is operated at 5V, it quite likely will
+ * not be within specifications when its SPI and interrupt inputs
+ * are driven by the 3.3V CMOS outputs on the ENC28J60. A
+ * unidirectional level translator would be necessary.
+ */
+
+# define ENC_GPIO0_CS (1 << 3)
+# define ENC_GPIO0_NETRST (1 << 4)
+# define ENC_GPIO0_NETINT (1 << 6)
+
+# define ENC_GPIO0_INTTL (0)
+# define ENC_GPIO0_INCMOS ENC_GPIO0_NETINT
+# define ENC_GPIO0_OUTPP (ENC_GPIO0_CS|ENC_GPIO0_NETRST)
+# define ENC_GPIO0_ALL (ENC_GPIO0_CS|ENC_GPIO0_NETINT|ENC_GPIO0_NETRST)
+
+# define BSPI0_GPIO0_INTTL ENC_GPIO0_INTTL
+# define BSPI0_GPIO0_INCMOS ENC_GPIO0_INCMOS
+# define BSPI0_GPIO0_OUTPP ENC_GPIO0_OUTPP
+# define BSPI0_GPIO0_ALL (BSPI0_GPIO0_ALT|ENC_GPIO0_ALL)
+
+#else
+# define BSPI0_GPIO0_INTTL (0)
+# define BSPI0_GPIO0_INCMOS (0)
+# define BSPI0_GPIO0_OUTPP (0)
+# define BSPI0_GPIO0_ALL BSPI0_GPIO0_ALT
+#endif
+
+/* SPI1 *********************************************************************/
+
+#define BSPI1_GPIO0_MISO (1 << 4)
+#define BSPI1_GPIO0_MOSI (1 << 5)
+#define BSPI1_GPIO0_SCLK (1 << 6)
+#define BSPI1_GPIO0_SS (1 << 7) /* Not used */
+
+#define BSPI1_GPIO0_ALT (BSPI1_GPIO0_MISO|BSPI1_GPIO0_MOSI|BSPI1_GPIO0_SCLK)
+
+/* MMC/SD Pin Usage:
+ *
+ * STR-P711 PIN MMC/SD USAGE PIN CONFIGURATION
+ * ------------ ---------------- -----------------------
+ * P0.7/S1.SS 1 CD/DAT3/CS P0.7 output
+ * P0.5/S1.MOSI 2 CMD/DI MOSI1
+ * --- 3 VSS1 ---
+ * --- 4 VDD ---
+ * P0.6/S1.SCLK 5 CLK/SCLK SLCK1
+ * --- 6 VSS2 ---
+ * P0.4/S1.MISO 7 DAT0/D0 MISO1
+ * --- 8 DAT1/RES (Pulled up)
+ * --- 9 DAT2/RES (Pulled up)
+ *
+ * P1.10/USBCLK 10/14 WP P1.10 input
+ * P1.15/HTXD 13/15 CP P1.15 input
+ *
+ * Use of SPI1 doesn't conflict with anything. WP conflicts USB; CP conflicts
+ * with HTXD.
+ */
+
+/* MMC/SD additional pins */
+
+#define MMCSD_GPIO0_CS (1 << 7)
+#define MMCSD_GPIO0_INTTL (0)
+#define MMCSD_GPIO0_INCMOS (0)
+#define MMCSD_GPIO0_OUTPP MMCSD_GPIO0_CS
+#define MMCSD_GPIO0_ALL MMCSD_GPIO0_CS
+
+#define MMCSD_GPIO1_WPIN (1 << 10)
+#define MMCSD_GPIO1_CPIN (1 << 15)
+#define MMCSD_GPIO1_INTTL (MMCSD_GPIO1_WPIN|MMCSD_GPIO1_CPIN)
+#define MMCSD_GPIO1_INCMOS (0)
+#define MMCSD_GPIO1_OUTPP (0)
+#define MMCSD_GPIO1_ALL (MMCSD_GPIO1_WPIN|MMCSD_GPIO1_CPIN)
+
+#define BSPI1_GPIO0_INTTL MMCSD_GPIO0_INTTL
+#define BSPI1_GPIO0_INCMOS MMCSD_GPIO0_INCMOS
+#define BSPI1_GPIO0_OUTPP MMCSD_GPIO0_OUTPP
+#define BSPI1_GPIO0_ALL (BSPI1_GPIO0_ALT|MMCSD_GPIO0_ALL)
+
+#define BSPI1_GPIO1_INTTL MMCSD_GPIO1_INTTL
+#define BSPI1_GPIO1_INCMOS MMCSD_GPIO1_INCMOS
+#define BSPI1_GPIO1_OUTPP MMCSD_GPIO1_OUTPP
+#define BSPI1_GPIO1_ALL MMCSD_GPIO1_ALL
+
+/* Configuration register settings ******************************************/
+
+#if CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 1
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE1
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 2
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE12
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 3
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE13
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 4
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE14
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 5
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE15
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 6
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE16
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 7
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE17
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 8
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE18
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 9
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE19
+#elif CONFIG_STR714X_BSPI0_RXFIFO_DEPTH == 10
+# define STR71X_BSPI0_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE110
+#else
+# error "Invaid RX FIFO depth setting"
+#endif
+
+#define STR71X_BSPI0_CSR1DISABLE STR71X_BSPI0_CSR1RXFIFODEPTH
+#define STR71X_BSPI0_CSR1ENABLE (STR71X_BSPICSR1_BSPE|STR71X_BSPICSR1_MSTR|STR71X_BSPI0_CSR1RXFIFODEPTH)
+
+#if CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 1
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE1
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 2
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE12
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 3
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE13
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 4
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE14
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 5
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE15
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 6
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE16
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 7
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE17
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 8
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE18
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 9
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE19
+#elif CONFIG_STR714X_BSPI0_TXFIFO_DEPTH == 10
+# define STR71X_BSPI0_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE110
+#else
+# error "Invaid TX FIFO depth setting"
+#endif
+
+#define STR71X_BSPI0_CSR2VALUE STR71X_BSPI0_CSR1TXFIFODEPTH
+
+#if CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 1
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE1
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 2
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE12
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 3
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE13
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 4
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE14
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 5
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE15
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 6
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE16
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 7
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE17
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 8
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE18
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 9
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE19
+#elif CONFIG_STR714X_BSPI1_RXFIFO_DEPTH == 10
+# define STR71X_BSPI1_CSR1RXFIFODEPTH STR71X_BSPICSR1_RFE110
+#else
+# error "Invaid RX FIFO depth setting"
+#endif
+
+#define STR71X_BSPI1_CSR1DISABLE STR71X_BSPI1_CSR1RXFIFODEPTH
+#define STR71X_BSPI1_CSR1ENABLE (STR71X_BSPICSR1_BSPE|STR71X_BSPICSR1_MSTR|STR71X_BSPI1_CSR1RXFIFODEPTH)
+
+#if CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 1
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE1
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 2
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE12
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 3
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE13
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 4
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE14
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 5
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE15
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 6
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE16
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 7
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE17
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 8
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE18
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 9
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE19
+#elif CONFIG_STR714X_BSPI1_TXFIFO_DEPTH == 10
+# define STR71X_BSPI1_CSR1TXFIFODEPTH STR71X_BSPICSR2_TFE110
+#else
+# error "Invaid TX FIFO depth setting"
+#endif
+
+#define STR71X_BSPI1_CSR2VALUE STR71X_BSPI1_CSR1TXFIFODEPTH
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* NOTE: As implemented here, this driver will support only one device per
+ * SPI bus: Only one chip select, csbit, per bus; no locking, not mode or
+ * bits-per-word settings. To support multiple devices per but, spi_select
+ * would also require some logic changes.
+ */
+
+struct str71x_spidev_s
+{
+ struct spi_dev_s spidev; /* Externally visible part of the SPI interface */
+ bool initialized; /* Initialize port only once! */
+ uint32_t spibase; /* BSPIn base address */
+ uint16_t csbit; /* BSPIn SS bit int GPIO0 */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/* Helpers */
+
+static inline uint16_t spi_getreg(FAR struct str71x_spidev_s *priv, uint8_t offset);
+static inline void spi_putreg(FAR struct str71x_spidev_s *priv, uint8_t offset, uint16_t value);
+static inline void spi_drain(FAR struct str71x_spidev_s *priv);
+
+/* SPI methods */
+
+#ifndef CONFIG_SPI_OWNBUS
+static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
+#endif
+static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+#ifdef CONFIG_SPI_CMDDATA
+static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+#endif
+static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd);
+static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t buflen);
+static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct spi_ops_s g_spiops =
+{
+#ifndef CONFIG_SPI_OWNBUS
+ .lock = spi_lock,
+#endif
+ .select = spi_select,
+ .setfrequency = spi_setfrequency,
+ .status = spi_status,
+#ifdef CONFIG_SPI_CMDDATA
+ .cmddata = spi_cmddata,
+#endif
+ .send = spi_send,
+ .sndblock = spi_sndblock,
+ .recvblock = spi_recvblock,
+ .registercallback = 0, /* Not implemented */
+};
+
+#ifdef CONFIG_STR71X_BSPI0
+static struct str71x_spidev_s g_spidev0 =
+{
+ .spidev = { &g_spiops },
+ .spibase = STR71X_BSPI0_BASE,
+ .csbit = MMCSD_GPIO0_CS
+};
+#endif
+
+#ifdef CONFIG_STR71X_BSPI1
+static struct str71x_spidev_s g_spidev1 =
+{
+ .spidev = { &g_spiops },
+ .spibase = STR71X_BSPI1_BASE,
+ .csbit = ENC_GPIO0_CS
+};
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: spi_getreg
+ *
+ * Description:
+ * Get the contents of the SPI register at offset
+ *
+ * Input Parameters:
+ * priv - private SPI device structure
+ * offset - offset to the register of interest
+ *
+ * Returned Value:
+ * The contents of the 16-bit register
+ *
+ ****************************************************************************/
+
+static inline uint16_t spi_getreg(FAR struct str71x_spidev_s *priv, uint8_t offset)
+{
+ return getreg16(priv->spibase + offset);
+}
+
+/****************************************************************************
+ * Name: spi_putreg
+ *
+ * Description:
+ * Write a 16-bit value to the SPI register at offset
+ *
+ * Input Parameters:
+ * priv - private SPI device structure
+ * offset - offset to the register of interest
+ * value - the 16-bit value to be written
+ *
+ * Returned Value:
+ * The contents of the 16-bit register
+ *
+ ****************************************************************************/
+
+static inline void spi_putreg(FAR struct str71x_spidev_s *priv, uint8_t offset, uint16_t value)
+{
+ putreg16(value, priv->spibase + offset);
+}
+
+/****************************************************************************
+ * Name: spi_drain
+ *
+ * Description:
+ * Drain any bytes left in the fifos.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static inline void spi_drain(FAR struct str71x_spidev_s *priv)
+{
+#if CONFIG_STR714X_BSPI0_TXFIFO_DEPTH > 1
+ /* Wait while the TX FIFO is full */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFF) != 0);
+#else
+ /* Wait until the TX FIFO is empty */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFE) == 0);
+#endif
+ /* Write 0xff to the TX FIFO */
+
+ spi_putreg(priv, STR71X_BSPI_TXR_OFFSET, 0xff00);
+
+ /* Wait for the TX FIFO empty */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFNE) != 0);
+
+ /* Wait for the RX FIFO not empty */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_RFNE) == 0);
+
+ /* Then read and discard bytes until the RX FIFO is empty */
+
+ do
+ {
+ (void)spi_getreg(priv, STR71X_BSPI_RXR_OFFSET);
+ }
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_RFNE) != 0);
+}
+
+/****************************************************************************
+ * Name: spi_lock
+ *
+ * Description:
+ * On SPI busses where there are multiple devices, it will be necessary to
+ * lock SPI to have exclusive access to the busses for a sequence of
+ * transfers. The bus should be locked before the chip is selected. After
+ * locking the SPI bus, the caller should then also call the setfrequency,
+ * setbits, and setmode methods to make sure that the SPI is properly
+ * configured for the device. If the SPI buss is being shared, then it
+ * may have been left in an incompatible state.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * lock - true: Lock spi bus, false: unlock SPI bus
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_SPI_OWNBUS
+static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
+{
+ /* Not implemented */
+
+ return -ENOSYS;
+}
+#endif
+
+/****************************************************************************
+ * Name: spi_select
+ *
+ * Description:
+ * Enable/disable the SPI slave select. The implementation of this method
+ * must include handshaking: If a device is selected, it must hold off
+ * all other attempts to select the device until the device is deselected.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * devid - Identifies the device to select
+ * selected - true: slave selected, false: slave de-selected
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
+ uint16_t reg16;
+
+ DEBUGASSERT(priv && priv->spibase);
+
+ reg16 = spi_getreg(priv, STR71X_GPIO_PD_OFFSET);
+ if (selected)
+ {
+ /* Enable slave select (low enables) */
+
+ reg16 &= ~priv->csbit;
+ spi_putreg(priv, STR71X_GPIO_PD_OFFSET, reg16);
+ }
+ else
+ {
+ /* Disable slave select (low enables) */
+
+ reg16 |= priv->csbit;
+ spi_putreg(priv, STR71X_GPIO_PD_OFFSET, reg16);
+
+ /* And drain the FIFOs */
+
+ spi_drain(priv);
+ }
+}
+
+/****************************************************************************
+ * Name: spi_setfrequency
+ *
+ * Description:
+ * Set the SPI frequency.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * frequency - The SPI frequency requested
+ *
+ * Returned Value:
+ * Returns the actual frequency selected
+ *
+ ****************************************************************************/
+
+static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
+{
+ FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
+ uint32_t divisor;
+ uint32_t cr1;
+
+ DEBUGASSERT(priv && priv->spibase);
+
+ /* The BSPI clock is determined by divider the APB1 clock (PCLK1).
+ *
+ * Eg. PCLK1 = 32MHz, frequency = 20000000:
+ * correct divisor is 2.1, calculated value is 2.
+ */
+
+ divisor = (STR71X_PCLK1 + (frequency >> 1)) / frequency;
+
+ /* The divisor must be an even number and contrained to the range of
+ * 5 (master mode, or 7 for slave mode) and 255. These bits must
+ * be configured BEFORE the BSPE or MSTR bits.. i.e., before the SPI
+ * is put into master mode.
+ */
+
+ divisor <<= 1; /* The full, even divisor */
+ if (divisor < 6)
+ {
+ divisor = 6;
+ }
+ else if (divisor > 254)
+ {
+ divisor = 254;
+ }
+
+ /* The BSPI must be disable when the following setting is made. */
+
+ cr1 = spi_getreg(priv, STR71X_BSPI_CSR1_OFFSET);
+ cr1 &= ~(STR71X_BSPICSR1_BSPE|STR71X_BSPICSR1_MSTR);
+ spi_putreg(priv, STR71X_BSPI_CSR1_OFFSET, cr1);
+ spi_putreg(priv, STR71X_BSPI_CLK_OFFSET, (uint16_t)divisor);
+
+ /* Now we can enable the BSP in master mode */
+
+ cr1 |= (STR71X_BSPICSR1_BSPE|STR71X_BSPICSR1_MSTR);
+ spi_putreg(priv, STR71X_BSPI_CSR1_OFFSET, cr1);
+
+ return STR71X_PCLK1 / divisor;
+}
+
+/****************************************************************************
+ * Name: spi_status
+ *
+ * Description:
+ * Get SPI/MMC status
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * devid - Identifies the device to report status on
+ *
+ * Returned Value:
+ * Returns a bitset of status values (see SPI_STATUS_* defines
+ *
+ ****************************************************************************/
+
+static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ uint8_t ret = 0;
+ uint16_t reg16 = getreg16(STR71X_GPIO1_PD);
+
+ if ((reg16 & MMCSD_GPIO1_WPIN) != 0)
+ {
+ ret |= SPI_STATUS_WRPROTECTED;
+ }
+
+ if ((reg16 & MMCSD_GPIO1_CPIN) != 0)
+ {
+ ret |= SPI_STATUS_PRESENT;
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: spi_cmddata
+ *
+ * Description:
+ * Some devices require and additional out-of-band bit to specify if the
+ * next word sent to the device is a command or data. This is typical, for
+ * example, in "9-bit" displays where the 9th bit is the CMD/DATA bit.
+ * This function provides selection of command or data.
+ *
+ * This "latches" the CMD/DATA state. It does not have to be called before
+ * every word is transferred; only when the CMD/DATA state changes. This
+ * method is required if CONFIG_SPI_CMDDATA is selected in the NuttX
+ * configuration
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * cmd - TRUE: The following word is a command; FALSE: the following words
+ * are data.
+ *
+ * Returned Value:
+ * OK unless an error occurs. Then a negated errno value is returned
+ *
+ ****************************************************************************/
+
+ #ifdef CONFIG_SPI_CMDDATA
+static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+# error "spi_cmddata not implemented"
+ return -ENOSYS;
+}
+#endif
+
+/****************************************************************************
+ * Name: spi_send
+ *
+ * Description:
+ * Exchange one word on SPI
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * wd - The word to send. the size of the data is determined by the
+ * number of bits selected for the SPI interface.
+ *
+ * Returned Value:
+ * response
+ *
+ ****************************************************************************/
+
+static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
+{
+ FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
+
+ DEBUGASSERT(priv && priv->spibase);
+
+#if CONFIG_STR714X_BSPI0_TXFIFO_DEPTH > 1
+ /* Wait while the TX FIFO is full */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFF) != 0);
+#else
+ /* Wait until the TX FIFO is empty */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFE) == 0);
+#endif
+
+ /* Write the byte to the TX FIFO */
+
+ spi_putreg(priv, STR71X_BSPI_TXR_OFFSET, wd << 8);
+
+ /* Wait for the RX FIFO not empty */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_RFNE) == 0);
+
+ /* Get the received value from the RX FIFO and return it */
+
+ return (uint8_t)(spi_getreg(priv, STR71X_BSPI_RXR_OFFSET) >> 8);
+}
+
+/*************************************************************************
+ * Name: spi_sndblock
+ *
+ * Description:
+ * Send a block of data on SPI
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * buffer - A pointer to the buffer of data to be sent
+ * buflen - the length of data to send from the buffer in number of words.
+ * The wordsize is determined by the number of bits-per-word
+ * selected for the SPI interface. If nbits <= 8, the data is
+ * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t buflen)
+{
+ FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
+ FAR const uint8_t *ptr = (FAR const uint8_t *)buffer;
+ uint16_t csr2;
+
+ DEBUGASSERT(priv && priv->spibase);
+
+ /* Loop while thre are bytes remaining to be sent */
+
+ while (buflen > 0)
+ {
+ /* While the TX FIFO is not full and there are bytes left to send */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFF) == 0 && buflen > 0)
+ {
+ /* Send the data */
+
+ spi_putreg(priv, STR71X_BSPI_TXR_OFFSET, ((uint16_t)*ptr) << 8);
+ ptr++;
+ buflen--;
+ }
+ }
+
+ /* Then discard all card responses until the RX & TX FIFOs are emptied. */
+
+ do
+ {
+ /* Is there anything in the RX fifo? */
+
+ csr2 = spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET);
+ if ((csr2 & STR71X_BSPICSR2_RFNE) != 0)
+ {
+ /* Yes.. Read and discard */
+
+ (void)spi_getreg(priv, STR71X_BSPI_RXR_OFFSET);
+ }
+
+ /* There is a race condition where TFNE may go false just before
+ * RFNE goes true and this loop terminates prematurely. The nasty little
+ * delay in the following solves that (it could probably be tuned to
+ * improve performance).
+ */
+
+ else if ((csr2 & STR71X_BSPICSR2_TFNE) != 0)
+ {
+ up_udelay(100);
+ csr2 = spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET);
+ }
+ }
+ while ((csr2 & STR71X_BSPICSR2_RFNE) != 0 || (csr2 & STR71X_BSPICSR2_TFNE) == 0);
+}
+
+/****************************************************************************
+ * Name: spi_recvblock
+ *
+ * Description:
+ * Revice a block of data from SPI
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * buffer - A pointer to the buffer in which to recieve data
+ * buflen - the length of data that can be received in the buffer in number
+ * of words. The wordsize is determined by the number of bits-per-word
+ * selected for the SPI interface. If nbits <= 8, the data is
+ * packed into uint8_t; if nbits >8, the data is packed into uint16_t's
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen)
+{
+ FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
+ FAR uint8_t *ptr = (FAR uint8_t*)buffer;
+ uint32_t fifobytes = 0;
+
+ DEBUGASSERT(priv && priv->spibase);
+
+ /* While there is remaining to be sent (and no synchronization error has occurred) */
+
+ while (buflen || fifobytes)
+ {
+ /* Fill the transmit FIFO with 0xff...
+ * Write 0xff to the data register while (1) the TX FIFO is
+ * not full, (2) we have not exceeded the depth of the TX FIFO,
+ * and (3) there are more bytes to be sent.
+ */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_TFF) == 0 &&
+ (fifobytes < CONFIG_STR714X_BSPI0_TXFIFO_DEPTH) && buflen > 0)
+ {
+ spi_putreg(priv, STR71X_BSPI_TXR_OFFSET, 0xff00);
+ buflen--;
+ fifobytes++;
+ }
+
+ /* Now, read the RX data from the RX FIFO while the RX FIFO is not empty */
+
+ while ((spi_getreg(priv, STR71X_BSPI_CSR2_OFFSET) & STR71X_BSPICSR2_RFNE) != 0)
+ {
+ *ptr++ = (uint8_t)(spi_getreg(priv, STR71X_BSPI_RXR_OFFSET) >> 8);
+ fifobytes--;
+ }
+ }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_spiinitialize
+ *
+ * Description:
+ * Initialize the selected SPI port. This function could get called
+ * multiple times for each STR7 devices that needs an SPI reference.
+ *
+ * Input Parameter:
+ * Port number (for hardware that has mutiple SPI interfaces)
+ *
+ * Returned Value:
+ * Valid SPI device structre reference on succcess; a NULL on failure
+ *
+ ****************************************************************************/
+
+FAR struct spi_dev_s *up_spiinitialize(int port)
+{
+ FAR struct spi_dev_s *ret;
+ irqstate_t flags;
+ uint16_t reg16;
+
+ flags = irqsave();
+#ifdef CONFIG_STR71X_BSPI0
+ if (port == 0)
+ {
+ /* Check if this port has already been initialized */
+
+ if (!g_spidev0.initialized)
+ {
+ /* The default, alternate functionality of the GPIO0 pin selections is
+ * UART3/I2C1. In order to have BSP0 functionality, we also have to
+ * set the BSPI0 enable bit in the PCU BOOTCR register.
+ */
+
+ reg16 = getreg16(STR71X_PCU_BOOTCR);
+ reg16 |= STR71X_PCUBOOTCR_BSPIOEN;
+ putreg16(reg16, STR71X_PCU_BOOTCR);
+
+ /* Configure all GPIO pins to their appropriate function:
+ *
+ * PC0=1 PC1=1 PC2=1: Alternate function, push-pull
+ * PC0=1 PC1=0 PC2=0: In, TTL
+ * PC0=0 PC1=1 PC2=0: In, CMOS
+ * PC0=1 PC1=0 PC2=1: Output, push pull
+ */
+
+ reg16 = getreg16(STR71X_GPIO0_PC0);
+ reg16 &= ~BSPI0_GPIO0_ALL;
+ reg16 |= (BSPI0_GPIO0_ALT|BSPI0_GPIO0_INTTL|BSPI0_GPIO0_OUTPP);
+ putreg16(reg16, STR71X_GPIO0_PC0);
+
+ reg16 = getreg16(STR71X_GPIO0_PC1);
+ reg16 &= ~BSPI0_GPIO0_ALL;
+ reg16 |= (BSPI0_GPIO0_ALT|BSPI0_GPIO0_INCMOS);
+ putreg16(reg16, STR71X_GPIO0_PC1);
+
+ reg16 = getreg16(STR71X_GPIO0_PC2);
+ reg16 &= ~BSPI0_GPIO0_ALL;
+ reg16 |= (BSPI0_GPIO0_ALT|BSPI0_GPIO0_OUTPP);
+ putreg16(reg16, STR71X_GPIO0_PC2);
+
+ /* Start with enc28j60 de-selected (active low) and in
+ * reset (also active low)
+ */
+
+#ifdef CONFIG_ENC28J60
+ reg16 = getreg16(STR71X_GPIO0_PD);
+ reg16 |= (ENC_GPIO0_CS | ENC_GPIO0_NETRST);
+ putreg16(reg16, STR71X_GPIO0_PD);
+#endif
+
+ /* Set the clock divider to the maximum */
+
+ putreg16(255, STR71X_BSPI0_CLK);
+
+ /* Set FIFO sizes and disable the BSP1. It won't be enabled
+ * until the frequency is set.
+ */
+
+ putreg16(STR71X_BSPI0_CSR1DISABLE, STR71X_BSPI0_CSR1);
+ putreg16(STR71X_BSPI0_CSR2VALUE, STR71X_BSPI0_CSR2);
+
+ /* Configure GPIO1 pins for ENC28J60 inputs and outputs.
+ *
+ * PC0=1 PC1=0 PC2=0: In, TTL
+ * PC0=0 PC1=1 PC2=0: In, CMOS
+ * PC0=1 PC1=0 PC2=1: Output, push pull
+ */
+
+#ifdef BSPI0_GPIO1_ALL
+ reg16 = getreg16(STR71X_GPIO1_PC0);
+ reg16 &= ~BSPI0_GPIO1_ALL;
+ reg16 |= (BSPI0_GPIO1_INTTL|BSPI0_GPIO1_OUTPP);
+ putreg16(reg16, STR71X_GPIO1_PC0);
+
+ reg16 = getreg16(STR71X_GPIO1_PC1);
+ reg16 &= ~BSPI0_GPIO1_ALL;
+ reg16 |= BSPI0_GPIO0_INCMOS;
+ putreg16(reg16, STR71X_GPIO1_PC1);
+
+ reg16 = getreg16(STR71X_GPIO1_PC2);
+ reg16 &= ~BSPI0_GPIO1_ALL;
+ reg16 |= BSPI0_GPIO0_OUTPP;
+ putreg16(reg16, STR71X_GPIO1_PC2);
+#endif
+ g_spidev0.initialized = true;
+ }
+
+ /* Return the SPI device reference */
+
+ ret = &g_spidev0.spidev;
+ }
+ else
+#endif
+#ifdef CONFIG_STR71X_BSPI1
+ if (port == 1)
+ {
+ /* Check if this port has already been initialized */
+
+ if (!g_spidev1.initialized)
+ {
+ /* Configure all GPIO pins to their alternate function EXCEPT for
+ * the CS pin .. we will configure that as an push-pull output
+ * and control the chip select as a normal GPIO.
+ *
+ * PC0=1 PC1=1 PC2=1: Alternate function, push-pull
+ * PC0=1 PC1=0 PC2=0: In, TTL
+ * PC0=0 PC1=1 PC2=0: In, CMOS
+ * PC0=1 PC1=0 PC2=1: Output, push pull
+ */
+
+ reg16 = getreg16(STR71X_GPIO0_PC0);
+ reg16 &= ~BSPI1_GPIO0_ALL;
+ reg16 |= (BSPI1_GPIO0_ALT|BSPI1_GPIO0_INTTL|BSPI1_GPIO0_OUTPP);
+ putreg16(reg16, STR71X_GPIO0_PC0);
+
+ reg16 = getreg16(STR71X_GPIO0_PC1);
+ reg16 &= ~BSPI1_GPIO0_ALL;
+ reg16 |= (BSPI1_GPIO0_ALT|BSPI1_GPIO0_INCMOS);
+ putreg16(reg16, STR71X_GPIO0_PC1);
+
+ reg16 = getreg16(STR71X_GPIO0_PC2);
+ reg16 &= ~BSPI1_GPIO0_ALL;
+ reg16 |= (BSPI1_GPIO0_ALT|BSPI1_GPIO0_OUTPP);
+ putreg16(reg16, STR71X_GPIO0_PC2);
+
+ /* Start with MMC/SD disabled */
+
+ reg16 = getreg16(STR71X_GPIO0_PD);
+ reg16 |= MMCSD_GPIO0_CS;
+ putreg16(reg16, STR71X_GPIO0_PD);
+
+ /* Set the clock divider to the maximum */
+
+ putreg16(255, STR71X_BSPI1_CLK);
+
+ /* Set FIFO sizes and disable the BSP1. It won't be enabled
+ * until the frequency is set.
+ */
+
+ putreg16(STR71X_BSPI1_CSR1DISABLE, STR71X_BSPI1_CSR1);
+ putreg16(STR71X_BSPI1_CSR2VALUE, STR71X_BSPI1_CSR2);
+
+ /* Configure GPIO1 pins for WP/CP input
+ *
+ * PC0=1 PC1=0 PC2=0: In, TTL
+ * PC0=0 PC1=1 PC2=0: In, CMOS
+ * PC0=1 PC1=0 PC2=1: Output, push pull
+ */
+
+#ifdef BSPI1_GPIO1_ALL
+ reg16 = getreg16(STR71X_GPIO1_PC0);
+ reg16 &= ~BSPI1_GPIO1_ALL;
+ reg16 |= (BSPI1_GPIO1_INTTL|BSPI1_GPIO1_OUTPP);
+ putreg16(reg16, STR71X_GPIO1_PC0);
+
+ reg16 = getreg16(STR71X_GPIO1_PC1);
+ reg16 &= ~BSPI1_GPIO1_ALL;
+ reg16 |= BSPI1_GPIO0_INCMOS;
+ putreg16(reg16, STR71X_GPIO1_PC1);
+
+ reg16 = getreg16(STR71X_GPIO1_PC2);
+ reg16 &= ~BSPI1_GPIO1_ALL;
+ reg16 |= BSPI1_GPIO0_OUTPP;
+ putreg16(reg16, STR71X_GPIO1_PC2);
+#endif
+ g_spidev1.initialized = true;
+ }
+
+ /* Return the SPI device reference */
+
+ ret = &g_spidev1.spidev;
+ }
+ else
+#endif
+ {
+ ret = NULL;
+ }
+ irqrestore(flags);
+ return ret;
+}
+
+#endif /* CONFIG_STR71X_BSPI0 || CONFIG_STR71X_BSPI1 */
diff --git a/nuttx/configs/pcblogic-pic32mx/Kconfig b/nuttx/configs/pcblogic-pic32mx/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/pcblogic-pic32mx/README.txt b/nuttx/configs/pcblogic-pic32mx/README.txt
new file mode 100644
index 000000000..c15bd45a0
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/README.txt
@@ -0,0 +1,550 @@
+configs/pic32mx README
+=====================
+
+This README file discusses the port of NuttX to the PIC32MX board from
+PCB Logic Design Co. This board features the MicroChip PIC32MX460F512L.
+The board is a very simple -- little more than a carrier for the PIC32
+MCU plus voltage regulation, debug interface, and an OTG connector.
+
+Contents
+========
+
+ PIC32MX460F512L Pin Out
+ MAX3232 Connection
+ Toolchains
+ Loading NuttX with PICkit2
+ PIC32MX Configuration Options
+ Configurations
+
+PIC32MX460F512L Pin Out
+=======================
+
+ PIC32MX460F512L 100-Pin TQFP (USB) Pin Out. The mapping to the pins on
+ the PCL Logic board are very simple, each pin is brought out to a connector
+ label with the PIC32MX460F512L pin number.
+
+ On board logic only manages power, crystal, and USB signals.
+
+ LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ PIN NAME
+ ---- ----------------------------
+ 1 RG15
+ 2 Vdd
+ 3 PMD5/RE5
+ 4 PMD6/RE6
+ 5 PMD7/RE7
+ 6 T2CK/RC1
+ 7 T3CK/RC2
+ 8 T4CK/RC3
+ 9 T5CK/SDI1/RC4
+ 10 SCK2/PMA5/CN8/RG6
+ 11 SDI2/PMA4/CN9/RG7
+ 12 SDO2/PMA3/CN10/RG8
+ 13 MCLR
+ 14 SS2/PMA2/CN11/RG9
+ 15 Vss
+ 16 Vdd
+ 17 TMS/RA0
+ 18 INT1/RE8
+ 19 INT2/RE9
+ 20 AN5/C1IN+/VBUSON/CN7/RB5
+ 21 AN4/C1IN-/CN6/RB4
+ 22 AN3/C2IN+/CN5/RB3
+ 23 AN2/C2IN-/CN4/RB2
+ 24 PGEC1/AN1/CN3/RB1
+ 25 PGED1/AN0/CN2/RB0
+
+ BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ PIN NAME
+ ---- ----------------------------
+ 26 PGEC2/AN6/OCFA/RB6
+ 27 PGED2/AN7/RB7
+ 28 VREF-/CVREF-/PMA7/RA9
+ 29 VREF+/CVREF+/PMA6/RA10
+ 30 AVdd
+ 31 AVss
+ 32 AN8/C1OUT/RB8
+ 33 AN9/C2OUT/RB9
+ 34 AN10/CVREFOUT/PMA13/RB10
+ 35 AN11/PMA12/RB11
+ 36 Vss
+ 37 Vdd
+ 38 TCK/RA1
+ 39 U2RTS/RF13
+ 40 U2CTS/RF12
+ 41 AN12/PMA11/RB12
+ 42 AN13/PMA10/RB13
+ 43 AN14/PMALH/PMA1/RB14
+ 44 AN15/OCFB/PMALL/PMA0/CN12/RB15
+ 45 Vss
+ 46 Vdd
+ 47 U1CTS/CN20/RD14
+ 48 U1RTS/CN21/RD15
+ 49 U2RX/PMA9/CN17/RF4
+ 50 U2TX/PMA8/CN18/RF5
+
+ RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ PIN NAME
+ ---- ----------------------------
+ 75 Vss
+ 74 SOSCO/T1CK/CN0/RC14
+ 73 SOSCI/CN1/RC13
+ 72 SDO1/OC1/INT0/RD0
+ 71 IC4/PMCS1/PMA14/RD11
+ 70 SCK1/IC3/PMCS2/PMA15/RD10
+ 69 SS1/IC2/RD9
+ 68 RTCC/IC1/RD8
+ 67 SDA1/INT4/RA15
+ 66 SCL1/INT3/RA14
+ 65 Vss
+ 64 OSC2/CLKO/RC15
+ 63 OSC1/CLKI/RC12
+ 62 Vdd
+ 61 TDO/RA5
+ 60 TDI/RA4
+ 59 SDA2/RA3
+ 58 SCL2/RA2
+ 57 D+/RG2
+ 56 D-/RG3
+ 55 VUSB
+ 54 VBUS
+ 53 U1TX/RF8
+ 52 U1RX/RF2
+ 51 USBID/RF3
+
+ TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ PIN NAME
+ ---- ----------------------------
+ 100 PMD4/RE4
+ 99 PMD3/RE3
+ 98 PMD2/RE2
+ 97 TRD0/RG13
+ 96 TRD1/RG12
+ 95 TRD2/RG14
+ 94 PMD1/RE1
+ 93 PMD0/RE0
+ 92 TRD3/RA7
+ 91 TRCLK/RA6
+ 90 PMD8/RG0
+ 89 PMD9/RG1
+ 88 PMD10/RF1
+ 87 PMD11/RF0
+ 86 ENVREG
+ 85 Vcap/Vddcore
+ 84 PMD15/CN16/RD7
+ 83 PMD14/CN15/RD6
+ 82 PMRD/CN14/RD5
+ 81 OC5/PMWR/CN13/RD4
+ 80 PMD13/CN19/RD13
+ 79 IC5/PMD12/RD12
+ 78 OC4/RD3
+ 77 OC3/RD2
+ 76 OC2/RD1
+
+ Additional Signals available from the board:
+
+ PROGRAM CONNECTOR: Vpp Vdd GND PGED1 PGEC1 NC PGED2 PGEC2
+ POWER POINTS: +5Vin +3.3V AVdd AGND Vdd GND USB+5V
+
+MAX3232 Connection
+==================
+
+ I use a tiny, MAX3232 board that I got from the eBay made by NKC
+ Electronics (http://www.nkcelectronics.com/). As of this writing, it
+ is also available here: http://www.nkcelectronics.com/rs232-to-ttl-3v--55v-convert232356.html
+
+ CTS -- Not connected
+ RTS -- Not connected
+ TX -- Pin 53: U1TX/RF8
+ 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.
+
+Toolchains
+==========
+
+ MPLAB/C32
+ ---------
+
+ I am using the free, "Lite" version of the PIC32MX toolchain available
+ for download from the microchip.com web site. I am using the Windows
+ version. The MicroChip toolchain is the only toolchain currently
+ supported in these configurations, but it should be a simple matter to
+ adapt to other toolchains by modifying the Make.defs file include in
+ each configuration.
+
+ C32 Toolchain Options:
+
+ CONFIG_PIC32MX_MICROCHIPW - MicroChip full toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL - MicroChip full toolchain for Linux
+ CONFIG_PIC32MX_MICROCHIPW_LITE - MicroChip "Lite" toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL_LITE - MicroChip "Lite" toolchain for Linux
+
+ NOTE: The "Lite" versions of the toolchain does not support C++. Also
+ certain optimization levels are not supported by the "Lite" toolchain.
+
+ MicrochipOpen
+ -------------
+
+ An alternative, build-it-yourself toolchain is available here:
+ http://sourceforge.net/projects/microchipopen/ . These tools were
+ last updated circa 2010. NOTE: C++ support still not available
+ in this toolchain.
+
+ Building MicrochipOpen (on Linux)
+
+ 1) Get the build script from this location:
+
+ http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
+
+ 2) Build the code using the build script, for example:
+
+ ./build.sh -b v105_freeze
+
+ This will check out the selected branch and build the tools.
+
+ 3) Binaries will then be available in a subdirectory with a name something like
+ pic32-v105-freeze-20120622/install-image/bin (depending on the current data
+ and the branch that you selected.
+
+ Note that the tools will have the prefix, mypic32- so, for example, the
+ compiler will be called mypic32-gcc.
+
+ Pinguino mips-elf Toolchain
+ ---------------------------
+
+ Another option is the mips-elf toolchain used with the Pinguino project. This
+ is a relatively current mips-elf GCC and should provide free C++ support as
+ well. This toolchain can be downloded from the Pinguino website:
+ http://wiki.pinguino.cc/index.php/Main_Page#Download . There is some general
+ information about using the Pinguino mips-elf toolchain in this thread:
+ http://tech.groups.yahoo.com/group/nuttx/message/1821
+
+ See also configs/mirtoo/README.txt. There is an experimental (untested)
+ configuration for the Mirtoo platform in that directory.
+
+ MPLAB/C32 vs MPLABX/X32
+ -----------------------
+
+ It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
+ it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
+ with the NuttX build scripts. Here are some of the issues that I see when trying
+ to build with XC32:
+
+ 1) Make.def changes: You have to change the tool prefix:
+
+ CROSSDEV=xc32-
+
+ 2) debug.ld/release.ld: The like expect some things that are not present in
+ the current linker scripts (or are expected with different names). Here
+ are some partial fixes:
+
+ Rename: kseg0_progmem to kseg0_program_mem
+ Rename: kseg1_datamem to kseg1_data_mem
+
+ Even then, there are more warnings from the linker and some undefined symbols
+ for non-NuttX code that resides in the unused Microchip libraries. See this
+ email thread at http://tech.groups.yahoo.com/group/nuttx/message/1458 for more
+ information. You will have to solve at least this undefined symbol problem if
+ you want to used the XC32 toolchain.
+
+ Windows Native Toolchains
+ -------------------------
+
+ NOTE: There are several limitations to using a Windows based toolchain in a
+ Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+Loading NuttX with PICkit2
+==========================
+
+ NOTE: You need a PICKit3 if you plan to use the MPLAB debugger! The PICKit2
+ can, however, still be used to load programs. Instructions for the PICKit3
+ are similar.
+
+ Intel Hex Forma Files:
+ ----------------------
+
+ When NuttX is built it will produce two files in the top-level NuttX
+ directory:
+
+ 1) nuttx - This is an ELF file, and
+ 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
+ the setting CONFIG_INTELHEX_BINARY in the .config file.
+
+ The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
+ there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
+ file to contain physical addresses. But the nuttx.hex file generated from the
+ top-level make will have address in the KSEG0 and KSEG1 regions.
+
+ tools/pic32mx/mkpichex:
+ ----------------------
+
+ There is a simple tool in the NuttX tools/pic32mx directory that can be
+ used to solve both issues with the nuttx.hex file. But, first, you must
+ build the tool:
+
+ cd tools/pic32mx
+ make
+
+ Now you will have an excecutable file call mkpichex (or mkpichex.exe on
+ Cygwin). This program will take the nutt.hex file as an input, it will
+ convert all of the KSEG0 and KSEG1 addresses to physical address, and
+ it will write the modified file, replacing the original nuttx.hex.
+
+ To use this file, you need to do the following things:
+
+ . ./setenv.sh # Source setenv.sh. Among other this, this script
+ # will add the NuttX tools/pic32mx directory to your
+ # PATH variable
+ make # Build nuttx and nuttx.hex
+ mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
+ # to the top-level build directory. It is the only
+ # required input to mkpichex.
+
+PIC32MX Configuration Options
+=============================
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=mips
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_MIPS=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_MIPS32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=pic32mx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_PIC32MX460F512L=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=pcblogic-pic32mx
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_PCBLOGICPIC32MX=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0xa0000000
+
+ CONFIG_ARCH_IRQPRIO - The PIC32MXx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ PIC32MX Configuration
+
+ CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
+
+ Individual subsystems can be enabled:
+
+ CONFIG_PIC32MX_WDT - Watchdog timer
+ CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
+ CONFIG_PIC32MX_T3 - Timer 3
+ CONFIG_PIC32MX_T4 - Timer 4
+ CONFIG_PIC32MX_T5 - Timer 5
+ CONFIG_PIC32MX_IC1 - Input Capture 1
+ CONFIG_PIC32MX_IC2 - Input Capture 2
+ CONFIG_PIC32MX_IC3 - Input Capture 3
+ CONFIG_PIC32MX_IC4 - Input Capture 4
+ CONFIG_PIC32MX_IC5 - Input Capture 5
+ CONFIG_PIC32MX_OC1 - Output Compare 1
+ CONFIG_PIC32MX_OC2 - Output Compare 2
+ CONFIG_PIC32MX_OC3 - Output Compare 3
+ CONFIG_PIC32MX_OC4 - Output Compare 4
+ CONFIG_PIC32MX_OC5 - Output Compare 5
+ CONFIG_PIC32MX_I2C1 - I2C 1
+ CONFIG_PIC32MX_I2C2 - I2C 2
+ CONFIG_PIC32MX_SPI1 - SPI 1
+ CONFIG_PIC32MX_SPI2 - SPI 2
+ CONFIG_PIC32MX_UART1 - UART 1
+ CONFIG_PIC32MX_UART2 - UART 2
+ CONFIG_PIC32MX_ADC - ADC 1
+ CONFIG_PIC32MX_PMP - Parallel Master Port
+ CONFIG_PIC32MX_CM1 - Comparator 1
+ CONFIG_PIC32MX_CM2 - Comparator 2
+ CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA - DMA
+ CONFIG_PIC32MX_FLASH - FLASH
+ CONFIG_PIC32MX_USBDEV - USB device
+ CONFIG_PIC32MX_USBHOST - USB host
+
+ PIC32MX Configuration Settings
+ DEVCFG0:
+ CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
+ value 2 enables.
+ CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
+ Default 1 (PG2)
+ CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
+ CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
+ CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
+ DEVCFG1: (All settings determined by selections in board.h)
+ DEVCFG2: (All settings determined by selections in board.h)
+ DEVCFG3:
+ CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
+ (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
+ (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
+ can be enabled later by software).
+
+ The priority of interrupts may be specified. The value ranage of
+ priority is 4-31. The default (16) will be used if these any of these
+ are undefined.
+
+ CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
+ CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
+ CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
+ CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
+ CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
+ CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
+ CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
+ CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
+ CONFIG_PIC32MX_T2PRIO - Timer 2 priority
+ CONFIG_PIC32MX_T3PRIO - Timer 3 priority
+ CONFIG_PIC32MX_T4PRIO - Timer 4 priority
+ CONFIG_PIC32MX_T5PRIO - Timer 5 priority
+ CONFIG_PIC32MX_IC1PRIO - Input Capture 1
+ CONFIG_PIC32MX_IC2PRIO - Input Capture 2
+ CONFIG_PIC32MX_IC3PRIO - Input Capture 3
+ CONFIG_PIC32MX_IC4PRIO - Input Capture 4
+ CONFIG_PIC32MX_IC5PRIO - Input Capture 5
+ CONFIG_PIC32MX_OC1PRIO - Output Compare 1
+ CONFIG_PIC32MX_OC2PRIO - Output Compare 2
+ CONFIG_PIC32MX_OC3PRIO - Output Compare 3
+ CONFIG_PIC32MX_OC4PRIO - Output Compare 4
+ CONFIG_PIC32MX_OC5PRIO - Output Compare 5
+ CONFIG_PIC32MX_I2C1PRIO - I2C 1
+ CONFIG_PIC32MX_I2C2PRIO - I2C 2
+ CONFIG_PIC32MX_SPI1PRIO - SPI 1
+ CONFIG_PIC32MX_SPI2PRIO - SPI 2
+ CONFIG_PIC32MX_UART1PRIO - UART 1
+ CONFIG_PIC32MX_UART2PRIO - UART 2
+ CONFIG_PIC32MX_CN - Input Change Interrupt
+ CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
+ CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
+ CONFIG_PIC32MX_CM1PRIO - Comparator 1
+ CONFIG_PIC32MX_CM2PRIO - Comparator 2
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
+ CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
+ CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
+ CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
+ CONFIG_PIC32MX_FCEPRIO - Flash Control Event
+ CONFIG_PIC32MX_USBPRIO - USB
+
+ PIC32MXx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ PIC32MXx USB Device Configuration
+
+ PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
+
+Configurations
+==============
+
+Each PIC32MX configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh pcblogic-pic32mx/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ nsh:
+ This configuration directory holds configuration files tht can
+ be used to support the NuttShell (NSH).
diff --git a/nuttx/configs/pcblogic-pic32mx/include/board.h b/nuttx/configs/pcblogic-pic32mx/include/board.h
new file mode 100644
index 000000000..6c0bef477
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/include/board.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * configs/pcblogic-pic32mx/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_PCBLOGIC_PIC32MX_INCLUDE_BOARD_H
+#define __CONFIGS_PCBLOGIC_PIC32MX_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Crystal frequencies */
+
+#define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */
+#define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz) */
+
+/* Oscillator modes */
+
+#define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
+#define BOARD_POSC_HSMODE 1 /* High-speed crystal (HS) mode */
+
+/* PLL configuration and resulting CPU clock.
+ * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
+ */
+
+#define BOARD_PLL_INPUT BOARD_POSC_FREQ
+#define BOARD_PLL_IDIV 2 /* PLL input divider */
+#define BOARD_PLL_MULT 20 /* PLL multiplier */
+#define BOARD_PLL_ODIV 1 /* PLL output divider */
+
+#define BOARD_CPU_CLOCK 80000000 /* CPU clock (80MHz = 8MHz * 20 / 2) */
+
+/* USB PLL configuration.
+ * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
+ */
+
+#define BOARD_UPLL_IDIV 2 /* USB PLL divider (revisit) */
+#define BOARD_USB_CLOCK 48000000 /* USB clock (8MHz / 2) * 24 / 2) */
+
+/* Peripheral clock is divided down from CPU clock.
+ * PBCLOCK = CPU_CLOCK / PBDIV
+ */
+
+#define BOARD_PBDIV 2 /* Peripheral clock divisor (PBDIV) */
+#define BOARD_PBCLOCK 40000000 /* Peripheral clock (PBCLK = 80MHz/2) */
+
+/* Watchdog pre-scaler (re-visit) */
+
+#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
+#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
+
+/* LED definitions **********************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_PCBLOGIC_PIC32MX_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/Make.defs b/nuttx/configs/pcblogic-pic32mx/nsh/Make.defs
new file mode 100644
index 000000000..ffefef7ff
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/nsh/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pcblogic-pic32mx/nsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/appconfig b/nuttx/configs/pcblogic-pic32mx/nsh/appconfig
new file mode 100644
index 000000000..9b95defa8
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/nsh/appconfig
@@ -0,0 +1,61 @@
+############################################################################
+# configs/pcblogic-pic32mx/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig
new file mode 100644
index 000000000..74242863f
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig
@@ -0,0 +1,472 @@
+############################################################################
+# configs/pcblogic-pic32mx/nsh/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.orgr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX460F512L=y
+CONFIG_ARCH_BOARD="pcblogic-pic32mx"
+CONFIG_ARCH_BOARD_PCBLOGICPIC32MX=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=25
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/ld.script b/nuttx/configs/pcblogic-pic32mx/nsh/ld.script
new file mode 100644
index 000000000..ff1618acf
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/nsh/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pcblogic-pic32mx/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX460F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX460F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX460F512L has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/setenv.sh b/nuttx/configs/pcblogic-pic32mx/nsh/setenv.sh
new file mode 100755
index 000000000..5f8bc609b
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/nsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pcblogic-pic32mx/nsh/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/Make.defs b/nuttx/configs/pcblogic-pic32mx/ostest/Make.defs
new file mode 100644
index 000000000..639466f22
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/ostest/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pcblogic-pic32mx/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/appconfig b/nuttx/configs/pcblogic-pic32mx/ostest/appconfig
new file mode 100644
index 000000000..fc8126249
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/pcblogic-pic32mx/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig
new file mode 100644
index 000000000..d012b4a24
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig
@@ -0,0 +1,461 @@
+############################################################################
+# configs/pcblogic-pic32mx/ostest/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.orgr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX460F512L=y
+CONFIG_ARCH_BOARD="pcblogic-pic32mx"
+CONFIG_ARCH_BOARD_PCBLOGICPIC32MX=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/ld.script b/nuttx/configs/pcblogic-pic32mx/ostest/ld.script
new file mode 100644
index 000000000..dd181b4d9
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/ostest/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pcblogic-pic32mx/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX460F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX460F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX460F512L has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/setenv.sh b/nuttx/configs/pcblogic-pic32mx/ostest/setenv.sh
new file mode 100755
index 000000000..1624cf8de
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pcblogic-pic32mx/ostest/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pcblogic-pic32mx/src/Makefile b/nuttx/configs/pcblogic-pic32mx/src/Makefile
new file mode 100644
index 000000000..9ca5c4f57
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/src/Makefile
@@ -0,0 +1,88 @@
+############################################################################
+# configs/pcblogic-pic32mx/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/pcblogic-pic32mx/src/pcblogic-internal.h b/nuttx/configs/pcblogic-pic32mx/src/pcblogic-internal.h
new file mode 100644
index 000000000..2e0963e26
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/src/pcblogic-internal.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/pcblogic-pic32mx/src/pcblogic-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_PCBLOGIC_PIC32MX_SRC_PCBLOGIC_INTERNAL_H
+#define __CONFIGS_PCBLOGIC_PIC32MX_SRC_PCBLOGIC_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the PCB Logic board.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2)
+EXTERN void weak_function pic32mx_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_PCBLOGIC_PIC32MX_SRC_PCBLOGIC_INTERNAL_H */
diff --git a/nuttx/configs/pcblogic-pic32mx/src/up_boot.c b/nuttx/configs/pcblogic-pic32mx/src/up_boot.c
new file mode 100644
index 000000000..2c9634fc0
--- /dev/null
+++ b/nuttx/configs/pcblogic-pic32mx/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/pcblogic-pic32mx/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "pcblogic-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_boardinitialize
+ *
+ * Description:
+ * All PIC32MX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void pic32mx_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak
+ * function pic32mx_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2)
+ if (pic32mx_spiinitialize)
+ {
+ pic32mx_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ pic32mx_ledinit();
+#endif
+}
diff --git a/nuttx/configs/pic32-starterkit/Kconfig b/nuttx/configs/pic32-starterkit/Kconfig
new file mode 100644
index 000000000..d2dbdba15
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_PIC32_STARTERKIT
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/pic32-starterkit/README.txt b/nuttx/configs/pic32-starterkit/README.txt
new file mode 100644
index 000000000..31d84798c
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/README.txt
@@ -0,0 +1,1243 @@
+configs/pic32-starterkit README
+===============================
+
+
+This README file discusses the port of NuttX to the Microchip PIC32 Ethernet
+Starter Kit (DM320004) with either
+
+ 1) The Multimedia Expansion Board (MEB, DM320005), or
+ 2) The Starter Kit I/O Expansion Board
+
+See www.microchip.com for further information.
+
+The PIC32 Ethernet Starter Kit includes:
+
+- PIC32MX795F512L 32-bit microcontroller.
+- PIC32MX795F512L USB microcontroller for on-board debugging.
+- Green power indicator LED.
+- Orange debug indicator LED.
+- Three user-defined indicator LEDs.
+- Ethernet 10/100 bus speed indicator LED.
+- Three push button switches for user-defined inputs.
+- On-board crystal for precision microcontroller clocking (8 MHz).
+- 50 MHz Ethernet PHY oscillator.
+- 32 kHz oscillator (optional).
+- USB connectivity for on-board debugger communications.
+- USB Host and OTG power supply for powering PIC32 USB applications.
+- USB Type A receptacle connectivity for PIC32 host-based applications.
+- USB Type micro-AB receptacle for OTG and USB device connectivity for PIC32
+ OTG/device-based applications.
+- RJ-45 Ethernet port (External Ethernet PHY).
+
+The MEB adds:
+
+- 3.2 inch (8.1 cm) QVGA touch screen display with backlight
+- Solomon Systech Graphics Controller (SSD1926)
+- Five user-controlled LEDs
+- Power LED
+- Four-way joystick
+- Fire button
+- Headphone jack
+- Line output jack
+- Microphone input jack
+- microSD card slot.
+- Accelerometer and temperature sensor
+- 24LC08 EEPROM.
+- SPI Flash
+- 24-bit audio codec
+- CPLD for SPI and Chip Select configuration
+- Integrated 802.11 wireless connectivity
+
+The Starter Kit I/O Expansion Board:
+
+Mostly just brings out all of the pins from the tiny Starter Kit connector.
+
+Contents
+========
+
+ PIC32MX795F512L Pin Out
+ MEB Connector
+ PICtail
+ Serial Output using the
+ Toolchains
+ Creating Compatible NuttX HEX files
+ Serial Console: MEB
+ Serial Console: Starter Kit I/O Expansion Board
+ LEDs
+ PIC32MX Configuration Options
+ Configurations
+
+PIC32MX795F512L Pin Out
+=======================
+
+LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (Starter Kit User Guide)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+ 1 RG15/AERXERR ERXERR Ethernet RX_ER/MDIX_IN
+ 2 VDD P32_VDD ---
+ 3 PMD5/RE5 PMPD5/RE5 J2 pin 13
+ 4 PMD6/RE6 PMPD6/RE6 J2 pin 9
+ 5 PMD7/RE7 PMPD7/RE7 J2 pin 7
+ 6 RC1/T2CK T2CLK/RC1 J2 pin 35 (timer)
+ 7 RC2/AC2TX/T3CK T3CLK/RC2 J2 pin 37 (timer)
+ 8 RC3/AC2RX/T4CK T4CLK/RC3 J2 pin 39 (timer)
+ 9 RC4/SDI1/T5CK SDI1/T4CLK/RC4 J2 pin 41 (timer)
+ J2 pin 93 (SPI1)
+ 10 PMA5/CN8/ECOL/RG6/SCK2/U3RTS/U6TX PMPA5/SCM2C/CN8/RG6 J2 pin 45 (SPI2)
+ J2 pin 117 (PMP address)
+ 11 PMA4/CN9/ECRS/RG7/SDA4/SDI2/U3RX PMPA4/SCM2A/CN9/RG7 J2 pin 47 (SPI2)
+ J2 pin 119 (PMP address)
+ 12 PMA3/AECRSDV/AERXDV/CN10/ECRSDV/ ECRS_DV Ethernet CRS/CRS_DV/LED_CFG
+ ERXDV/RG8/SCL4/SDO2/U3TX
+ 13 MCLR PIC32_MCLR (pulled up)
+ PIC32MX440F512H debug processor
+ J2 pin 130 (ICSP)
+ 14 PMA2/AEREFCLK/AERXCLK/CN11/ EREF_CLK 50MHz clock, Ethernet X1
+ EREFCLK/ERXCLK/RG9/SS2/U3CTS/
+ U6RX
+ 15 VSS (grounded) ---
+ 16 VDD P32_VDD ---
+ 17 RA0/TMS TMS/RA0 J2 pin 126 (JTAG/GPIO)
+ 18 AERXD0/INT1/RE8 ERXD0(2) Ethernet RXD_0/PHYAD1
+ 19 AERXD1/INT2/RE9 ERXD1(2) Ethernet RXD_1/PHYAD2
+ 20 AN5/C1IN+/CN7/RB5/VBUSON VBUSON/C1IN+/AN5/CN7/RB5 USB host power supply, TPS20x1B ~EN,
+ Low enables power to host port (J4)
+ USB OTG power supply, MCP1253_MSOP ~SHDN
+ Enables power to device/OTG port (J5)
+ J2 pin 63 (comparator 1)
+ J2 pin 62 (A/D)
+ 21 AN4/C1IN-/CN6/RB4 USBOEN/C1IN-/AN4/CN6/RB4 J2 pin 65 (comparator 1)
+ J2 pin 64 (A/D)
+ 22 AN3/C2IN+/CN5/RB3 C2IN+/AN3/CN5/RB3 TPS20x1B ~OC, sense host port power
+ MCP1253_MSOP PGOOD, sense device/OTG port power
+ J2 pin 67 (comparator 2)
+ J2 pin 66 (A/D)
+ 23 AN2/C2IN-/CN4/RB2 C2IN-/AN2/CN4/RB2 J2 pin 69 (comparator 2)
+ J2 pin 101
+ J2 pin 68 (A/D)
+ 24 AN1/CN3/PGEC1/RB1 PGC1/AN1/CN3/RB1 J2 pin 70 (A/D)
+ 25 AN0/CN2/PGED1/RB0 PGD1/AN0/CN2/RB0 J2 pin 72 (A/D)
+
+BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (Starter Kit User Guide)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+ 26 AN6/OCFA/PGEC2/RB6 PIC32_PGC2 PIC32MX440F512H debug processor
+ J2 pin 128 (ICSP)
+ 27 AN7/PGED2/RB7 PIC32_PGD2/DBG_SD0 PIC32MX440F512H debug processor
+ J2 pin 132 (ICSP)
+ 28 PMA7/AERXD2/CVREF-/RA9 PMPA7/VREF-/RA9 J2 pin 113 (PMP address)
+ J2 pin 114 (A/D ref)
+ 29 PMA6/AERXD3/CVREF+/RA10/VREF+ PMPA6/VREF+/RA10 J2 pin 115 (PMP address)
+ J2 pin 116 (A/D ref)
+ 30 AVDD P32_VDD ---
+ 31 AVSS (grounded) ---
+ 32 AN8/C1OUT/RB8 C1OUT/AN8/RB8 J2 pin 71
+ 33 AN9/C2OUT/RB9 C2OUT/AN9/RB9 J2 pin 73
+ 34 PMA13/AN10/RB10/CVREFOUT PMPA13/CVREF/AN10 J2 pin 101 (PMP address)
+ J2 pin 102 (Comparator ref)
+ 35 PMA12/AETXERR/AN11/ERXERR/RB11 PMPA12/AN11/RB11 J2 pin 103 (PMP address)
+ 36 VSS (grounded) ---
+ 37 VDD P32_VDD ---
+ 38 RA1/TCK TCK/RA1 PIC32MX440F512H debug processor
+ J2 pin 124 (JTAG/GPIO)
+ 39 AC1TX/RF13/SCK4/U2RTS/U5TX SCM3D/BCLK2/RF13 J2 pin 106 (UART2)
+ 40 AC1RX/RF12/SS4/U2CTS/U5RX SCM3C/RF12 J2 pin 108 (UART2)
+ 41 PMA11/AECRS/AN12/ERXD0/RB12 PMPA11/AN12/RB12 J2 pin 105 (PMP address)
+ 42 PMA10/AECOL/AN13/ERXD1/RB13 PMPA10/AN13/RB13 J2 pin 107 (PMP address)
+ 43 PMA1/AETXD3/AN14/ERXD2/PMALH/RB14 PMPA1/AN14/RB14 J2 pin 127 (PMP address)
+ 44 PMA0/AETXD2/AN15/CN12/ERXD3/OCFB/ PMPA0/AN15/OCFB/CN12 J2 pin 129 (PMP address)
+ PMALL/RB15 J2 pin 36
+ 45 VSS (grounded) ---
+ 46 VDD P32_VDD ---
+ 47 AETXD0/CN20/RD14/SS3/U1CTS/U4RX EXTD0(2) Ethernet TXD_0
+ 48 AETXD1/CN21/RD15/SCK3/U1RTS/U4TX EXTD1(2) Ethernet TXD_1
+ 49 PMA9/CN17/RF4/SDA5/SDI4/U2RX PMPA9/SCM3A/CN17/RF4 J2 pin 109 (PMP address)
+ J2 pin 110 (UART2)
+ 50 PMA8/CN18/RF5/SCL5/SDO4/U2TX PMPA8/SCM3B/CN18/RF5 J2 pin 111 (PMP address)
+ J2 pin 112 (UART2)
+
+RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (Starter Kit User Guide)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+ 75 VSS (grounded)
+ 74 CN0/RC14/SOSCO/T1CK SOSC0/T1CK/CN0/RC14 32kHz Oscillator, J2 pin (timer)
+ J2 pin 32 (secondary OSC)
+ 73 CN1/RC13/SOSCI SOSC1/CN1/RC13 32kHz Oscillator
+ J2 pin 32 (secondary OSC)
+ 72 OC1/INT0/RD0/SDO1 SDO1/INT0/OC1/RD0 User LED D4 (high illuminates)
+ J2 pin 87 (EXT_INT)
+ J2 pin 95 (SPI1)
+ J2 pin 46 (OC/PWM)
+ 71 PMA14/AEMDC/EMDC/IC4/PMCS1/RD11 EMDC Ethernet MDC
+ 70 PMA15/IC3/PMCS2/RD10/SCK1 SCK1/IC3/PMPCS2/RD10 J2 pin 29 (PMP control)
+ J2 pin 91 (SPI1)
+ J2 pin 52 (input capture)
+ 69 IC2/RD9/SS1 SS1/IC2/RD9 J2 pin 54 (input capture)
+ 68 AEMDIO/EMDIO/IC1/RD8/RTCC EMDIO Ethernet MDIO
+ 67 AETXEN/INT4/RA15/SDA1 ETXEN(2) Ethernet TX_EN
+ 66 AETXCLK/INT3/RA14/SCL1 INT3/SCL1/RA14 Ethernet PWR_DOWN/INT
+ 65 VSS (grounded) ---
+ 64 CLKO/OSC2/RC15 8MHz crystal
+ 63 CLKI/OSC1/RC12 8MHz crystal
+ 62 VDD P32_VDD ---
+ 61 RA5/TDO TDO/RA5 PIC32MX440F512H debug processor
+ J2 pin 118 (JTAG/GPIO)
+ 60 RA4/TDI TDI/RA4 PIC32MX440F512H debug processor
+ 59 RA3/SDA2 SDA2/RA3 J2 pin 74 (I2C2)
+ 58 RA2/SCL2 SCL2/RA2 J2 pin 76 (I2C2)
+ 57 D+/RG2 D+/RG2 Host port (J4), Device OTG port (J5)
+ 56 D-/RG3 D-/RG3 Host port (J4), Device OTG port (J5)
+ 55 VUSB P32_VDD ---
+ 54 VBUS P32_VBUS ---
+ 53 RF8/SCL3/SDO3/U1TX SCM1B/RF8 J2 pin 90 (UART1)
+ 52 RF2/SDA3/SDI3/U1RX SCM1A/RF2 J2 pin 88 (UART1)
+ 51 RF3/USBID USBID/RF3 Device OTG port (J5)
+
+TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (Starter Kit User Guide)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+100 PMD4/RE4 PMPD4/RE4 J2 pin 15 (PMP data)
+ 99 PMD3/RE3 PMPD3/RE3 J2 pin 17 (PMP data)
+ 98 PMD2/RE2 PMPD2/RE2 J2 pin 19 (PMP data)
+ 97 RG13/TRD0 TRD0/RG13 J2 pin 8 (Trace/GPIO)
+ 96 RG12/TRD1 TRD1/RG12 J2 pin 5
+ 95 RG14/TRD2 TRD2/RG14 J2 pin 3
+ 94 PMD1/RE1 PMPD1/RE1 J2 pin 21 (PMP data)
+ 93 PMD0/RE0 PMPD0/RE0 J2 pin 23 (PMP data)
+ 92 RA7/TRD3 TRD3/RA7 J2 pin 6 (Trace/GPIO)
+ 91 RA6/TRCLK TRCLK/RA6 J2 pin 4 (Trace/GPIO)
+ 90 PMD8/C2RX/RG0 PMPD8/RG0 J2 pin 10 (PMP data)
+ 89 PMD9/C2TX/ETXERR/RG1 PMPD9/RG1 J2 pin 14 (PMP data)
+ 88 PMD10/C1TX/ETXD0/RF1 PMPD10/RF1 J2 pin 16 (PMP data)
+ 87 PMD11/C1RX/ETXD1/RF0 PMPD11/RF0 J2 pin 18 (PMP data)
+ 86 VDD P32_VDD ---
+ 85 VCAP/VCORE (capacitor to ground) ---
+ 84 PMD15/CN16/ETXCLK/RD7 PMPD15/CN16/RD7 Switch SW2 (low when closed)
+ J2 pin 26 (PMP data)
+ 83 PMD14/CN15/ETXEN/RD6 PMPD14/CN15/RD6 Switch SW1 (low when closed)
+ J2 pin 24 (PMP data)
+ 82 CN14/PMRD/RD5 PMPRD/CN14/RD5 J2 pin 25
+ 81 CN13/OC5/PMWR/RD4 PMPWR/OC5/C13/RD4 J2 pin 28 (PMP control)
+ J2 pin 38
+ 80 PMD13/CN19/ETXD3/RD13 CN19/PMPD13/RD13 Switch SW3 (low when closed)
+ J2 pin 22 (PMP data)
+ 79 PMD12/ETXD2/IC5/RD12 IC5/PMPD12/RD12 J2 pin 20 (PMP data)
+ J2 pin 48
+ 78 OC4/RD3 OC4/RD3 J2 pin 40 (OC/PWM)
+ 77 OC3/RD2 OC3/RD2 User LED D5 (high illuminates)
+ J2 pin 42 (OC/PWM)
+ 76 OC2/RD1 OC1/RD1 User LED D6 (high illuminates)
+ J2 pin 44 (OC/PWM)
+
+MEB Connector
+=============
+
+The following table summarizes how the pins brought the the MEB through the
+J2 on the Ethernet Starter Kit are mapped. This connect is J2 on the Ethernet
+Starter Kit and J3 on the MEB.
+
+ J3
+PIC32 SIGNAL PIN CONNECTION
+-------------------------- ------- ----------------------------------
+PMPD0 pin 23 Graphics Controller (SSD1926)
+PMPD1 pin 21 8-bit or 16-bit Data Bus
+PMPD2 pin 19
+PMPD3 pin 17
+PMPD4 pin 15
+PMPD6 pin 9
+PMPD7 pin 7
+-------------------------- ------- ----------------------------------
+PMPD8 pin 10 Graphics Controller (SSD1926)
+PMPD9 pin 14 16-bit Data Bus
+PMPD10 pin 16
+PMPD11 pin 18
+PMPD12 pin 20
+PMPD13 pin 22
+PMPD14 pin 24
+PMPD15 pin 26
+-------------------------- ------- ----------------------------------
+ Graphics Controller (SSD1926)
+RG13 pin 8 Chip select
+RB10 pin 101 Register select
+RC3 pin 39 Wait line
+RA10 pin 115 Reset (see MRF24WBOMA and PICtail)
+-------------------------- ------- ----------------------------------
+ Touchscreen
+RB11 pin 103 X+
+RB12 pin 105 Y-
+RB13 pin 107 X-
+RB14 pin 127 Y+
+-------------------------- ------- ----------------------------------
+ Joystick
+CN2/RB0 pin 72 Left
+CN3/RB1 pin 70 Up
+CN5/RB3 pin 66 Down
+CN6/RB4 pin 64 Right
+CN12/RB15 pin 36 Fire
+-------------------------- ------- ----------------------------------
+ LEDs
+RD1 pin 44 LED1
+RD2 pin 42 LED2
+RD3 pin 40 LED3
+RC1 pin 35 LED4
+RC2 pin 37 LED5
+-------------------------- ------- ----------------------------------
+SDA2 pin 74 I2C2 bus for BMA150, MCHP24LC08
+SCL2 pin 76 and WM8731 (see also MRF24WBOMA)
+-------------------------- ------- ----------------------------------
+SCK1 pin 91 SPI1 bus for WM8731
+SDI1 pin 93
+SDO1 pin 95
+-------------------------- ------- ----------------------------------
+RA6 pin 4 CPLD
+RA7 pin 6
+RG12 pin 5
+RG14 pin 3
+SCK2 pin 45 (see MRF24WBOMA)
+SDI2 pin 47 (see MRF24WBOMA)
+SDO2 pin 49 (see MRF24WBOMA)
+RG9 pin 51 (see MRF24WBOMA)
+SCK3A pin 106 (see PICtail)
+SDI3A pin 110 (see PICtail)
+SDO3A pin 112 (see PICtail)
+RF12 pin 108 (see PICtail)
+~SSI pin 97 (see PICtail)
+RD9 pin 54
+-------------------------- ------- ----------------------------------
+INT3 pin 81 MRF24WBOMA
+RA10 pin 115 (also Graphics Controller and PICtail)
+RB8 pin 71
+-------------------------- ------- ----------------------------------
+ PICtail J5
+SDA2 pin 74 I2C2 bus (see above)
+SCL2 pin 76 I2C2 bus (see above)
+SCK2 pin 45 (see CPLD)
+SDI2 pin 47 (see CPLD)
+SDO2 pin 49 (see CPLD)
+RG9 pin 51 (see CPLD)
+U1RX pin 88
+U1TX pin 90
+~U1RTS pin 92
+~U1CTS pin 94
+RB9 pin 73
+RA10 pin 115 Reset (see Graphics controller and MRF24WBOMA)
+INT1 pin 85
+SCL1 pin 84
+SDA1 pin 86 (see CPLD)
+~SSI pin 97 (see CPLD)
+U2RX pin 110 (see CPLD)
+U2TX pin 112 (see CPLD)
+~U2RTS pin 106 (see CPLD)
+~U2CTS pin 108 (see CPLD)
+
+PICtail
+=======
+
+The MEB brings many of the signals out via the PICtail (J5). J5 is
+a 28 pin connector bringing out signals as summarized here (J3 is the
+designation of the connection to the Ethernet starter kit on the
+MEB side):
+
+--- --- ------------------------
+J3 J5 Table 2-1
+PIN PIN Description
+--- --- ------------------------
+ 1 3.3V
+ 2 I/O_4 (Test Point)
+ 76 3 SCL2
+ 84 4 SCL1
+ 74 5 SDA2
+ 86 6 SDA1
+ 47 7 SDI2/SDI2A/CN9/RG7
+ 97 8 SS1, WFI_SDO
+ 49 9 SDO2/SDO2A
+ 10 WFI_SDI
+ 45 11 SCK2/SCK2A
+ 12 WFI_SCK
+ 51 13 SS2/SS2A/RG9
+ 14 SS1/RB2
+ 88 15 U1RX/SDI1A
+110 16 U2RX/SDI3A
+ 90 17 U1TX/RA10
+112 18 U2TX/SDO3A
+ 92 19 U1RTS/C2OUT/AN9
+106 20 U2RTS/SCK3A
+ 94 21 U1CTS/SDO1A
+108 22 U2CTS/SS3A/RF12
+ 73 23 RB9/INT1/RE8
+ 115 25 RA10/SCK1A
+ 26 3.3V
+ 85 27 INT1/SS1/RD14
+ 28 GND
+
+Toolchains
+==========
+
+ MPLAB/C32
+ ---------
+
+ I am using the free, "Lite" version of the PIC32MX toolchain available
+ for download from the microchip.com web site. I am using the Windows
+ version. The MicroChip toolchain is the only toolchain currently
+ supported in these configurations, but it should be a simple matter to
+ adapt to other toolchains by modifying the Make.defs file include in
+ each configuration.
+
+ C32 Toolchain Options:
+
+ CONFIG_PIC32MX_MICROCHIPW - MicroChip full toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL - MicroChip full toolchain for Linux
+ CONFIG_PIC32MX_MICROCHIPW_LITE - MicroChip "Lite" toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL_LITE - MicroChip "Lite" toolchain for Linux
+
+ NOTE: The "Lite" versions of the toolchain does not support C++. Also
+ certain optimization levels are not supported by the "Lite" toolchain.
+
+ MicrochipOpen
+ -------------
+
+ An alternative, build-it-yourself toolchain is available here:
+ http://sourceforge.net/projects/microchipopen/ . These tools were
+ last updated circa 2010. NOTE: C++ support still not available
+ in this toolchain.
+
+ Building MicrochipOpen (on Linux)
+
+ 1) Get the build script from this location:
+
+ http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
+
+ 2) Build the code using the build script, for example:
+
+ ./build.sh -b v105_freeze
+
+ This will check out the selected branch and build the tools.
+
+ 3) Binaries will then be available in a subdirectory with a name something like
+ pic32-v105-freeze-20120622/install-image/bin (depending on the current data
+ and the branch that you selected.
+
+ Note that the tools will have the prefix, mypic32- so, for example, the
+ compiler will be called mypic32-gcc.
+
+ Pinguino mips-elf Toolchain
+ ---------------------------
+
+ Another option is the mips-elf toolchain used with the Pinguino project. This
+ is a relatively current mips-elf GCC and should provide free C++ support as
+ well. This toolchain can be downloded from the Pinguino website:
+ http://wiki.pinguino.cc/index.php/Main_Page#Download . There is some general
+ information about using the Pinguino mips-elf toolchain in this thread:
+ http://tech.groups.yahoo.com/group/nuttx/message/1821
+
+ See also configs/mirtoo/README.txt. There is an experimental (untested)
+ configuration for the Mirtoo platform in that directory.
+
+ MPLAB/C32 vs MPLABX/X32
+ -----------------------
+
+ It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
+ it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
+ with the NuttX build scripts. Here are some of the issues that I see when trying
+ to build with XC32:
+
+ 1) Make.def changes: You have to change the tool prefix:
+
+ CROSSDEV=xc32-
+
+ 2) debug.ld/release.ld: The like expect some things that are not present in
+ the current linker scripts (or are expected with different names). Here
+ are some partial fixes:
+
+ Rename: kseg0_progmem to kseg0_program_mem
+ Rename: kseg1_datamem to kseg1_data_mem
+
+ Even then, there are more warnings from the linker and some undefined symbols
+ for non-NuttX code that resides in the unused Microchip libraries. See this
+ email thread at http://tech.groups.yahoo.com/group/nuttx/message/1458 for more
+ information. You will have to solve at least this undefined symbol problem if
+ you want to used the XC32 toolchain.
+
+ Windows Native Toolchains
+ -------------------------
+
+ NOTE: There are several limitations to using a Windows based toolchain in a
+ Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+Powering the Board
+==================
+
+ Ethernet Starter Kit:
+
+ There are two ways to supply power to the PIC32 Ethernet Starter Kit:
+
+ - USB bus power connected to USB debug connector J1.
+ - An external application board with a regulated DC power supply that
+ provides +5V can be connected to the J2 application board connector
+ that is provided on the bottom side of the board.
+
+ One green LED (D3) is provided to show that the PIC32 microcontroller
+ is powered up.
+
+ Ethernet Starter Kit with MEB:
+
+ Power can be supplied to the Multimedia Expansion Board through the DC
+ connector located on the Multimedia Expansion Board... By connecting
+ 9-14V power supply to the DC connector, the Multimedia Expansion Board
+ and starter kit will receive the proper voltages. The user can also
+ supply power via the starter kit. However, if the application uses
+ multiple features of the Multimedia Expansion Board, it is recommended
+ to use 9-14V power supply."
+
+On Board Debug Support
+======================
+
+ The PIC32 Ethernet Starter Kit includes a PIC32MX440F512H USB microcontroller
+ that provides debugger connectivity over USB. The PIC32MX440F512H is hard-wired
+ to the PIC32 device to provide two types of protocol translation:
+
+ - I/O pins of PIC32MX440F512H to the ICSP™ pins of the PIC32
+ - I/O pins of PIC32MX440F512H to the JTAG pins of the PIC32
+
+ The PIC32 Ethernet Starter Kit currently uses the JTAG pins of the PIC32 device for
+ programming and debugging.
+
+Creating Compatible NuttX HEX files
+===================================
+
+ Intel Hex Format Files:
+ -----------------------
+
+ When NuttX is built it will produce two files in the top-level NuttX
+ directory:
+
+ 1) nuttx - This is an ELF file, and
+ 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
+ the setting CONFIG_INTELHEX_BINARY in the .config file.
+
+ The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
+ there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
+ file to contain physical addresses. But the nuttx.hex file generated from the
+ top-level make will have address in the KSEG0 and KSEG1 regions.
+
+ tools/pic32mx/mkpichex:
+ ----------------------
+
+ There is a simple tool in the NuttX tools/pic32mx directory that can be
+ used to solve both issues with the nuttx.hex file. But, first, you must
+ build the tool:
+
+ cd tools/pic32mx
+ make
+
+ Now you will have an excecutable file call mkpichex (or mkpichex.exe on
+ Cygwin). This program will take the nutt.hex file as an input, it will
+ convert all of the KSEG0 and KSEG1 addresses to physical address, and
+ it will write the modified file, replacing the original nuttx.hex.
+
+ To use this file, you need to do the following things:
+
+ . ./setenv.sh # Source setenv.sh. Among other this, this script
+ # will add the NuttX tools/pic32mx directory to your
+ # PATH variable
+ make # Build nuttx and nuttx.hex
+ mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
+ # to the top-level build directory. It is the only
+ # required input to mkpichex.
+
+Serial Console: MEB
+===================
+
+ [[Warning: This all sounds great, but the fact is that I have not yet
+ gotten any serial UART output to work from the MEB.]]
+
+ A serial console is not required to use NuttX. However, all of the
+ Nuttx example code in the apps/examples assumes that you have a
+ serial console. The Ethernet Starter Kit(even with the MEB) does not
+ have any RS-232 connector needed to drive the serial console.
+
+ Raw UART signals are available at the MEB's PICtail connector, however,
+ and can be connected to an external MAX2232 board to get a serial console.
+ The defconfig files are set up to use UART2. So the proper connections
+ would be:
+
+ PICtail
+ PIN FUNCTION
+ -------- -----------
+ 1 3.3V
+ 16 U2RX
+ 18 U2TX
+ 28 GND
+
+ UART1 is also brought out on the PICtail and would be connected as:
+
+ PICtail
+ PIN FUNCTION
+ -------- -----------
+ 1 3.3V
+ 15 U1RX
+ 17 U1TX
+ 28 GND
+
+ Here is a summary of the tortuous routes taken by the PIC32MX UART pins:
+
+ --- ---------------------------------- -------------------------- -------------------------
+ PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (Starter Kit User Guide)
+ --- ---------------------------------- -------------------------- -------------------------
+
+ 39 AC1TX/RF13/SCK4/U2RTS/U5TX SCM3D/BCLK2/RF13 J2 pin 106 (UART2)
+ 40 AC1RX/RF12/SS4/U2CTS/U5RX SCM3C/RF12 J2 pin 108 (UART2)
+ 49 PMA9/CN17/RF4/SDA5/SDI4/U2RX PMPA9/SCM3A/CN17/RF4 J2 pin 109 (PMP address)
+ J2 pin 110 (UART2)
+ 50 PMA8/CN18/RF5/SCL5/SDO4/U2TX PMPA8/SCM3B/CN18/RF5 J2 pin 111 (PMP address)
+ J2 pin 112 (UART2)
+ 52 RF2/SDA3/SDI3/U1RX SCM1A/RF2 J2 pin 88 (UART1)
+ 53 RF8/SCL3/SDO3/U1TX SCM1B/RF8 J2 pin 90 (UART1)
+
+ J2 is the connector at the bottom of the Ethernet start kit that
+ mates the Ethernet Starter kit to the MEB. The MEB then makes the
+ following signals available on the PICtail (J5):
+
+ MEB Connector:
+
+ -------------------------- ------- ----------------------------------
+ Signal J3
+ -------------------------- -------
+ U1RX pin 88
+ U1TX pin 90
+ ~U1RTS pin 92
+ ~U1CTS pin 94
+ U2RX pin 110
+ U2TX pin 112
+ ~U2RTS pin 106
+ ~U2CTS pin 108
+ -------------------------- -------
+
+ PICtail:
+
+ The pins are labeled differently in Table 2-1 and in the schematic. This is
+ confusing. I will trust Table 2-1.
+
+ --- --- ------- --- --- -----------------
+ Table 2-1 Schematic
+ J3 J5 J3 J5
+ PIN PIN NAME PIN PIN Description
+ --- --- ------- ---- --- ------------
+ 1 3.3V
+ 88 15 U1RX 88 15 SDI1A
+ 110 16 U2RX 110 16 SDI3A
+ 90 17 U1TX 17 RA10
+ 90 SD01A
+ 112 18 U2TX 113 18 SDO3A
+ 92 19 U1RTS 19 C2OUT/AN9
+ 92 SCK1A
+ 106 20 U2RTS 106 20 SCK3A
+ 94 21 U1CTS 21 SDO1A
+ 94 SS1/RD14
+ 108 22 U2CTS 108 22 SS3A/RF12
+ 26 3.3V
+ 28 GND
+
+Serial Console: Starter Kit I/O Expansion Board
+===============================================
+
+ U1:
+ Ethernet Starter Kit Expansion I/O board
+ --------------------------------------------- -------------------------
+ PIN Description J2 J1 J10/J11
+ --- ---------------------------------- ------------- ------------------
+ 47 AETXD0/CN20/RD14/SS3/U1CTS/U4RX Not available N/A
+ 48 AETXD1/CN21/RD15/SCK3/U1RTS/U4TX Not available N/A
+ 52 RF2/SDA3/SDI3/U1RX J2 pin 88 J11 pin 41
+ 53 RF8/SCL3/SDO3/U1TX J2 pin 90 J11 pin 43
+
+ U2:
+ Ethernet Starter Kit Expansion I/O board
+ --------------------------------------------- -------------------------
+ PIN Description J2 J1 J10/J11
+ --- ---------------------------------- ------------- ------------------
+ 39 AC1TX/RF13/SCK4/U2RTS/U5TX J2 pin 106 J11 pin 42
+ 40 AC1RX/RF12/SS4/U2CTS/U5RX J2 pin 108 J11 pin 44
+ 50 PMA8/CN18/RF5/SCL5/SDO4/U2TX J2 pin 111 J10 pin 52
+ J2 pin 112 J11 pin 48
+ 49 PMA9/CN17/RF4/SDA5/SDI4/U2RX J2 pin 109 J10 pin 51
+ J2 pin 110 J11 pin 46
+
+ U3:
+ Ethernet Starter Kit Expansion I/O board
+ --------------------------------------------- -------------------------
+ PIN Description J2 J1 J10/J11
+ --- ---------------------------------- ------------- ------------------
+ 10 PMA5/CN8/ECOL/RG6/SCK2/U3RTS/U6TX J2 pin 45 J10 pin 23
+ J2 pin 117 J10 pin 55
+ 11 PMA4/CN9/ECRS/RG7/SDA4/SDI2/U3RX J2 pin 47 J10 pin 24
+ J2 pin 119 J10 pin 56
+ 12 PMA3/AECRSDV/AERXDV/CN10/ECRSDV/ Not available N/A
+ ERXDV/RG8/SCL4/SDO2/U3TX
+ 14 PMA2/AEREFCLK/AERXCLK/CN11/
+ EREFCLK/ERXCLK/RG9/SS2/U3CTS/ Not available N/A
+ U6RX
+
+ U4:
+ Ethernet Starter Kit Expansion I/O board
+ --------------------------------------------- -------------------------
+ PIN Description J2 J1 J10/J11
+ --- ---------------------------------- ------------- ------------------
+ 47 AETXD0/CN20/RD14/SS3/U1CTS/U4RX Not available N/A
+ 48 AETXD1/CN21/RD15/SCK3/U1RTS/U4TX Not available N/A
+
+ U5:
+ Ethernet Starter Kit Expansion I/O board
+ --------------------------------------------- -------------------------
+ PIN Description J2 J1 J10/J11
+ --- ---------------------------------- ------------- ------------------
+ 39 AC1TX/RF13/SCK4/U2RTS/U5TX J2 pin 106 J11 pin 42
+ 40 AC1RX/RF12/SS4/U2CTS/U5RX J2 pin 108 J11 pin 44
+
+ U6:
+ PIN Description
+ --- ----------------------------------
+ 10 PMA5/CN8/ECOL/RG6/SCK2/U3RTS/U6TX J2 pin 45 J10 pin 23
+ J2 pin 117 J10 pin 55
+ 14 PMA2/AEREFCLK/AERXCLK/CN11/ Not available N/A
+ EREFCLK/ERXCLK/RG9/SS2/U3CTS/
+ U6RX
+
+LEDs
+====
+
+ The PIC32MX Ethernet Starter kit has 3 user LEDs labeled LED1-3 on the
+ board graphics (but referred to as LED4-6 in the schematic):
+
+ PIN User's Guide Board Stencil Notes
+ --- ------------- -------------- -------------------------
+ RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
+ RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
+ RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
+
+ We will use the labels on the board to identify LEDs. If CONFIG_ARCH_LEDS
+ is defined, then NuttX will control these LEDs as follows:
+
+ ON OFF
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED1 LED2 LED3 LED1 LED2 LED3
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED_STARTED 0 OFF OFF OFF --- --- ---
+ LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ LED_STACKCREATED 3 ON ON N/C --- --- ---
+ LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ LED_PANIC 5 ON N/C N/C OFF N/C N/C
+
+ There are 5 additional LEDs available on the MEB. These are not
+ used by NuttX.
+
+ RD1 LED1
+ RD2 LED2
+ RD3 LED3
+ RC1 LED4
+ RC2 LED5
+
+PIC32MX Configuration Options
+=============================
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=mips
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_MIPS=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_MIPS32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=pic32mx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=pic32-starterkit
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_PIC32_STARTERKIT=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0xa0000000
+
+ CONFIG_ARCH_IRQPRIO - The PIC32MXx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ PIC32MX Configuration
+
+ CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
+
+ Individual subsystems can be enabled:
+
+ CONFIG_PIC32MX_WDT - Watchdog timer
+ CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
+ CONFIG_PIC32MX_T3 - Timer 3
+ CONFIG_PIC32MX_T4 - Timer 4
+ CONFIG_PIC32MX_T5 - Timer 5
+ CONFIG_PIC32MX_IC1 - Input Capture 1
+ CONFIG_PIC32MX_IC2 - Input Capture 2
+ CONFIG_PIC32MX_IC3 - Input Capture 3
+ CONFIG_PIC32MX_IC4 - Input Capture 4
+ CONFIG_PIC32MX_IC5 - Input Capture 5
+ CONFIG_PIC32MX_OC1 - Output Compare 1
+ CONFIG_PIC32MX_OC2 - Output Compare 2
+ CONFIG_PIC32MX_OC3 - Output Compare 3
+ CONFIG_PIC32MX_OC4 - Output Compare 4
+ CONFIG_PIC32MX_OC5 - Output Compare 5
+ CONFIG_PIC32MX_I2C1 - I2C 1
+ CONFIG_PIC32MX_I2C2 - I2C 2
+ CONFIG_PIC32MX_I2C3 - I2C 3
+ CONFIG_PIC32MX_I2C4 - I2C 4
+ CONFIG_PIC32MX_I2C5 - I2C 5
+ CONFIG_PIC32MX_SPI1 - SPI 1
+ CONFIG_PIC32MX_SPI2 - SPI 2
+ CONFIG_PIC32MX_SPI3 - SPI 3
+ CONFIG_PIC32MX_SPI4 - SPI 4
+ CONFIG_PIC32MX_UART1 - UART 1
+ CONFIG_PIC32MX_UART2 - UART 2
+ CONFIG_PIC32MX_UART3 - UART 3
+ CONFIG_PIC32MX_UART4 - UART 4
+ CONFIG_PIC32MX_UART5 - UART 5
+ CONFIG_PIC32MX_UART6 - UART 6
+ CONFIG_PIC32MX_ADC - ADC 1
+ CONFIG_PIC32MX_PMP - Parallel Master Port
+ CONFIG_PIC32MX_CM1 - Comparator 1
+ CONFIG_PIC32MX_CM2 - Comparator 2
+ CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA - DMA
+ CONFIG_PIC32MX_FLASH - FLASH
+ CONFIG_PIC32MX_USBDEV - USB device
+ CONFIG_PIC32MX_USBHOST - USB host
+ CONFIG_PIC32MX_CAN1 - Controller area network 1
+ CONFIG_PIC32MX_CAN2 - Controller area network 2
+ CONFIG_PIC32MX_ETHERNET - Ethernet
+
+ PIC32MX Configuration Settings
+ DEVCFG0:
+ CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
+ value 2 enables.
+ CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
+ Default 1 (PG2)
+ CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
+ CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
+ CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
+ DEVCFG1: (All settings determined by selections in board.h)
+ DEVCFG2: (All settings determined by selections in board.h)
+ DEVCFG3:
+ CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
+ (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
+ (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
+ can be enabled later by software).
+
+ The priority of interrupts may be specified. The value ranage of
+ priority is 4-31. The default (16) will be used if these any of these
+ are undefined.
+
+ CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
+ CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
+ CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
+ CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
+ CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
+ CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
+ CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
+ CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
+ CONFIG_PIC32MX_T2PRIO - Timer 2 priority
+ CONFIG_PIC32MX_T3PRIO - Timer 3 priority
+ CONFIG_PIC32MX_T4PRIO - Timer 4 priority
+ CONFIG_PIC32MX_T5PRIO - Timer 5 priority
+ CONFIG_PIC32MX_IC1PRIO - Input Capture 1
+ CONFIG_PIC32MX_IC2PRIO - Input Capture 2
+ CONFIG_PIC32MX_IC3PRIO - Input Capture 3
+ CONFIG_PIC32MX_IC4PRIO - Input Capture 4
+ CONFIG_PIC32MX_IC5PRIO - Input Capture 5
+ CONFIG_PIC32MX_OC1PRIO - Output Compare 1
+ CONFIG_PIC32MX_OC2PRIO - Output Compare 2
+ CONFIG_PIC32MX_OC3PRIO - Output Compare 3
+ CONFIG_PIC32MX_OC4PRIO - Output Compare 4
+ CONFIG_PIC32MX_OC5PRIO - Output Compare 5
+ CONFIG_PIC32MX_I2C1PRIO - I2C 1
+ CONFIG_PIC32MX_I2C2PRIO - I2C 2
+ CONFIG_PIC32MX_I2C3PRIO - I2C 3
+ CONFIG_PIC32MX_I2C4PRIO - I2C 4
+ CONFIG_PIC32MX_I2C5PRIO - I2C 5
+ CONFIG_PIC32MX_SPI2PRIO - SPI 2
+ CONFIG_PIC32MX_UART1PRIO - UART 1
+ CONFIG_PIC32MX_UART2PRIO - UART 2
+ CONFIG_PIC32MX_CN - Input Change Interrupt
+ CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
+ CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
+ CONFIG_PIC32MX_CM1PRIO - Comparator 1
+ CONFIG_PIC32MX_CM2PRIO - Comparator 2
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
+ CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
+ CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
+ CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
+ CONFIG_PIC32MX_DMA4PRIO - DMA Channel 4
+ CONFIG_PIC32MX_DMA5PRIO - DMA Channel 5
+ CONFIG_PIC32MX_DMA6PRIO - DMA Channel 6
+ CONFIG_PIC32MX_DMA7PRIO - DMA Channel 7
+ CONFIG_PIC32MX_FCEPRIO - Flash Control Event
+ CONFIG_PIC32MX_USBPRIO - USB
+
+ PIC32MXx specific device driver settings. NOTE: For the Ethernet
+ starter kit, there is no RS-232 connector (even with the MEB). See
+ discussion above ("") for information about how you can configure
+ an external MAX2232 board to get a serial console.
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+PIC32MX specific PHY/Ethernet device driver settings
+
+ CONFIG_PHY_KS8721 - Selects the Micrel KS8721 PHY
+ CONFIG_PHY_DP83848C - Selects the National Semiconduction DP83848C PHY
+ CONFIG_PHY_LAN8720 - Selects the SMSC LAN8720 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 2
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 4
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ Related DEVCFG3 Configuration Settings:
+ CONFIG_PIC32MX_FETHIO: Ethernet I/O Pin Selection bit:
+ 1 = Default Ethernet I/O Pins
+ 0 = Alternate Ethernet I/O Pins
+ CONFIG_PIC32MX_FMIIEN: Ethernet MII Enable bit
+ 1 = MII enabled
+ 0 = RMII enabled
+
+ PIC32MXx USB Device Configuration
+
+ PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
+
+Configurations
+==============
+
+Each PIC32MX configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh pic32-starterkit/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ =======
+ Description.
+ ------------
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ Serial Output.
+ --------------
+ The OS test produces all of its test output on the serial console.
+ This configuration has UART1 enabled as a serial console. I have
+ been unable to get this UART work on the MEB. But on the Expansion
+ I/O board, this maps to RX = J11 pin 41 and TX = J11 pin 43
+
+ nsh:
+ ====
+ Description.
+ ------------
+ This is the NuttShell (NSH) using the NSH startup logic at
+ apps/examples/nsh.
+
+ Serial Output.
+ --------------
+ The OS test produces all of its test output on the serial console.
+ This configuration has UART1 enabled as a serial console. I have
+ been unable to get this UART work on the MEB. But on the Expansion
+ I/O board, this maps to RX = J11 pin 41 and TX = J11 pin 43
+
+ USB Configuations.
+ -----------------
+ Several USB device configurations can be enabled and included
+ as NSH built-in built in functions.
+
+ To use USB device, connect the starter kit to the host using a cable
+ with a Type-B micro-plug to the starter kit’s micro-A/B port J5, located
+ on the bottom side of the starter kit. The other end of the cable
+ must have a Type-A plug. Connect it to a USB host. Jumper JP2 should be
+ removed.
+
+ All USB device configurations require the following basic setup in
+ your NuttX configuration file to enable USB device support:
+
+ CONFIG_USBDEV=y : Enable basic USB device support
+ CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
+
+ examples/usbterm - This option can be enabled by uncommenting
+ the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/usbterm
+
+ And by enabling one of the USB serial devices:
+
+ CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
+ CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
+
+ examples/cdcacm - The examples/cdcacm program can be included as an
+ function by uncommenting the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/cdcacm
+
+ and defining the following in your .config file:
+
+ CONFIG_CDCACM=y : Enable the CDCACM device
+
+ examples/usbstorage - There are some hooks in the appconfig file
+ to enable the USB mass storage device. However, this device cannot
+ work until support for the SD card is also incorporated.
+
+ Networking Configuations.
+ -------------------------
+ Several Networking configurations can be enabled and included
+ as NSH built-in built in functions. The following additional
+ configuration settings are required:
+
+ CONFIG_NET=y : Enable networking support
+ CONFIG_PIC32MX_ETHERNET=y : Enable the PIC32 Ethernet driver
+ CONFIG_NSH_TELNET=y : Enable the Telnet NSH console (optional)
+
+ NOTES:
+ 1. This logic will assume that a network is connected. During its
+ initialization, it will try to negotiate the link speed. If you have
+ no network connected when you reset the board, there will be a long
+ delay (maybe 30 seconds?) before anything happens. That is the timeout
+ before the networking finally gives up and decides that no network is
+ available.
+
+ 2. This example can support an FTP client. In order to build in FTP client
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpc
+ #CONFIGURED_APPS += examples/ftpc
+
+ 3. This example can support an FTP server. In order to build in FTP server
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpd
+ #CONFIGURED_APPS += examples/ftpd
+
+ And enable poll() support in the NuttX configuration file:
+
+ CONFIG_DISABLE_POLL=n
+
+ nsh2:
+ =====
+
+ This is an alternative NSH configuration. Without the Expansion I/O board,
+ there is no way to connect a serial console. This NSH alternative supports
+ only a Telnet console. The nsh2 differs from the nsh configuration in the
+ following ways:
+
+ 1. Networking is enabled:
+
+ CONFIG_NET=y : Enable networking support
+ CONFIG_PIC32MX_ETHERNET=y : Enable the PIC32 Ethernet driver
+ CONFIG_NSH_CONSOLE=n : Disable NSH serial console
+ CONFIG_NSH_TELNET=y : Enable the Telnet NSH console
+
+ See apps/nshlib/README.txt for other NSH networking-related configuration
+ settings.
+
+ 2. UART1 is disabled
+
+ CONFIG_PIC32MX_UART1=n : UART1 is disabled (as well as other UARTs)
+ CONFIG_UART1_SERIAL_CONSOLE=n : There is no serial console
+
+ 3. The RAM log is enabled"
+
+ CONFIG_SYSLOG=y : Enables the System Logging feature.
+ CONFIG_RAMLOG=y : Enable the RAM-based logging feature.
+ CONFIG_RAMLOG_CONSOLE=n : (there is no default console device)
+ CONFIG_RAMLOG_SYSLOG=y : This enables the RAM-based logger as the
+ system logger.
+
+ Logging is currently set up to use 16Kb of memory:
+
+ CONFIG_RAMLOG_CONSOLE_BUFSIZE=16384
+
+ There are a few other configuration differences as necessary to support
+ this different device configuration. Just the do the 'diff' if you are
+ curious.
+
+ NOTES:
+ See the notes for the nsh configuration. Most also apply to the nsh2
+ configuration.
+
+ Using a RAM disk and the USB MSC device with nsh and nsh2
+ ---------------------------------------------------------
+ Here is an experimental change to either examples/nsh or examples/nsh2
+ that will create a RAM disk and attempt to export that RAM disk as a
+ USB mass storage device.
+
+ 1. Changes to nuttx/.config
+
+ a) Enable support for the PIC32 USB device
+
+ -CONFIG_PIC32MX_USBDEV=n
+ +CONFIG_PIC32MX_USBDEV=y
+
+ b) Enable NuttX USB device support
+
+ -CONFIG_USBDEV=n
+ +CONFIG_USBDEV=y
+
+ c) Enable the USB MSC class driver
+
+ -CONFIG_USBMSC=n
+ +CONFIG_USBMSC=y
+
+ d) Use a RAM disk (instead of an SD card) as the USB MSC logical unit:
+
+ -CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+ +CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/ram0"
+
+ 2. Changes to nuttx/.config.
+
+ a) Enable building of the examples/usbstorage:
+
+ -# CONFIGURED_APPS += examples/usbstorage
+ + CONFIGURED_APPS += examples/usbstorage
+
+ 3. When NSH first comes up, you must manually create the RAM disk
+ before exporting it:
+
+ a) Create a 64Kb RAM disk at /dev/ram0:
+
+ nsh> mkrd -s 512 128
+
+ b) Put a FAT file system on the RAM disk:
+
+ nsh> mkfatfs /dev/ram0
+
+ b) Now the 'msconn' command will connect to the host and
+ export /dev/ram0 as the USB logical unit:
+
+ nsh> msconn
+
+ NOTE: This modification should be considered experimental. IN the
+ little testing I have done with it, it appears functional. But the
+ logic has not been stressed and there could still be lurking issues.
+ (There is a bug associated with this configuration listed in the
+ top-level TODO list).
diff --git a/nuttx/configs/pic32-starterkit/include/board.h b/nuttx/configs/pic32-starterkit/include/board.h
new file mode 100644
index 000000000..ebe15e89b
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/include/board.h
@@ -0,0 +1,227 @@
+/****************************************************************************
+ * configs/pic32-starterkit/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_SURE_PIC32MX_INCLUDE_BOARD_H
+#define __CONFIGS_SURE_PIC32MX_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdbool.h>
+#endif
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Crystal frequencies */
+
+#define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */
+#define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz) */
+
+/* Oscillator modes */
+
+#define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
+#define BOARD_POSC_HSMODE 1 /* High-speed crystal (HS) mode */
+
+/* PLL configuration and resulting CPU clock.
+ * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
+ */
+
+#define BOARD_PLL_INPUT BOARD_POSC_FREQ
+#define BOARD_PLL_IDIV 2 /* PLL input divider */
+#define BOARD_PLL_MULT 20 /* PLL multiplier */
+#define BOARD_PLL_ODIV 1 /* PLL output divider */
+
+#define BOARD_CPU_CLOCK 80000000 /* CPU clock (80MHz = 8MHz * 20 / 2) */
+
+/* USB PLL configuration.
+ * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
+ */
+
+#define BOARD_UPLL_IDIV 2 /* USB PLL divider (revisit) */
+#define BOARD_USB_CLOCK 48000000 /* USB clock (8MHz / 2) * 24 / 2) */
+
+/* Peripheral clock is divided down from CPU clock.
+ * PBCLOCK = CPU_CLOCK / PBDIV
+ */
+
+#define BOARD_PBDIV 2 /* Peripheral clock divisor (PBDIV) */
+#define BOARD_PBCLOCK 40000000 /* Peripheral clock (PBCLK = 80MHz/2) */
+
+/* Watchdog pre-scaler (re-visit) */
+
+#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
+#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
+
+/* Ethernet MII clocking.
+ *
+ * The clock divider used to create the MII Management Clock (MDC). The MIIM
+ * module uses the SYSCLK as an input clock. According to the IEEE 802.3
+ * Specification this should be no faster than 2.5 MHz. However, some PHYs
+ * support clock rates up to 12.5 MHz.
+ */
+
+#define BOARD_EMAC_MIIM_DIV 32 /* Ideal: 80MHz/32 = 2.5MHz */
+
+/* LED definitions **********************************************************/
+/* LED Configuration ********************************************************/
+/* The PIC32MX Ethernet Starter kit has 3 user LEDs labeled LED1-3 on the
+ * board graphics (but referred to as LED4-6 in the schematic):
+ *
+ * PIN User's Guide Board Stencil Notes
+ * --- ------------- -------------- -------------------------
+ * RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
+ * RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
+ * RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
+ *
+ * We will use the labels on the board to identify LEDs
+ *
+ * There are 5 additional LEDs available on the MEB (but not used by NuttX):
+ *
+ * RD1 LED1
+ * RD2 LED2
+ * RD3 LED3
+ * RC1 LED4
+ * RC2 LED5
+ */
+
+/* LED index values for use with pic32mx_setled() */
+
+#define PIC32MX_STARTERKIT_LED1 0
+#define PIC32MX_STARTERKIT_LED2 1
+#define PIC32MX_STARTERKIT_LED3 2
+#define PIC32MX_STARTERKIT_NLEDS 3
+
+/* LED bits for use with pic32mx_setleds() */
+
+#define PIC32MX_STARTERKIT_LED1_BIT (1 << PIC32MX_STARTERKIT_LED1)
+#define PIC32MX_STARTERKIT_LED2_BIT (1 << PIC32MX_STARTERKIT_LED2)
+#define PIC32MX_STARTERKIT_LED3_BIT (1 << PIC32MX_STARTERKIT_LED3)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 3 LEDs
+ * on board the Ethernet Starter Kit. The following definitions
+ * describe how NuttX controls the LEDs:
+ *
+ * ON OFF
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED1 LED2 LED3 LED1 LED2 LED3
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF OFF --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 4
+#define LED_ASSERTION 4
+#define LED_PANIC 5
+
+#define LED_NVALUES 6
+
+/* Switch definitions *******************************************************/
+/* The PIC32 starter kit has 3 switches:
+ *
+ * RD7 Switch SW2 (low when closed)
+ * RD6 Switch SW1 (low when closed)
+ * RD13 Switch SW3 (low when closed)
+ */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_ledinit and pic32mx_setled
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
+ * are available to control the LEDs from user applicaitons.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_setled(int led, bool ledon);
+#endif
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_setleds(uint8_t ledset);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SURE_PIC32MX_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/pic32-starterkit/nsh/Make.defs b/nuttx/configs/pic32-starterkit/nsh/Make.defs
new file mode 100644
index 000000000..cb2a34816
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pic32-starterkit/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pic32-starterkit/nsh/appconfig b/nuttx/configs/pic32-starterkit/nsh/appconfig
new file mode 100644
index 000000000..6fd17ae0c
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh/appconfig
@@ -0,0 +1,115 @@
+############################################################################
+# configs/pic32-starterkit/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+############################################################################
+# Path to example in apps/examples containing the user_start entry point
+############################################################################
+
+CONFIGURED_APPS += examples/nsh
+
+############################################################################
+# The NSH application library
+############################################################################
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+############################################################################
+# USB device configurations
+############################################################################
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+
+# USB Mass Storage Class device configurations
+
+ifeq ($(CONFIG_USBMSC),y)
+# Uncomment to enable the examples/usbstorage built-in
+# CONFIGURED_APPS += examples/usbstorage
+endif
+
+# USB CDC/ACM serial device configurations
+
+ifeq ($(CONFIG_CDCACM),y)
+# Uncomment to enable the examples/cdcacm built-in
+# CONFIGURED_APPS += examples/cdcacm
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+
+# Prolifics PL2303 emulation configurations
+
+ifeq ($(CONFIG_PL2303),y)
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+endif
+
+############################################################################
+# Networking configurations
+############################################################################
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+############################################################################
+# Other pplications that can be configured as an NX built-in commands
+############################################################################
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+
diff --git a/nuttx/configs/pic32-starterkit/nsh/defconfig b/nuttx/configs/pic32-starterkit/nsh/defconfig
new file mode 100644
index 000000000..2f0248f41
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh/defconfig
@@ -0,0 +1,676 @@
+############################################################################
+# configs/pic32-starterkit/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+CONFIG_ARCH_BOARD="pic32-starterkit"
+CONFIG_ARCH_BOARD_PIC32_STARTERKIT=y
+CONFIG_BOARD_LOOPSPERMSEC=7245
+CONFIG_DRAM_SIZE=131072
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_SPI3=n
+CONFIG_PIC32MX_SPI4=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_UART3=n
+CONFIG_PIC32MX_UART4=n
+CONFIG_PIC32MX_UART5=n
+CONFIG_PIC32MX_UART6=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_CAN1=n
+CONFIG_PIC32MX_CAN2=n
+CONFIG_PIC32MX_ETHERNET=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+CONFIG_PIC32MX_FETHIO=0
+CONFIG_PIC32MX_FMIIEN=0
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+CONFIG_UART6_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+CONFIG_UART6_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+CONFIG_UART6_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+CONFIG_UART6_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+CONFIG_UART6_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+CONFIG_UART6_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+CONFIG_UART6_2STOP=0
+
+#
+# PIC32MX specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=y
+CONFIG_PHY_LAN8720=n
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+CONFIG_NET_DESCDEBUG=n
+CONFIG_NET_DUMPPACKET=n
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=7
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=128
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=512
+CONFIG_FTPD_DATABUFFERSIZE=2048
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=4
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pic32-starterkit/nsh/ld.script b/nuttx/configs/pic32-starterkit/nsh/ld.script
new file mode 100644
index 000000000..88f722064
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pic32-starterkit/nsh/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX795F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX795F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX795F512L has 128Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 128K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pic32-starterkit/nsh/setenv.sh b/nuttx/configs/pic32-starterkit/nsh/setenv.sh
new file mode 100755
index 000000000..540ade226
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pic32-starterkit/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the tools subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pic32-starterkit/nsh2/Make.defs b/nuttx/configs/pic32-starterkit/nsh2/Make.defs
new file mode 100644
index 000000000..e4f4672a2
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh2/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pic32-starterkit/nsh2/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh2/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh2/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pic32-starterkit/nsh2/appconfig b/nuttx/configs/pic32-starterkit/nsh2/appconfig
new file mode 100644
index 000000000..83f7aa874
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh2/appconfig
@@ -0,0 +1,115 @@
+############################################################################
+# configs/pic32-starterkit/nsh2/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+############################################################################
+# Path to example in apps/examples containing the user_start entry point
+############################################################################
+
+CONFIGURED_APPS += examples/nsh
+
+############################################################################
+# The NSH application library
+############################################################################
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+############################################################################
+# USB device configurations
+############################################################################
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+
+# USB Mass Storage Class device configurations
+
+ifeq ($(CONFIG_USBMSC),y)
+# Uncomment to enable the examples/usbstorage built-in
+# CONFIGURED_APPS += examples/usbstorage
+endif
+
+# USB CDC/ACM serial device configurations
+
+ifeq ($(CONFIG_CDCACM),y)
+# Uncomment to enable the examples/cdcacm built-in
+# CONFIGURED_APPS += examples/cdcacm
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+
+# Prolifics PL2303 emulation configurations
+
+ifeq ($(CONFIG_PL2303),y)
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+endif
+
+############################################################################
+# Networking configurations
+############################################################################
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+############################################################################
+# Other pplications that can be configured as an NX built-in commands
+############################################################################
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+
diff --git a/nuttx/configs/pic32-starterkit/nsh2/defconfig b/nuttx/configs/pic32-starterkit/nsh2/defconfig
new file mode 100644
index 000000000..be8ef53a0
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh2/defconfig
@@ -0,0 +1,675 @@
+############################################################################
+# configs/pic32-starterkit/nsh2/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+CONFIG_ARCH_BOARD="pic32-starterkit"
+CONFIG_ARCH_BOARD_PIC32_STARTERKIT=y
+CONFIG_BOARD_LOOPSPERMSEC=7245
+CONFIG_DRAM_SIZE=131072
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_SPI3=n
+CONFIG_PIC32MX_SPI4=n
+CONFIG_PIC32MX_UART1=n
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_UART3=n
+CONFIG_PIC32MX_UART4=n
+CONFIG_PIC32MX_UART5=n
+CONFIG_PIC32MX_UART6=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_CAN1=n
+CONFIG_PIC32MX_CAN2=n
+CONFIG_PIC32MX_ETHERNET=y
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+CONFIG_PIC32MX_FETHIO=0
+CONFIG_PIC32MX_FMIIEN=0
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+CONFIG_UART6_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+CONFIG_UART6_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+CONFIG_UART6_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+CONFIG_UART6_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+CONFIG_UART6_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+CONFIG_UART6_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+CONFIG_UART6_2STOP=0
+
+#
+# PIC32MX specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=y
+CONFIG_PHY_LAN8720=n
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+CONFIG_NET_DESCDEBUG=n
+CONFIG_NET_DUMPPACKET=n
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=7
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=y
+CONFIG_RAMLOG=y
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=y
+#CONFIG_RAMLOG_NPOLLWAITERS
+CONFIG_RAMLOG_CONSOLE_BUFSIZE=16384
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=128
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=16
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=512
+CONFIG_FTPD_DATABUFFERSIZE=2048
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=n
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=4
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pic32-starterkit/nsh2/ld.script b/nuttx/configs/pic32-starterkit/nsh2/ld.script
new file mode 100644
index 000000000..1f07ee651
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh2/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pic32-starterkit/nsh2/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX795F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX795F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX795F512L has 128Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 128K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pic32-starterkit/nsh2/setenv.sh b/nuttx/configs/pic32-starterkit/nsh2/setenv.sh
new file mode 100755
index 000000000..47effba5b
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/nsh2/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pic32-starterkit/nsh2/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the tools subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pic32-starterkit/ostest/Make.defs b/nuttx/configs/pic32-starterkit/ostest/Make.defs
new file mode 100644
index 000000000..d82af28b9
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/ostest/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pic32-starterkit/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pic32-starterkit/ostest/appconfig b/nuttx/configs/pic32-starterkit/ostest/appconfig
new file mode 100644
index 000000000..0f7fb6876
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/pic32-starterkit/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/pic32-starterkit/ostest/defconfig b/nuttx/configs/pic32-starterkit/ostest/defconfig
new file mode 100644
index 000000000..bcd26cce5
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/ostest/defconfig
@@ -0,0 +1,673 @@
+############################################################################
+# configs/pic32-starterkit/ostest/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+CONFIG_ARCH_BOARD="pic32-starterkit"
+CONFIG_ARCH_BOARD_PIC32_STARTERKIT=y
+CONFIG_BOARD_LOOPSPERMSEC=7245
+CONFIG_DRAM_SIZE=131072
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_SPI3=n
+CONFIG_PIC32MX_SPI4=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_UART3=n
+CONFIG_PIC32MX_UART4=n
+CONFIG_PIC32MX_UART5=n
+CONFIG_PIC32MX_UART6=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_CAN1=n
+CONFIG_PIC32MX_CAN2=n
+CONFIG_PIC32MX_ETHERNET=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+CONFIG_PIC32MX_FETHIO=0
+CONFIG_PIC32MX_FMIIEN=0
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+CONFIG_UART6_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+CONFIG_UART6_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+CONFIG_UART6_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+CONFIG_UART6_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+CONFIG_UART6_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+CONFIG_UART6_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+CONFIG_UART6_2STOP=0
+
+#
+# PIC32MX specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=y
+CONFIG_PHY_LAN8720=n
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+CONFIG_NET_DESCDEBUG=n
+CONFIG_NET_DUMPPACKET=n
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=512
+CONFIG_FTPD_DATABUFFERSIZE=2048
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=4
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pic32-starterkit/ostest/ld.script b/nuttx/configs/pic32-starterkit/ostest/ld.script
new file mode 100644
index 000000000..d2c1f162b
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/ostest/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pic32-starterkit/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX795F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX795F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX795F512L has 128Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 128K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pic32-starterkit/ostest/setenv.sh b/nuttx/configs/pic32-starterkit/ostest/setenv.sh
new file mode 100755
index 000000000..4e4777ce6
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pic32-starterkit/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pic32-starterkit/src/Makefile b/nuttx/configs/pic32-starterkit/src/Makefile
new file mode 100644
index 000000000..4c086b209
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/Makefile
@@ -0,0 +1,99 @@
+############################################################################
+# configs/pic32-starterkit/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c up_spi.c
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+CSRCS += up_usbdev.c
+ifeq ($(CONFIG_EXAMPLES_USBTERM_DEVINIT),y)
+CSRCS += up_usbterm.c
+endif
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/pic32-starterkit/src/starterkit_internal.h b/nuttx/configs/pic32-starterkit/src/starterkit_internal.h
new file mode 100644
index 000000000..f95859916
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/starterkit_internal.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/pic32-starterkit/src/starterkit_internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_PIC32_STARTERKIT_SRC_STARTERKIT_INTERNAL_H
+#define __CONFIGS_PIC32_STARTERKIT_SRC_STARTERKIT_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* The PIC32 starter kit has 3 user LEDs
+ *
+ * RD0 User LED D4 (high illuminates)
+ * RD2 User LED D5 (high illuminates)
+ * RD1 User LED D6 (high illuminates)
+ *
+ * There are 5 LEDs available on the MEB:
+ *
+ * RD1 LED1
+ * RD2 LED2
+ * RD3 LED3
+ * RC1 LED4
+ * RC2 LED5
+ */
+
+/* The PIC32 starter kit has 3 switches:
+ *
+ * RD7 Switch SW2 (low when closed)
+ * RD6 Switch SW1 (low when closed)
+ * RD13 Switch SW3 (low when closed)
+ */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the PCB Logic board.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PIC32MX_SPI2)
+EXTERN void weak_function pic32mx_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_PIC32_STARTERKIT_SRC_STARTERKIT_INTERNAL_H */
diff --git a/nuttx/configs/pic32-starterkit/src/up_boot.c b/nuttx/configs/pic32-starterkit/src/up_boot.c
new file mode 100644
index 000000000..2b357993c
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_boot.c
@@ -0,0 +1,94 @@
+/************************************************************************************
+ * configs/pic32-starterkit/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "starterkit_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_boardinitialize
+ *
+ * Description:
+ * All PIC32MX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void pic32mx_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak
+ * function pic32mx_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \
+ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4)
+ if (pic32mx_spiinitialize)
+ {
+ pic32mx_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ pic32mx_ledinit();
+#endif
+}
diff --git a/nuttx/configs/pic32-starterkit/src/up_leds.c b/nuttx/configs/pic32-starterkit/src/up_leds.c
new file mode 100644
index 000000000..14b924f30
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_leds.c
@@ -0,0 +1,266 @@
+/****************************************************************************
+ * configs/pic32-starterkit/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "pic32mx-ioport.h"
+#include "starterkit_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED Configuration ********************************************************/
+/* The PIC32MX Ethernet Starter kit has 3 user LEDs labeled LED1-3 on the
+ * board graphics (but referred to as LED4-6 in the schematic):
+ *
+ * PIN User's Guide Board Stencil Notes
+ * --- ------------- -------------- -------------------------
+ * RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
+ * RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
+ * RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
+ *
+ * We will use the labels on the board to identify LEDs
+ *
+ * ON OFF
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED1 LED2 LED3 LED1 LED2 LED3
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF OFF --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
+ */
+
+#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN0)
+#define GPIO_LED_2 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN1)
+#define GPIO_LED_3 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN2)
+
+/* LED Management Definitions ***********************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+# define LED_OFF 0
+# define LED_ON 1
+# define LED_NC 2
+#endif
+
+/* Debug ********************************************************************/
+
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_LEDS)
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_LEDS
+# undef CONFIG_DEBUG_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private types
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+struct led_setting_s
+{
+ uint8_t led1 : 2;
+ uint8_t led2 : 2;
+ uint8_t led3 : 2;
+ uint8_t unused : 2;
+};
+#endif
+
+ /****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The
+ * following structures identified the LED settings for each NuttX LED state.
+ */
+
+#ifdef CONFIG_ARCH_LEDS
+static const struct led_setting_s g_ledonvalues[LED_NVALUES] =
+{
+ {LED_OFF, LED_OFF, LED_OFF, LED_OFF},
+ {LED_ON, LED_OFF, LED_NC, LED_OFF},
+ {LED_OFF, LED_ON, LED_NC, LED_OFF},
+ {LED_ON, LED_ON, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_ON, LED_OFF},
+ {LED_ON, LED_NC, LED_NC, LED_OFF},
+};
+
+static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
+{
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_OFF, LED_OFF},
+ {LED_OFF, LED_NC, LED_NC, LED_OFF},
+};
+
+/* If CONFIG_ARCH_LEDS is not defined, the the user can control the LEDs in
+ * any way. The following array simply maps the PIC32MX_STARTERKIT_LEDn
+ * index values to the correct LED pin configuration.
+ */
+
+#else
+static const uint16_t g_ledpincfg[PIC32MX_STARTERKIT_NLEDS] =
+{
+ GPIO_LED_1, GPIO_LED_2, GPIO_LED_3
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_setleds(FAR const struct led_setting_s *setting)
+{
+ if (setting->led1 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_1, setting->led1 == LED_ON);
+ }
+
+ if (setting->led2 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_2, setting->led2 == LED_ON);
+ }
+
+ if (setting->led3 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_3, setting->led3 == LED_ON);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pic32mx_ledinit
+ ****************************************************************************/
+
+void pic32mx_ledinit(void)
+{
+ /* Configure output pins */
+
+ pic32mx_configgpio(GPIO_LED_1);
+ pic32mx_configgpio(GPIO_LED_2);
+ pic32mx_configgpio(GPIO_LED_3);
+}
+
+/****************************************************************************
+ * Name: pic32mx_setled
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setled(int led, bool ledon)
+{
+ if ((unsigned)led < PIC32MX_STARTERKIT_NLEDS)
+ {
+ pic32mx_gpiowrite(g_ledpincfg[led], ledon);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_setleds
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setleds(uint8_t ledset)
+{
+ pic32mx_setled(PIC32MX_STARTERKIT_LED1, (ledset & PIC32MX_STARTERKIT_LED1_BIT) != 0);
+ pic32mx_setled(PIC32MX_STARTERKIT_LED2, (ledset & PIC32MX_STARTERKIT_LED2_BIT) != 0);
+ pic32mx_setled(PIC32MX_STARTERKIT_LED3, (ledset & PIC32MX_STARTERKIT_LED3_BIT) != 0);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledon(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledonvalues[led]);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledoff(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledoffvalues[led]);
+ }
+}
+#endif
diff --git a/nuttx/configs/pic32-starterkit/src/up_nsh.c b/nuttx/configs/pic32-starterkit/src/up_nsh.c
new file mode 100644
index 000000000..0f0f0dffe
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_nsh.c
@@ -0,0 +1,381 @@
+/****************************************************************************
+ * config/pic32-starterkit/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+#include <nuttx/usb/usbhost.h>
+
+#include "pic32mx-internal.h"
+#include "starterkit_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Assume that we have MMC/SD, USB host (and USB device) */
+
+#define NSH_HAVEMMCSD 1
+#define NSH_HAVEUSBHOST 1
+
+/* The PIC32 Ethernet Starter Kit does not have an SD slot on board. If one
+ * is added, then it must be specified by defining which SPI bus that it
+ * is connected on.
+ */
+
+#ifndef CONFIG_PIC32MX_MMCSDSPIPORTNO
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Make sure that the configuration will support the SD card */
+
+#ifdef NSH_HAVEMMCSD
+
+ /* Make sure that the NSH configuration uses the correct SPI */
+
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO)
+# define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO
+# elif CONFIG_NSH_MMCSDSPIPORTNO != CONFIG_PIC32MX_MMCSDSPIPORTNO
+# warning "CONFIG_PIC32MX_MMCSDSPIPORTNO does not match CONFIG_NSH_MMCSDSPIPORTNO"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO
+# endif
+
+ /* Make sure that the NSH configuration uses the slot */
+
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# warning "The PIC32 Starter Kit has only one slot (0)"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+
+ /* Make sure that the correct SPI is enabled in the configuration */
+
+# if CONFIG_PIC32MX_MMCSDSPIPORTNO == 1 && !defined(CONFIG_PIC32MX_SPI1)
+# warning "CONFIG_PIC32MX_SPI1 is not enabled"
+# undef NSH_HAVEMMCSD
+# elif CONFIG_PIC32MX_MMCSDSPIPORTNO == 2 && !defined(CONFIG_PIC32MX_SPI2)
+# warning "CONFIG_PIC32MX_SPI2 is not enabled"
+# undef NSH_HAVEMMCSD
+# elif CONFIG_PIC32MX_MMCSDSPIPORTNO == 3 && !defined(CONFIG_PIC32MX_SPI3)
+# warning "CONFIG_PIC32MX_SPI3 is not enabled"
+# undef NSH_HAVEMMCSD
+# elif CONFIG_PIC32MX_MMCSDSPIPORTNO == 4 && !defined(CONFIG_PIC32MX_SPI4)
+# warning "CONFIG_PIC32MX_SPI4 is not enabled"
+# undef NSH_HAVEMMCSD
+# endif
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Select /dev/mmcsd0 if no other minor number is provided */
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* USB Host */
+
+#ifdef CONFIG_USBHOST
+# ifndef CONFIG_PIC32MX_USBHOST
+# error "CONFIG_PIC32MX_USBHOST is not selected"
+# undef NSH_HAVEUSBHOST
+# endif
+#endif
+
+#ifdef CONFIG_PIC32MX_USBHOST
+# ifndef CONFIG_USBHOST
+# warning "CONFIG_USBHOST is not selected"
+# undef NSH_HAVEUSBHOST
+# endif
+#endif
+
+#if !defined(CONFIG_USBHOST) || !defined(CONFIG_PIC32MX_USBHOST)
+# undef NSH_HAVEUSBHOST
+#endif
+
+#ifdef NSH_HAVEUSBHOST
+# ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+# endif
+# ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+# endif
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ message("nsh_waiter: Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ message("nsh_waiter: %s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Name: nsh_sdinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int nsh_sdinitialize(void)
+{
+ FAR struct spi_dev_s *ssp;
+ int ret;
+
+ /* Get the SPI port */
+
+ ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!ssp)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ ret = -ENODEV;
+ goto errout;
+ }
+
+ message("Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR,
+ CONFIG_NSH_MMCSDSLOTNO, ssp);
+ if (ret < 0)
+ {
+ message("nsh_sdinitialize: "
+ "Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO, ret);
+ goto errout;
+ }
+
+ message("Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+
+errout:
+ return ret;
+}
+#else
+# define nsh_sdinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbhostinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_usbhostinitialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ message("nsh_usbhostinitialize: Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ message("nsh_usbhostinitialize: Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ message("nsh_usbhostinitialize: Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ message("nsh_usbhostinitialize: Start nsh_waiter\n");
+
+#ifndef CONFIG_CUSTOM_STACK
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)nsh_waiter, (const char **)NULL);
+#else
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ (main_t)nsh_waiter, (const char **)NULL);
+#endif
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+ return -ENODEV;
+}
+#else
+# define nsh_usbhostinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbdevinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBDEV
+static int nsh_usbdevinitialize(void)
+{
+ /* The PIC32 Starter Kit has no way to know when the USB is connected. So
+ * we will fake it and tell the USB driver that the USB is connected now.
+ */
+
+ pic32mx_usbattach();
+ return OK;
+}
+#else
+# define nsh_usbdevinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ int ret;
+
+ /* Initialize SPI-based microSD */
+
+ ret = nsh_sdinitialize();
+ if (ret == OK)
+ {
+ /* Initialize USB host */
+
+ ret = nsh_usbhostinitialize();
+ }
+
+ if (ret == OK)
+ {
+ /* Initialize USB device */
+
+ ret = nsh_usbdevinitialize();
+ }
+ return ret;
+}
diff --git a/nuttx/configs/pic32-starterkit/src/up_spi.c b/nuttx/configs/pic32-starterkit/src/up_spi.c
new file mode 100644
index 000000000..52d46af89
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_spi.c
@@ -0,0 +1,223 @@
+/************************************************************************************
+ * configs/pic32-starterkit/src/up_ssp.c
+ * arch/arm/src/board/up_ssp.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "pic32mx-internal.h"
+#include "starterkit_internal.h"
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \
+ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* The following enable debug output from this file (needs CONFIG_DEBUG too).
+ *
+ * CONFIG_SPI_DEBUG - Define to enable basic SPI debug
+ * CONFIG_SPI_VERBOSE - Define to enable verbose SPI debug
+ */
+
+#ifdef CONFIG_SPI_DEBUG
+# define sspdbg lldbg
+# ifdef CONFIG_SPI_VERBOSE
+# define sspvdbg lldbg
+# else
+# define sspvdbg(x...)
+# endif
+#else
+# undef CONFIG_SPI_VERBOSE
+# define sspdbg(x...)
+# define sspvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_sspinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Sure PIC32MX board.
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_sspinitialize(void)
+{
+ /* Configure the SPI chip select GPIOs */
+
+#warning "Missing logic"
+}
+
+/************************************************************************************
+ * Name: pic32mx_spiNselect, pic32mx_spiNstatus, and pic32mx_spiNcmddata
+ *
+ * Description:
+ * These external functions must be provided by board-specific logic. They are
+ * implementations of the select, status, and cmddata methods of the SPI interface
+ * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods
+ * including up_spiinitialize()) are provided by common PIC32MX logic. To use
+ * this common SPI logic on your board:
+ *
+ * 1. Provide logic in pic32mx_boardinitialize() to configure SPI/SSP chip select
+ * pins.
+ * 2. Provide pic32mx_spiNselect() and pic32mx_spiNstatus() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
+ * pic32mx_spiNcmddata() functions in your board-specific logic. These
+ * functions will perform cmd/data selection operations using GPIOs in the way
+ * your board is configured.
+ * 3. Add a call to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+struct spi_dev_s;
+enum spi_dev_e;
+
+#ifdef CONFIG_PIC32MX_SPI1
+void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#ifdef CONFIG_PIC31MX_SPI1
+void pic31mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic31mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+#ifdef CONFIG_SPI_CMDDATA
+int pic31mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#ifdef CONFIG_PIC31MX_SPI3
+void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#ifdef CONFIG_PIC32MX_SPI4
+void pic32mx_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ sspdbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#endif /* CONFIG_PIC32MX_SPI1..4 */
diff --git a/nuttx/configs/pic32-starterkit/src/up_usbdev.c b/nuttx/configs/pic32-starterkit/src/up_usbdev.c
new file mode 100644
index 000000000..6f04f43cb
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_usbdev.c
@@ -0,0 +1,163 @@
+/************************************************************************************
+ * configs/pic32-starterkit/src/up_usbdev.c
+ * arch/arm/src/board/up_usbdev.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "starterkit_internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/*
+ * PIN NAME SIGNAL NOTES
+ * ---- ------------------------------- -------------- ------------------------------
+ * 20 VBUSON/C1IN+/AN5/CN7/RB5 VBUSON To USB VBUS circuitry
+ * 43 C2IN+/AN3/CN5/RB3 USB_PGOOD Power good (low if bad)
+ */
+
+#define GPIO_USB_VBUSON (GPIO_INPUT|GPIO_PORTB|GPIO_PIN5)
+#define GPIO_USB_PGOOD (GPIO_INPUT|GPIO_PORTB|GPIO_PIN3)
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_usbdevinitialize
+ *
+ * Description:
+ * Called to configure the mini-A/B J5 on the PIC32 Ethernet Starter Kit for the
+ * USB device
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_usbdevinitialize(void)
+{
+ /* Connect the PHY to the USB mini-B port. Order and timing matter! */
+
+ pic32mx_configgpio(GPIO_USB_PGOOD);
+
+ /* Notes from the Sure Electronics sample code:
+ *
+ * "The USB specifications require that USB peripheral devices must never source
+ * current onto the Vbus pin. Additionally, USB peripherals should not source
+ * current on D+ or D- when the host/hub is not actively powering the Vbus line.
+ * When designing a self powered (as opposed to bus powered) USB peripheral
+ * device, the firmware should make sure not to turn on the USB module and D+
+ * or D- pull up resistor unless Vbus is actively powered. Therefore, the
+ * firmware needs some means to detect when Vbus is being powered by the host.
+ * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and
+ * can be used to detect when Vbus is high (host actively powering), or low
+ * (host is shut down or otherwise not supplying power). The USB firmware
+ * can then periodically poll this I/O pin to know when it is okay to turn on
+ * the USB module/D+/D- pull up resistor. When designing a purely bus powered
+ * peripheral device, it is not possible to source current on D+ or D- when the
+ * host is not actively providing power on Vbus. Therefore, implementing this
+ * bus sense feature is optional. ..."
+ */
+
+#ifdef CONFIG_USBHOST
+ // pic32mx_configgpio(GPIO_USB_VBUSON);
+#endif
+
+ /* "If the host PC sends a GetStatus (device) request, the firmware must respond
+ * and let the host know if the USB peripheral device is currently bus powered
+ * or self powered. See chapter 9 in the official USB specifications for details
+ * regarding this request. If the peripheral device is capable of being both
+ * self and bus powered, it should not return a hard coded value for this request.
+ * Instead, firmware should check if it is currently self or bus powered, and
+ * respond accordingly. If the hardware has been configured like demonstrated
+ * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the
+ * currently selected power source. ..."
+ */
+
+#ifdef CONFIG_USB_PWRSENSE
+ // pic32mx_configgpio(GPIO_USB_PWRSENSE);
+#endif
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB
+ * software connect and disconnect), then the board software must provide
+ * stm32_pullup. See include/nuttx/usb/usbdev.h for additional description
+ * of this method. Alternatively, if no pull-up GPIO the following EXTERN
+ * can be redefined to be NULL.
+ *
+ ************************************************************************************/
+
+int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ /* The PIC32 Ethernet Starter Kit does not have a USB pull-up */
+
+ return OK;
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver
+ * is used. This function is called whenever the USB enters or leaves
+ * suspend mode. This is an opportunity for the board logic to shutdown
+ * clocks, power, etc. while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ /* Do nothing */
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV */
diff --git a/nuttx/configs/pic32-starterkit/src/up_usbmsc.c b/nuttx/configs/pic32-starterkit/src/up_usbmsc.c
new file mode 100644
index 000000000..c645c0fe5
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_usbmsc.c
@@ -0,0 +1,95 @@
+/****************************************************************************
+ * configs/pic32-starterkit/src/up_usbmsc.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "starterkit_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization as needed to establish
+ * the mass storage device that will be exported by the USB MSC device.
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+# warning "Missing Logic"
+#endif /* CONFIG_EXAMPLES_USBMSC_BUILTIN */
+
+ return 0;
+}
diff --git a/nuttx/configs/pic32-starterkit/src/up_usbterm.c b/nuttx/configs/pic32-starterkit/src/up_usbterm.c
new file mode 100644
index 000000000..012e8a5c0
--- /dev/null
+++ b/nuttx/configs/pic32-starterkit/src/up_usbterm.c
@@ -0,0 +1,105 @@
+/************************************************************************************
+ * configs/pic32-starterkit/src/up_usbterm.c
+ * arch/arm/src/board/up_usbterm.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "starterkit_internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV) && defined(CONFIG_EXAMPLES_USBTERM_DEVINIT)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its initialization.
+ *
+ ****************************************************************************/
+
+int usbterm_devinit(void)
+{
+ /* The PIO32 Starter Kit has no way to know when the USB is connected. So
+ * we will fake it and tell the USB driver that the USB is connected now.
+ *
+ * If examples/usbterm is built as an NSH built-in application, then
+ * pic32mx_usbattach() will be called in nsh_archinitialize().
+ */
+
+#ifndef CONFIG_EXAMPLES_USBTERM_BUILTIN
+ pic32mx_usbattach();
+#endif
+ return OK;
+}
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its termination sequence.
+ *
+ ****************************************************************************/
+
+void usbterm_devuninit(void)
+{
+ /* Tell the USB driver that the USB is no longer connected */
+
+ pic32mx_usbdetach();
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV && CONFIG_EXAMPLES_USBTERM_DEVINIT */
diff --git a/nuttx/configs/pic32mx7mmb/Kconfig b/nuttx/configs/pic32mx7mmb/Kconfig
new file mode 100644
index 000000000..41c5a7896
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_PIC32_PIC32MX7MMB
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/pic32mx7mmb/README.txt b/nuttx/configs/pic32mx7mmb/README.txt
new file mode 100644
index 000000000..adf83e2f4
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/README.txt
@@ -0,0 +1,843 @@
+configs/pic32mx7mmb README
+===============================
+
+This README file discusses the port of NuttX to the Mikroelektronika PIC32MX7
+Multimedia Board (MMB). See http://www.mikroe.com/ for further information.
+
+Contents
+========
+
+ PIC32MX795F512L Pin Out
+ Toolchains
+ Creating Compatible NuttX HEX files
+ Serial Console
+ LEDs
+ PIC32MX Configuration Options
+ Configurations
+
+PIC32MX795F512L Pin Out
+=======================
+
+LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (PIC32MX7 Schematic)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+ 1 RG15/AERXERR AERXERR LAN8720A RXERR
+ 2 VDD VCC3 ---
+ 3 PMD5/RE5 PMPD5 TFT display, HDR1 pin 13
+ 4 PMD6/RE6 PMPD6 TFT display, HDR1 pin 12
+ 5 PMD7/RE7 PMPD7 TFT display, HDR1 pin 11
+ 6 RC1/T2CK LCD_RST TFT display
+ 7 RC2/AC2TX/T3CK EE_CS# M25P80 CS
+ 8 RC3/AC2RX/T4CK ACL_CS# ADXL345 CS and VCC
+ 9 RC4/SDI1/T5CK SDI1 SPI1 data IN
+ 10 PMA5/CN8/ECOL/RG6/SCK2/U3RTS/U6TX SD_WP SD card, write protect
+ 11 PMA4/CN9/ECRS/RG7/SDA4/SDI2/U3RX SD_CD# SD card, card detect (not)
+ 12 PMA3/AECRSDV/AERXDV/CN10/ECRSDV/ AECRSDV LAN8720A SRS_DIV
+ ERXDV/RG8/SCL4/SDO2/U3TX
+ 13 MCLR MCLR Debug connector
+ 14 PMA2/AEREFCLK/AERXCLK/CN11/ AEREFCLK LAN8720A INT
+ EREFCLK/ERXCLK/RG9/SS2/U3CTS/
+ U6RX
+ 15 VSS (grounded) ---
+ 16 VDD VCC3 ---
+ 17 RA0/TMS LED-0 LED0 (pulled up), HDR2 pin 26
+ 18 AERXD0/INT1/RE8 AERXD0 LAN8720A RXD0
+ 19 AERXD1/INT2/RE9 AERXD1 LAN8720A RXD1
+ 20 AN5/C1IN+/CN7/RB5/VBUSON RB5 HDR1 pin 28
+ 21 AN4/C1IN-/CN6/RB4 CDC_CS# ?
+ 22 AN3/C2IN+/CN5/RB3 JOY-D Joystick D, HDR1 pin 21
+ 23 AN2/C2IN-/CN4/RB2 JOY-C Joystick C, HDR1 pin 22
+ 24 AN1/CN3/PGEC1/RB1 JOY-B Joystick B, HDR1 pin 23
+ 25 AN0/CN2/PGED1/RB0 JOY-A Joystick A, HDR1 pin 24
+
+BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (PIC32MX7 Schematic)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+ 26 AN6/OCFA/PGEC2/RB6 PGC2 Debugger interface
+ 27 AN7/PGED2/RB7 PGD2 Debugger interface
+ 28 PMA7/AERXD2/CVREF-/RA9 SD_CD# SD Connector
+ 29 PMA6/AERXD3/CVREF+/RA10/VREF+ JOY-CP Joystick CP, HDR1 pin 25
+ 30 AVDD VCC3 ---
+ 31 AVSS (grounded) ---
+ 32 AN8/C1OUT/RB8 TEMP MCP9700A VOUT
+ 33 AN9/C2OUT/RB9 USB-PSW USB soft-connect pull-up, HDR2 pin 3
+ 34 PMA13/AN10/RB10/CVREFOUT LCD-YD TFT display
+ 35 PMA12/AETXERR/AN11/ERXERR/RB11 LCD-XR TFT display
+ 36 VSS (grounded) ---
+ 37 VDD P32_VDD ---
+ 38 RA1/TCK LED-1 LED1 (pulled up), HDR2 pin 27
+ 39 AC1TX/RF13/SCK4/U2RTS/U5TX SCK3A WM873ASEDS BCLK, HDR2 pin 21
+ 40 AC1RX/RF12/SS4/U2CTS/U5RX LRC WM873ASEDS DACLRC
+ 41 PMA11/AECRS/AN12/ERXD0/RB12 LCD-YU TFT display
+ 42 PMA10/AECOL/AN13/ERXD1/RB13 LCD-XL TFT display
+ 43 PMA1/AETXD3/AN14/ERXD2/PMALH/RB14 LCD-CS# TFT display, HDR2 pin 3
+ 44 PMA0/AETXD2/AN15/CN12/ERXD3/OCFB/ LCD-RS TFT display
+ PMALL/RB15
+ 45 VSS (grounded) ---
+ 46 VDD P32_VDD ---
+ 47 AETXD0/CN20/RD14/SS3/U1CTS/U4RX AETXD0 LAN8720A TXD0
+ 48 AETXD1/CN21/RD15/SCK3/U1RTS/U4TX AETXD1 LAN8720A TXD1
+ 49 PMA9/CN17/RF4/SDA5/SDI4/U2RX SDI3A WM873ASEDS ADCDAT, HDR2 pin 19
+ 50 PMA8/CN18/RF5/SCL5/SDO4/U2TX SDO3A WM873ASEDS DACDAT, HDR2 pin 20
+
+RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (PIC32MX7 Schematic)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+ 75 VSS (grounded)
+ 74 CN0/RC14/SOSCO/T1CK SOSC0 32.768kHz Oscillator
+ 73 CN1/RC13/SOSCI SOSC1 32.768kHz Oscillator
+ 72 OC1/INT0/RD0/SDO1 SDO1M SPI1 data out
+ 71 PMA14/AEMDC/EMDC/IC4/PMCS1/RD11 AEMDC LAN8720A MDC
+ 70 PMA15/IC3/PMCS2/RD10/SCK1 SCK1M SPI1 clock
+ 69 IC2/RD9/SS1 LED-2 LED2 (pulled up), HDR2 pin 28
+ 68 AEMDIO/EMDIO/IC1/RD8/RTCC AEMDIO LAN8720A MDIO
+ 67 AETXEN/INT4/RA15/SDA1 AETXN LAN8720A TXEN
+ 66 AETXCLK/INT3/RA14/SCL1 RA14 HDR2 pin 14
+ 65 VSS (grounded) ---
+ 64 CLKO/OSC2/RC15 8MHz crystal
+ 63 CLKI/OSC1/RC12 8MHz crystal
+ 62 VDD VCC3 ---
+ 61 RA5/TDO RA5 HDR2 pin 13
+ 60 RA4/TDI RA4 HDR2 pin 12
+ 59 RA3/SDA2 SDA2 I2C2 SDA, 24AA01 SDA
+ 58 RA2/SCL2 SCL2 I2C2 SCL, 24AA01 SCL
+ 57 D+/RG2 USBDP USB device
+ 56 D-/RG3 USBDM USB device
+ 55 VUSB VCC3 ---
+ 54 VBUS USB_DET USB device
+ 53 RF8/SCL3/SDO3/U1TX U1TX RS-232
+ 52 RF2/SDA3/SDI3/U1RX U2RX RS-232
+ 51 RF3/USBID USB-ID USB device
+
+TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ (Family Data Sheet Table 1-1) (PIC32MX7 Schematic)
+--- ---------------------------------- -------------------------- -----------------------------------------------
+100 PMD4/RE4 PMPD4 TFT display, HDR1 pin 14
+ 99 PMD3/RE3 PMPD3 TFT display, HDR1 pin 15
+ 98 PMD2/RE2 PMPD2 TFT display, HDR1 pin 16
+ 97 RG13/TRD0 TRD0 HDR2 pin 7
+ 96 RG12/TRD1 TRD1 HDR2 pin 8
+ 95 RG14/TRD2 TRD2 HDR2 pin 9
+ 94 PMD1/RE1 PMPD1 TFT display, HDR1 pin 17
+ 93 PMD0/RE0 PMPD0 TFT display, HDR1 pin 18
+ 92 RA7/TRD3 TRD3 HDR2 pin 10
+ 91 RA6/TRCLK TRCLK HDR2 pin 6
+ 90 PMD8/C2RX/RG0 PMPD8 TFT display, HDR1 pin 10
+ 89 PMD9/C2TX/ETXERR/RG1 PMPD9 TFT display, HDR1 pin 9
+ 88 PMD10/C1TX/ETXD0/RF1 PMPD10 TFT display, HDR1 pin 8
+ 87 PMD11/C1RX/ETXD1/RF0 PMPD11 TFT display, HDR1 pin 7
+ 86 VDD P32_VDD ---
+ 85 VCAP/VCORE (capacitor to ground) ---
+ 84 PMD15/CN16/ETXCLK/RD7 PMPD15 TFT display, HDR1 pin 3
+ 83 PMD14/CN15/ETXEN/RD6 PMPD14 TFT display, HDR1 pin 4
+ 82 CN14/PMRD/RD5 PMPRD
+ 81 CN13/OC5/PMWR/RD4 PMPWR
+ 80 PMD13/CN19/ETXD3/RD13 PMPD13 TFT display, HDR1 pin 5
+ 79 PMD12/ETXD2/IC5/RD12 PMPD12 TFT display, HDR1 pin 6
+ 78 OC4/RD3 RD3 HDR2 pin 5
+ 77 OC3/RD2 LCD_BLED LCD backlight LED
+ 76 OC2/RD1 RD1 HDR2 pin 11
+
+Toolchains
+==========
+
+ MPLAB/C32
+ ---------
+
+ I am using the free, "Lite" version of the PIC32MX toolchain available
+ for download from the microchip.com web site. I am using the Windows
+ version. The MicroChip toolchain is the only toolchain currently
+ supported in these configurations, but it should be a simple matter to
+ adapt to other toolchains by modifying the Make.defs file include in
+ each configuration.
+
+ C32 Toolchain Options:
+
+ CONFIG_PIC32MX_MICROCHIPW - MicroChip full toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL - MicroChip full toolchain for Linux
+ CONFIG_PIC32MX_MICROCHIPW_LITE - MicroChip "Lite" toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL_LITE - MicroChip "Lite" toolchain for Linux
+
+ NOTE: The "Lite" versions of the toolchain does not support C++. Also
+ certain optimization levels are not supported by the "Lite" toolchain.
+
+ MicrochipOpen
+ -------------
+
+ An alternative, build-it-yourself toolchain is available here:
+ http://sourceforge.net/projects/microchipopen/ . These tools were
+ last updated circa 2010. NOTE: C++ support still not available
+ in this toolchain.
+
+ Building MicrochipOpen (on Linux)
+
+ 1) Get the build script from this location:
+
+ http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
+
+ 2) Build the code using the build script, for example:
+
+ ./build.sh -b v105_freeze
+
+ This will check out the selected branch and build the tools.
+
+ 3) Binaries will then be available in a subdirectory with a name something like
+ pic32-v105-freeze-20120622/install-image/bin (depending on the current data
+ and the branch that you selected.
+
+ Note that the tools will have the prefix, mypic32- so, for example, the
+ compiler will be called mypic32-gcc.
+
+ Pinguino mips-elf Toolchain
+ ---------------------------
+
+ Another option is the mips-elf toolchain used with the Pinguino project. This
+ is a relatively current mips-elf GCC and should provide free C++ support as
+ well. This toolchain can be downloded from the Pinguino website:
+ http://wiki.pinguino.cc/index.php/Main_Page#Download . There is some general
+ information about using the Pinguino mips-elf toolchain in this thread:
+ http://tech.groups.yahoo.com/group/nuttx/message/1821
+
+ See also configs/mirtoo/README.txt. There is an experimental (untested)
+ configuration for the Mirtoo platform in that directory.
+
+ MPLAB/C32 vs MPLABX/X32
+ -----------------------
+
+ It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
+ it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
+ with the NuttX build scripts. Here are some of the issues that I see when trying
+ to build with XC32:
+
+ 1) Make.def changes: You have to change the tool prefix:
+
+ CROSSDEV=xc32-
+
+ 2) debug.ld/release.ld: The like expect some things that are not present in
+ the current linker scripts (or are expected with different names). Here
+ are some partial fixes:
+
+ Rename: kseg0_progmem to kseg0_program_mem
+ Rename: kseg1_datamem to kseg1_data_mem
+
+ Even then, there are more warnings from the linker and some undefined symbols
+ for non-NuttX code that resides in the unused Microchip libraries. See this
+ email thread at http://tech.groups.yahoo.com/group/nuttx/message/1458 for more
+ information. You will have to solve at least this undefined symbol problem if
+ you want to used the XC32 toolchain.
+
+ Windows Native Toolchains
+ -------------------------
+
+ NOTE: There are several limitations to using a Windows based toolchain in a
+ Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+Powering the Board
+==================
+
+ [To be provided]
+
+Creating Compatible NuttX HEX files
+===================================
+
+ Intel Hex Format Files:
+ -----------------------
+
+ When NuttX is built it will produce two files in the top-level NuttX
+ directory:
+
+ 1) nuttx - This is an ELF file, and
+ 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
+ the setting CONFIG_INTELHEX_BINARY in the .config file.
+
+ The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
+ there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
+ file to contain physical addresses. But the nuttx.hex file generated from the
+ top-level make will have address in the KSEG0 and KSEG1 regions.
+
+ tools/pic32mx/mkpichex:
+ ----------------------
+
+ There is a simple tool in the NuttX tools/pic32mx directory that can be
+ used to solve both issues with the nuttx.hex file. But, first, you must
+ build the tool:
+
+ cd tools/pic32mx
+ make
+
+ Now you will have an excecutable file call mkpichex (or mkpichex.exe on
+ Cygwin). This program will take the nutt.hex file as an input, it will
+ convert all of the KSEG0 and KSEG1 addresses to physical address, and
+ it will write the modified file, replacing the original nuttx.hex.
+
+ To use this file, you need to do the following things:
+
+ . ./setenv.sh # Source setenv.sh. Among other this, this script
+ # will add the NuttX tools/pic32mx directory to your
+ # PATH variable
+ make # Build nuttx and nuttx.hex
+ mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
+ # to the top-level build directory. It is the only
+ # required input to mkpichex.
+
+Serial Console
+==============
+
+ UART1 is connected to the on-board RS-232 connector
+
+LEDs
+====
+
+ The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the
+ schematics:
+
+ --- ----- ---------------------------------------------------------
+ PIN Board Notes
+ --- ----- ---------------------------------------------------------
+ RA0 LED0 Pulled-up, low value illuminates
+ RA1 LED1 Pulled-up, low value illuminates
+ RD9 LED2 Pulled-up, low value illuminates
+ RA9 LED4 Not available for general use*, indicates MMC/SD activity
+ --- LED5 Not controllable by software, indicates power-on
+
+ * RA9 is also the SD chip select. It will illuminate whenever the SD card
+ is selected. If SD is not used, then LED4 could also be used as a user-
+ controlled LED.
+
+ If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows:
+
+ ON OFF
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED0 LED1 LED2 LED0 LED1 LED2
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED_STARTED 0 OFF OFF OFF --- --- ---
+ LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ LED_STACKCREATED 3 ON ON N/C --- --- ---
+ LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ LED_PANIC 5 ON N/C N/C OFF N/C N/C
+
+PIC32MX Configuration Options
+=============================
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=mips
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_MIPS=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_MIPS32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=pic32mx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=pic32mx7mmb
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_PIC32MX7MMB=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0xa0000000
+
+ CONFIG_ARCH_IRQPRIO - The PIC32MXx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ PIC32MX Configuration
+
+ CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
+
+ Individual subsystems can be enabled:
+
+ CONFIG_PIC32MX_WDT - Watchdog timer
+ CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
+ CONFIG_PIC32MX_T3 - Timer 3
+ CONFIG_PIC32MX_T4 - Timer 4
+ CONFIG_PIC32MX_T5 - Timer 5
+ CONFIG_PIC32MX_IC1 - Input Capture 1
+ CONFIG_PIC32MX_IC2 - Input Capture 2
+ CONFIG_PIC32MX_IC3 - Input Capture 3
+ CONFIG_PIC32MX_IC4 - Input Capture 4
+ CONFIG_PIC32MX_IC5 - Input Capture 5
+ CONFIG_PIC32MX_OC1 - Output Compare 1
+ CONFIG_PIC32MX_OC2 - Output Compare 2
+ CONFIG_PIC32MX_OC3 - Output Compare 3
+ CONFIG_PIC32MX_OC4 - Output Compare 4
+ CONFIG_PIC32MX_OC5 - Output Compare 5
+ CONFIG_PIC32MX_I2C1 - I2C 1
+ CONFIG_PIC32MX_I2C2 - I2C 2
+ CONFIG_PIC32MX_I2C3 - I2C 3
+ CONFIG_PIC32MX_I2C4 - I2C 4
+ CONFIG_PIC32MX_I2C5 - I2C 5
+ CONFIG_PIC32MX_SPI1 - SPI 1
+ CONFIG_PIC32MX_SPI2 - SPI 2
+ CONFIG_PIC32MX_SPI3 - SPI 3
+ CONFIG_PIC32MX_SPI4 - SPI 4
+ CONFIG_PIC32MX_UART1 - UART 1
+ CONFIG_PIC32MX_UART2 - UART 2
+ CONFIG_PIC32MX_UART3 - UART 3
+ CONFIG_PIC32MX_UART4 - UART 4
+ CONFIG_PIC32MX_UART5 - UART 5
+ CONFIG_PIC32MX_UART6 - UART 6
+ CONFIG_PIC32MX_ADC - ADC 1
+ CONFIG_PIC32MX_PMP - Parallel Master Port
+ CONFIG_PIC32MX_CM1 - Comparator 1
+ CONFIG_PIC32MX_CM2 - Comparator 2
+ CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA - DMA
+ CONFIG_PIC32MX_FLASH - FLASH
+ CONFIG_PIC32MX_USBDEV - USB device
+ CONFIG_PIC32MX_USBHOST - USB host
+ CONFIG_PIC32MX_CAN1 - Controller area network 1
+ CONFIG_PIC32MX_CAN2 - Controller area network 2
+ CONFIG_PIC32MX_ETHERNET - Ethernet
+
+ PIC32MX Configuration Settings
+ DEVCFG0:
+ CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
+ value 2 enables.
+ CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
+ Default 1 (PG2)
+ CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
+ CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
+ CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
+ DEVCFG1: (All settings determined by selections in board.h)
+ DEVCFG2: (All settings determined by selections in board.h)
+ DEVCFG3:
+ CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
+ (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
+ (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
+ can be enabled later by software).
+
+ The priority of interrupts may be specified. The value ranage of
+ priority is 4-31. The default (16) will be used if these any of these
+ are undefined.
+
+ CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
+ CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
+ CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
+ CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
+ CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
+ CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
+ CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
+ CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
+ CONFIG_PIC32MX_T2PRIO - Timer 2 priority
+ CONFIG_PIC32MX_T3PRIO - Timer 3 priority
+ CONFIG_PIC32MX_T4PRIO - Timer 4 priority
+ CONFIG_PIC32MX_T5PRIO - Timer 5 priority
+ CONFIG_PIC32MX_IC1PRIO - Input Capture 1
+ CONFIG_PIC32MX_IC2PRIO - Input Capture 2
+ CONFIG_PIC32MX_IC3PRIO - Input Capture 3
+ CONFIG_PIC32MX_IC4PRIO - Input Capture 4
+ CONFIG_PIC32MX_IC5PRIO - Input Capture 5
+ CONFIG_PIC32MX_OC1PRIO - Output Compare 1
+ CONFIG_PIC32MX_OC2PRIO - Output Compare 2
+ CONFIG_PIC32MX_OC3PRIO - Output Compare 3
+ CONFIG_PIC32MX_OC4PRIO - Output Compare 4
+ CONFIG_PIC32MX_OC5PRIO - Output Compare 5
+ CONFIG_PIC32MX_I2C1PRIO - I2C 1
+ CONFIG_PIC32MX_I2C2PRIO - I2C 2
+ CONFIG_PIC32MX_I2C3PRIO - I2C 3
+ CONFIG_PIC32MX_I2C4PRIO - I2C 4
+ CONFIG_PIC32MX_I2C5PRIO - I2C 5
+ CONFIG_PIC32MX_SPI2PRIO - SPI 2
+ CONFIG_PIC32MX_UART1PRIO - UART 1
+ CONFIG_PIC32MX_UART2PRIO - UART 2
+ CONFIG_PIC32MX_CN - Input Change Interrupt
+ CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
+ CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
+ CONFIG_PIC32MX_CM1PRIO - Comparator 1
+ CONFIG_PIC32MX_CM2PRIO - Comparator 2
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
+ CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
+ CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
+ CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
+ CONFIG_PIC32MX_DMA4PRIO - DMA Channel 4
+ CONFIG_PIC32MX_DMA5PRIO - DMA Channel 5
+ CONFIG_PIC32MX_DMA6PRIO - DMA Channel 6
+ CONFIG_PIC32MX_DMA7PRIO - DMA Channel 7
+ CONFIG_PIC32MX_FCEPRIO - Flash Control Event
+ CONFIG_PIC32MX_USBPRIO - USB
+
+ PIC32MXx specific device driver settings. NOTE: For the Ethernet
+ starter kit, there is no RS-232 connector (even with the MEB). See
+ discussion above ("") for information about how you can configure
+ an external MAX2232 board to get a serial console.
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+PIC32MX specific PHY/Ethernet device driver settings
+
+ CONFIG_PHY_KS8721 - Selects the Micrel KS8721 PHY
+ CONFIG_PHY_DP83848C - Selects the National Semiconduction DP83848C PHY
+ CONFIG_PHY_LAN8720 - Selects the SMSC LAN8720 PHY
+ CONFIG_PHY_AUTONEG - Enable auto-negotion
+ CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
+ CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
+ CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 2
+ CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 4
+ CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
+ the higest priority.
+ CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
+ CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
+ Also needs CONFIG_DEBUG.
+ CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
+ CONFIG_DEBUG.
+ CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
+ CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
+ Automatically set if CONFIG_NET_IGMP is selected.
+
+ Related DEVCFG3 Configuration Settings:
+ CONFIG_PIC32MX_FETHIO: Ethernet I/O Pin Selection bit:
+ 1 = Default Ethernet I/O Pins
+ 0 = Alternate Ethernet I/O Pins
+ CONFIG_PIC32MX_FMIIEN: Ethernet MII Enable bit
+ 1 = MII enabled
+ 0 = RMII enabled
+
+ PIC32MXx USB Device Configuration
+
+ PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
+
+Configurations
+==============
+
+Each PIC32MX configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh pic32mx7mmb/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ =======
+ Description.
+ ------------
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ Serial Output.
+ --------------
+ The OS test produces all of its test output on the serial console.
+ This configuration has UART1 enabled as a serial console.
+
+ nsh:
+ ====
+ Description.
+ ------------
+ This is the NuttShell (NSH) using the NSH startup logic at
+ apps/examples/nsh.
+
+ Serial Output.
+ --------------
+ The OS test produces all of its test output on the serial console.
+ This configuration has UART1 enabled as a serial console.
+
+ SD Card Support
+ ---------------
+ SD card support is built into this example by default:
+
+ CONFIG_PIC32MX_SPI1=y
+ CONFIG_NSH_ARCHINIT=y
+
+ The SD card can be mounted from the NSH command line as follows:
+
+ nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard
+ nsh> ls -l /mnt/sdcard
+ /mnt/sdcard:
+ -rw-rw-rw- 16 ATEST.TXT
+ -rw-rw-rw- 21170 TODO
+ -rw-rw-rw- 22 ANOTHER.TXT
+ -rw-rw-rw- 22 HI2148.TXT
+ -rw-rw-rw- 16 HiFromNotePad.txt
+
+ USB Configurations.
+ ------------------
+ USB device support is enabled by default in this configuration.
+ The following settings are defined by default (and can be set
+ to 'n' to disabled USB device support).
+
+ CONFIG_USBDEV=y : Enable basic USB device support
+ CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
+ CONFIG_USBMSC=y : USB supports a mass storage device.
+
+ In this configuration, NSH will support the following commands:
+
+ msconn : Connect the mass storage device, exportint the SD
+ card as the USB mass storage logical unit.
+ msdis : Disconnect the USB mass storage device
+
+ NOTE: The SD card should *not* be mounted under NSH *and* exported
+ by the mass storage device!!! That can result in corruption of the
+ SD card format. This is the sequence of commands that you should
+ used to work the the SD card safely:
+
+ mount -t vfat /dev/mmcsd0 /mnt/sdcard : Mount the SD card initially
+ ...
+ umount /mnt/sdcard : Unmount the SD card before connecting
+ msconn : Connect the USB MSC
+ ...
+ msdis : Disconnect the USB MSC
+ mount -t vfat /dev/mmcsd0 /mnt/sdcard : Re-mount the SD card
+ ...
+
+ Other USB other device configurations can be enabled and
+ included as NSH built-in built in functions.
+
+ examples/usbterm - This option can be enabled by uncommenting
+ the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/usbterm
+
+ And by enabling one of the USB serial devices:
+
+ CONFIG_USBMSC=n : Disable USB mass storage device.
+ CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
+ CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
+
+ examples/cdcacm - The examples/cdcacm program can be included as an
+ function by uncommenting the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/cdcacm
+
+ and defining the following in your .config file:
+
+ CONFIG_USBMSC=n : Disable USB mass storage device.
+ CONFIG_CDCACM=y : Enable the CDCACM device
+
+ Networking Configurations.
+ --------------------------
+ Networking is enabled by default in this configuration:
+
+ CONFIG_NET=y : Enable networking support
+ CONFIG_PIC32MX_ETHERNET=y : Enable the PIC32 Ethernet driver
+ CONFIG_NSH_TELNET=y : Enable the Telnet NSH console (optional)
+
+ The default configuration has:
+
+ CONFIG_NSH_DHCPC=n : DHCP is disabled
+ CONFIG_NSH_IPADDR=(10<<24|0<<16|0<<8|2) : Target IP address 10.0.0.2
+ CONFIG_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) : Host IP address 10.0.0.1
+
+ This will probably need to be customized for your network.
+
+ NOTES:
+ 1. This logic will assume that a network is connected. During its
+ initialization, it will try to negotiate the link speed. If you have
+ no network connected when you reset the board, there will be a long
+ delay (maybe 30 seconds?) before anything happens. That is the timeout
+ before the networking finally gives up and decides that no network is
+ available.
+
+ 2. This example can support an FTP client. In order to build in FTP client
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpc
+ #CONFIGURED_APPS += examples/ftpc
+
+ 3. This example can support an FTP server. In order to build in FTP server
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpd
+ #CONFIGURED_APPS += examples/ftpd
+
+ And enable poll() support in the NuttX configuration file:
+
+ CONFIG_DISABLE_POLL=n
+
+ Using a RAM disk and the USB MSC device to the nsh configuration
+ ----------------------------------------------------------------
+ Here is an experimental change to examples/nsh that will create a RAM
+ disk and attempt to export that RAM disk as a USB mass storage device.
+
+ 1. Changes to nuttx/.config
+
+ a) Enable support for the PIC32 USB device
+
+ -CONFIG_PIC32MX_USBDEV=n
+ +CONFIG_PIC32MX_USBDEV=y
+
+ b) Enable NuttX USB device support
+
+ -CONFIG_USBDEV=n
+ +CONFIG_USBDEV=y
+
+ c) Enable the USB MSC class driver
+
+ -CONFIG_USBMSC=n
+ +CONFIG_USBMSC=y
+
+ d) Use a RAM disk (instead of an SD card) as the USB MSC logical unit:
+
+ -CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+ +CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/ram0"
+
+ 2. Changes to nuttx/.config.
+
+ a) Enable building of the examples/usbstorage:
+
+ -# CONFIGURED_APPS += examples/usbstorage
+ + CONFIGURED_APPS += examples/usbstorage
+
+ 3. When NSH first comes up, you must manually create the RAM disk
+ before exporting it:
+
+ a) Create a 64Kb RAM disk at /dev/ram0:
+
+ nsh> mkrd -s 512 128
+
+ b) Put a FAT file system on the RAM disk:
+
+ nsh> mkfatfs /dev/ram0
+
+ b) Now the 'msconn' command will connect to the host and
+ export /dev/ram0 as the USB logical unit:
+
+ nsh> msconn
+
+ NOTE: This modification should be considered experimental. IN the
+ little testing I have done with it, it appears functional. But the
+ logic has not been stressed and there could still be lurking issues.
+ (There is a bug associated with this configuration listed in the
+ top-level TODO list).
+
+ Adding LCD and graphics support to the nsh configuration:
+ --------------------------------------------------------
+
+ LCD support is already enabled in defconfig (nuttx/.config):
+
+ CONFIG_NX=y : Enable graphics suppport
+ CONFIG_PIC32MX_PMP=y : Enable parallel port support
+ CONFIG_LCD_MIO283QT2=y : MIO283QT2 LCD support
+
+ But you will have to enable a specific graphics example application
+ in order to see anything.
+
+ appconfig (apps/.config): Enable the application configurations that you
+ want to use. Asexamples:
+
+ CONFIGURED_APPS += examples/nx : Pick one or more
+ CONFIGURED_APPS += examples/nxhello :
+ CONFIGURED_APPS += examples/nximage :
+ CONFIGURED_APPS += examples/nxlines :
+
+ Enabling touch screen support in the nsh configuaration
+ -------------------------------------------------------
+
+ In defconfig (or nuttx/.config), set:
+
+ CONFIG_INPUT=y : Enable input device support
+ CONFIG_SCHED_WORKQUEUE=y : Work queue support needed
+
+ In appconfig (or apps/.config), uncomment:
+
+ CONFIGURED_APPS += examples/touchscreen
diff --git a/nuttx/configs/pic32mx7mmb/include/board.h b/nuttx/configs/pic32mx7mmb/include/board.h
new file mode 100644
index 000000000..41f105b50
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/include/board.h
@@ -0,0 +1,233 @@
+/****************************************************************************
+ * configs/pic32mx7mmb/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_MIKROELEKTRONIKA_PIC32MX7MMB_INCLUDE_BOARD_H
+#define __CONFIGS_MIKROELEKTRONIKA_PIC32MX7MMB_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdbool.h>
+#endif
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Crystal frequencies */
+
+#define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */
+#define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz) */
+
+/* Oscillator modes */
+
+#define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
+#define BOARD_POSC_XTMODE 1 /* Resonator, crystal or resonator (XT) mode */
+#undef BOARD_POSC_SWITCH /* Use FRC until POSC stabilizes, then switch */
+#undef BOARD_POSC_FSCM /* Switch to FRC if POSC fails */
+#define BOARD_SOSC_ENABLE 1 /* Enable Secondary Oscillator */
+#define BOARD_SOSC_IESO 1 /* Internal External Switchover mode is enabled */
+
+/* PLL configuration and resulting CPU clock.
+ * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
+ */
+
+#define BOARD_PLL_INPUT BOARD_POSC_FREQ
+#define BOARD_PLL_IDIV 2 /* PLL input divider */
+#define BOARD_PLL_MULT 20 /* PLL multiplier */
+#define BOARD_PLL_ODIV 1 /* PLL output divider */
+
+#define BOARD_CPU_CLOCK 80000000 /* CPU clock (80MHz = 8MHz * 20 / 2) */
+
+/* USB PLL configuration.
+ * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
+ */
+
+#define BOARD_UPLL_IDIV 2 /* USB PLL divider (revisit) */
+#define BOARD_USB_CLOCK 48000000 /* USB clock (8MHz / 2) * 24 / 2) */
+
+/* Peripheral clock is divided down from CPU clock.
+ * PBCLOCK = CPU_CLOCK / PBDIV
+ */
+
+#define BOARD_PBDIV 2 /* Peripheral clock divisor (PBDIV) */
+#define BOARD_PBCLOCK 40000000 /* Peripheral clock (PBCLK = 80MHz/2) */
+
+/* Watchdog pre-scaler (re-visit) */
+
+#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
+#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
+
+/* Ethernet MII clocking.
+ *
+ * The clock divider used to create the MII Management Clock (MDC). The MIIM
+ * module uses the SYSCLK as an input clock. According to the IEEE 802.3
+ * Specification this should be no faster than 2.5 MHz. However, some PHYs
+ * support clock rates up to 12.5 MHz.
+ */
+
+#define BOARD_EMAC_MIIM_DIV 32 /* Ideal: 80MHz/32 = 2.5MHz */
+
+/* LED definitions **********************************************************/
+/* LED Configuration ********************************************************/
+/* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the
+ * schematics:
+ *
+ * --- ----- --------------------------------------------------------------
+ * PIN Board Notes
+ * --- ----- --------------------------------------------------------------
+ * RA0 LED0 Pulled-up, low value illuminates
+ * RA1 LED1 Pulled-up, low value illuminates
+ * RD9 LED2 Pulled-up, low value illuminates
+ * RA9 LED4 Not available for general use*, indicates MMC/SD activity
+ * --- LED5 Not controllable by software, indicates power-on
+ *
+ * * RA9 is also the SD chip select. It will illuminate whenever the SD card
+ * is selected. If SD is not used, then LED4 could also be used as a user-
+ * controlled LED.
+ */
+
+/* LED index values for use with pic32mx_setled() */
+
+#define PIC32MX_PIC32MX7MMB_LED0 0
+#define PIC32MX_PIC32MX7MMB_LED1 1
+#define PIC32MX_PIC32MX7MMB_LED2 2
+#define PIC32MX_PIC32MX7MMB_NLEDS 3
+
+/* LED bits for use with pic32mx_setleds() */
+
+#define PIC32MX_PIC32MX7MMB_LED0_BIT (1 << PIC32MX_PIC32MX7MMB_LED0)
+#define PIC32MX_PIC32MX7MMB_LED1_BIT (1 << PIC32MX_PIC32MX7MMB_LED1)
+#define PIC32MX_PIC32MX7MMB_LED2_BIT (1 << PIC32MX_PIC32MX7MMB_LED2)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 3 LEDs
+ * on board the Mikroelektronika PIC32MX7 MMB. The following definitions
+ * describe how NuttX controls the LEDs:
+ *
+ * ON OFF
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED0 LED1 LED2 LED0 LED1 LED2
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF OFF --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 4
+#define LED_ASSERTION 4
+#define LED_PANIC 5
+
+#define LED_NVALUES 6
+
+/* Switch definitions *******************************************************/
+/* The Mikroelektronika PIC32MX7 MMB has a joystick:
+ *
+ * ------ -------- --------------------------
+ * GPIO SIGNAL BOARD CONNECTION
+ * ------ -------- --------------------------
+ * RB0 JOY-A Joystick A, HDR1 pin 24
+ * RB2 JOY-C Joystick C, HDR1 pin 22
+ * RB1 JOY-B Joystick B, HDR1 pin 23
+ * RB3 JOY-D Joystick D, HDR1 pin 21
+ * RA10 JOY-CP Joystick CP, HDR1 pin 25
+ */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_ledinit and pic32mx_setled
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
+ * are available to control the LEDs from user applicaitons.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_setled(int led, bool ledon);
+#endif
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_setleds(uint8_t ledset);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MIKROELEKTRONIKA_PIC32MX7MMB_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/pic32mx7mmb/nsh/Make.defs b/nuttx/configs/pic32mx7mmb/nsh/Make.defs
new file mode 100644
index 000000000..cfb6b9af3
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/nsh/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pic32mx7mmb/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pic32mx7mmb/nsh/appconfig b/nuttx/configs/pic32mx7mmb/nsh/appconfig
new file mode 100644
index 000000000..faa1f49ce
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/nsh/appconfig
@@ -0,0 +1,132 @@
+############################################################################
+# configs/pic32mx7mmb/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+############################################################################
+# Path to example in apps/examples containing the user_start entry point
+############################################################################
+
+CONFIGURED_APPS += examples/nsh
+
+############################################################################
+# The NSH application library
+############################################################################
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+############################################################################
+# USB device configurations
+############################################################################
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+
+# USB Mass Storage Class device configurations
+
+ifeq ($(CONFIG_USBMSC),y)
+ CONFIGURED_APPS += examples/usbstorage
+else
+
+# USB CDC/ACM serial device configurations
+
+ifeq ($(CONFIG_CDCACM),y)
+# Comment out to enable the examples/usbterm built-in
+ CONFIGURED_APPS += examples/cdcacm
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+else
+
+# Prolifics PL2303 emulation configurations
+
+ifeq ($(CONFIG_PL2303),y)
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif # CONFIG_PL2303
+endif # CONFIG_CDCACM
+endif # CONFIG_USBMSC
+endif # CONFIG_PIC32MX_USBDEV
+
+############################################################################
+# Networking configurations
+############################################################################
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Networking applications configured as an NX built-in commands
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+############################################################################
+# Other Applications that can be configured as an NX built-in commands
+############################################################################
+
+# The I2C tool
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+# Uncomment to select a graphics example
+
+ifeq ($(CONFIG_NX),y)
+#CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nximage
+#CONFIGURED_APPS += examples/nxlines
+endif
+
+# Uncomment to enable the touchscreen test
+
+ifeq ($(CONFIG_INPUT),y)
+#CONFIGURED_APPS += examples/touchscreen
+endif
diff --git a/nuttx/configs/pic32mx7mmb/nsh/defconfig b/nuttx/configs/pic32mx7mmb/nsh/defconfig
new file mode 100644
index 000000000..53ad041da
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/nsh/defconfig
@@ -0,0 +1,793 @@
+############################################################################
+# configs/pic32mx7mmb/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+CONFIG_ARCH_BOARD="pic32mx7mmb"
+CONFIG_ARCH_BOARD_PIC32MX7MMB=y
+CONFIG_BOARD_LOOPSPERMSEC=7245
+CONFIG_DRAM_SIZE=131072
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=y
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_SPI3=n
+CONFIG_PIC32MX_SPI4=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_UART3=n
+CONFIG_PIC32MX_UART4=n
+CONFIG_PIC32MX_UART5=n
+CONFIG_PIC32MX_UART6=n
+CONFIG_PIC32MX_PMP=y
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=y
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_CAN1=n
+CONFIG_PIC32MX_CAN2=n
+CONFIG_PIC32MX_ETHERNET=y
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+CONFIG_PIC32MX_FETHIO=0
+CONFIG_PIC32MX_FMIIEN=0
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+CONFIG_UART6_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+CONFIG_UART6_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+CONFIG_UART6_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+CONFIG_UART6_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+CONFIG_UART6_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+CONFIG_UART6_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+CONFIG_UART6_2STOP=0
+
+#
+# PIC32MX specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+CONFIG_NET_DESCDEBUG=n
+CONFIG_NET_DUMPPACKET=n
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_INPUT=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_SPI=n
+CONFIG_SPI_REGDEBUG=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=1
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=512
+CONFIG_FTPD_DATABUFFERSIZE=2048
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=n
+CONFIG_INPUT_TSC2007=n
+CONFIG_INPUT_STMPE811=n
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=255
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0x5cb7
+CONFIG_NXTK_BORDERCOLOR2=0x21c9
+CONFIG_NXTK_BORDERCOLOR3=0xffdf
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=n
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=n
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# PIC32MX7 MMB LCD Hardware Configuration
+#
+CONFIG_LCD_MIO283QT2=y
+CONFIG_LCD_NOGETRUN=n
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=y
+CONFIG_LCD_RPORTRAIT=n
+
+#
+# PIC32MX7 MMB specific LCD settings
+#
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=4
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=y
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pic32mx7mmb/nsh/ld.script b/nuttx/configs/pic32mx7mmb/nsh/ld.script
new file mode 100644
index 000000000..a3ffbe91a
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/nsh/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pic32mx7mmb/nsh/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX795F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX795F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX795F512L has 128Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 128K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pic32mx7mmb/nsh/setenv.sh b/nuttx/configs/pic32mx7mmb/nsh/setenv.sh
new file mode 100755
index 000000000..aefb891cf
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/nsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pic32mx7mmb/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the tools subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pic32mx7mmb/ostest/Make.defs b/nuttx/configs/pic32mx7mmb/ostest/Make.defs
new file mode 100644
index 000000000..f0f0066e2
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/ostest/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/pic32mx7mmb/ostest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/pic32mx7mmb/ostest/appconfig b/nuttx/configs/pic32mx7mmb/ostest/appconfig
new file mode 100644
index 000000000..61d102806
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/pic32mx7mmb/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/pic32mx7mmb/ostest/defconfig b/nuttx/configs/pic32mx7mmb/ostest/defconfig
new file mode 100644
index 000000000..ac6b9a82d
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/ostest/defconfig
@@ -0,0 +1,673 @@
+############################################################################
+# configs/pic32mx7mmb/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX795F512L=y
+CONFIG_ARCH_BOARD="pic32mx7mmb"
+CONFIG_ARCH_BOARD_PIC32MX7MMB=y
+CONFIG_BOARD_LOOPSPERMSEC=7245
+CONFIG_DRAM_SIZE=131072
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_SPI3=n
+CONFIG_PIC32MX_SPI4=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_UART3=n
+CONFIG_PIC32MX_UART4=n
+CONFIG_PIC32MX_UART5=n
+CONFIG_PIC32MX_UART6=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_CAN1=n
+CONFIG_PIC32MX_CAN2=n
+CONFIG_PIC32MX_ETHERNET=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+CONFIG_PIC32MX_FETHIO=0
+CONFIG_PIC32MX_FMIIEN=0
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+CONFIG_UART6_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+CONFIG_UART6_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+CONFIG_UART6_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+CONFIG_UART6_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+CONFIG_UART6_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+CONFIG_UART6_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+CONFIG_UART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+CONFIG_UART6_2STOP=0
+
+#
+# PIC32MX specific PHY/Ethernet device driver settings
+#
+CONFIG_PHY_KS8721=n
+CONFIG_PHY_DP83848C=n
+CONFIG_PHY_LAN8720=y
+CONFIG_PHY_AUTONEG=y
+CONFIG_PHY_SPEED100=n
+CONFIG_PHY_FDUPLEX=y
+CONFIG_NET_NTXDESC=7
+CONFIG_NET_NRXDESC=7
+CONFIG_NET_REGDEBUG=n
+CONFIG_NET_DESCDEBUG=n
+CONFIG_NET_DUMPPACKET=n
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=22
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=512
+CONFIG_FTPD_DATABUFFERSIZE=2048
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=4
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pic32mx7mmb/ostest/ld.script b/nuttx/configs/pic32mx7mmb/ostest/ld.script
new file mode 100644
index 000000000..a01074d21
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/ostest/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/pic32mx7mmb/ostest/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX795F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX795F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX795F512L has 128Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 128K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/pic32mx7mmb/ostest/setenv.sh b/nuttx/configs/pic32mx7mmb/ostest/setenv.sh
new file mode 100755
index 000000000..a960d4b7c
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/pic32mx7mmb/ostest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the tools subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pic32mx7mmb/src/Makefile b/nuttx/configs/pic32mx7mmb/src/Makefile
new file mode 100644
index 000000000..029c39a49
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/Makefile
@@ -0,0 +1,103 @@
+############################################################################
+# configs/pic32mx7mmb/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c up_spi.c up_mio283qt2.c
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+CSRCS += up_usbdev.c
+ifeq ($(CONFIG_EXAMPLES_USBTERM_DEVINIT),y)
+CSRCS += up_usbterm.c
+endif
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_INPUT),y)
+CSRCS += up_touchscreen.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h b/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h
new file mode 100644
index 000000000..6c9987da9
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h
@@ -0,0 +1,166 @@
+/****************************************************************************
+ * configs/pic32mx7mmb/src/pic32mx7mmb_internal.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_MIKROELEKTRONIKA_PIC32MX7MMB_SRC_PIC32MX7MMB_INTERNAL_H
+#define __CONFIGS_MIKROELEKTRONIKA_PIC32MX7MMB_SRC_PIC32MX7MMB_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the
+ * schematics:
+ *
+ * --- ----- --------------------------------------------------------------
+ * PIN Board Notes
+ * --- ----- --------------------------------------------------------------
+ * RA0 LED0 Pulled-up, low value illuminates
+ * RA1 LED1 Pulled-up, low value illuminates
+ * RD9 LED2 Pulled-up, low value illuminates
+ * RA9 LED4 Not available for general use*, indicates MMC/SD activity
+ * --- LED5 Not controllable by software, indicates power-on
+ *
+ * * RA9 is also the SD chip select. It will illuminate whenever the SD card
+ * is selected. If SD is not used, then LED4 could also be used as a user-
+ * controlled LED.
+ */
+
+/* The Mikroelektronika PIC32MX7 MMB has a joystick:
+ *
+ * ------ -------- ------------------------- --------------------------------
+ * GPIO SIGNAL BOARD CONNECTION NOTES
+ * ------ -------- ------------------------- --------------------------------
+ * RB0 JOY-A Joystick A, HDR1 pin 24 Pulled up, low value when closed
+ * RB2 JOY-C Joystick C, HDR1 pin 22 Pulled up, low value when closed
+ * RB1 JOY-B Joystick B, HDR1 pin 23 Pulled up, low value when closed
+ * RB3 JOY-D Joystick D, HDR1 pin 21 Pulled up, low value when closed
+ * RA10 JOY-CP Joystick CP, HDR1 pin 25 Pulled up, low value when closed
+ */
+
+/* LCD
+ *
+ * ------ -------- ------------------------- --------------------------------
+ * GPIO SIGNAL BOARD CONNECTION NOTES
+ * ------ -------- ------------------------- --------------------------------
+ * RD2 LCD-BLED Backlight Light Low value turns off
+ */
+
+/* SPI1 and SD Card
+ *
+ * ------ -------- ------------------------- --------------------------------
+ * GPIO SIGNAL BOARD CONNECTION NOTES
+ * ------ -------- ------------------------- --------------------------------
+ * RC4 SPI1 SD card slot SPI1 data IN
+ * RD0 SPO1 SD card slot SPI1 data OUT
+ * RD10 SCK1 SD card slot SD card, SPI clock
+ *
+ * RA9 SD_CS# SD card slot SD card, SPI chip select (active low)
+ * RG6 SD_WP SD card slot SD card, write protect
+ * RG7 SD_CD# SD card slot SD card, card detect (not)
+ */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Mikroelektronika PIC32MX7
+ * MMB board.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \
+ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4)
+EXTERN void weak_function pic32mx_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD. This function should be called early in the boot
+ * sequence -- even if the LCD is not enabled. In that case we should
+ * at a minimum at least disable the LCD backlight.
+ *
+ ****************************************************************************/
+
+EXTERN void pic32mx_lcdinitialize(void);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_MIKROELEKTRONIKA_PIC32MX7MMB_SRC_PIC32MX7MMB_INTERNAL_H */
diff --git a/nuttx/configs/pic32mx7mmb/src/up_boot.c b/nuttx/configs/pic32mx7mmb/src/up_boot.c
new file mode 100644
index 000000000..426a70761
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_boot.c
@@ -0,0 +1,101 @@
+/************************************************************************************
+ * configs/pic32mx7mmb/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "pic32mx7mmb_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_boardinitialize
+ *
+ * Description:
+ * All PIC32MX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void pic32mx_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak
+ * function pic32mx_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \
+ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4)
+ if (pic32mx_spiinitialize)
+ {
+ pic32mx_spiinitialize();
+ }
+#endif
+
+/* Initialize the LCD. The LCD initialization function should be called early in the
+ * boot sequence -- even if the LCD is not enabled. In that case we should
+ * at a minimum at least disable the LCD backlight.
+ */
+
+ pic32mx_lcdinitialize();
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ pic32mx_ledinit();
+#endif
+}
diff --git a/nuttx/configs/pic32mx7mmb/src/up_leds.c b/nuttx/configs/pic32mx7mmb/src/up_leds.c
new file mode 100644
index 000000000..187935280
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_leds.c
@@ -0,0 +1,275 @@
+/****************************************************************************
+ * configs/pic32mx7mmb/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "pic32mx-internal.h"
+#include "pic32mx7mmb_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED Configuration ********************************************************/
+/* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the
+ * schematics:
+ *
+ * --- ----- --------------------------------------------------------------
+ * PIN Board Notes
+ * --- ----- --------------------------------------------------------------
+ * RA0 LED0 Pulled-up, low value illuminates
+ * RA1 LED1 Pulled-up, low value illuminates
+ * RD9 LED2 Pulled-up, low value illuminates
+ * RA9 LED4 Not available for general use*, indicates MMC/SD activity
+ * --- LED5 Not controllable by software, indicates power-on
+ *
+ * * RA9 is also the SD chip select. It will illuminate whenever the SD card
+ * is selected. If SD is not used, then LED4 could also be used as a user-
+ * controlled LED.
+ *
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as
+ * follows:
+ * ON OFF
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED0 LED1 LED2 LED0 LED1 LED2
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF OFF --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
+ */
+
+#define GPIO_LED_0 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTA|GPIO_PIN0)
+#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTA|GPIO_PIN1)
+#define GPIO_LED_2 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTD|GPIO_PIN9)
+#define GPIO_LED_4 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTA|GPIO_PIN9)
+
+/* LED Management Definitions ***********************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+# define LED_OFF 0
+# define LED_ON 1
+# define LED_NC 2
+#endif
+
+/* Debug ********************************************************************/
+
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_LEDS)
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_LEDS
+# undef CONFIG_DEBUG_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private types
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+struct led_setting_s
+{
+ uint8_t led0 : 2;
+ uint8_t led1 : 2;
+ uint8_t led2 : 2;
+ uint8_t unused : 2;
+};
+#endif
+
+ /****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The
+ * following structures identified the LED settings for each NuttX LED state.
+ */
+
+#ifdef CONFIG_ARCH_LEDS
+static const struct led_setting_s g_ledonvalues[LED_NVALUES] =
+{
+ {LED_OFF, LED_OFF, LED_OFF, LED_OFF},
+ {LED_ON, LED_OFF, LED_NC, LED_OFF},
+ {LED_OFF, LED_ON, LED_NC, LED_OFF},
+ {LED_ON, LED_ON, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_ON, LED_OFF},
+ {LED_ON, LED_NC, LED_NC, LED_OFF},
+};
+
+static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
+{
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_OFF, LED_OFF},
+ {LED_OFF, LED_NC, LED_NC, LED_OFF},
+};
+
+/* If CONFIG_ARCH_LEDS is not defined, the the user can control the LEDs in
+ * any way. The following array simply maps the PIC32MX_PIC32MX7MMB_LEDn
+ * index values to the correct LED pin configuration.
+ */
+
+#else
+static const uint16_t g_ledpincfg[PIC32MX_PIC32MX7MMB_NLEDS] =
+{
+ GPIO_LED_0, GPIO_LED_1, GPIO_LED_2
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_setleds(FAR const struct led_setting_s *setting)
+{
+ /* LEDs are pulled up so writing a low value (false) illuminates them */
+
+ if (setting->led0 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_0, setting->led0 != LED_ON);
+ }
+
+ if (setting->led1 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_1, setting->led1 != LED_ON);
+ }
+
+ if (setting->led2 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_2, setting->led2 != LED_ON);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pic32mx_ledinit
+ ****************************************************************************/
+
+void pic32mx_ledinit(void)
+{
+ /* Configure output pins */
+
+ pic32mx_configgpio(GPIO_LED_0);
+ pic32mx_configgpio(GPIO_LED_1);
+ pic32mx_configgpio(GPIO_LED_2);
+}
+
+/****************************************************************************
+ * Name: pic32mx_setled
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setled(int led, bool ledon)
+{
+ /* LEDs are pulled up so writing a low value (false) illuminates them */
+
+ if ((unsigned)led < PIC32MX_PIC32MX7MMB_NLEDS)
+ {
+ pic32mx_gpiowrite(g_ledpincfg[led], !ledon);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_setleds
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setleds(uint8_t ledset)
+{
+ /* Call pic32mx_setled() with ledon == true to illuminated the LED */
+
+ pic32mx_setled(PIC32MX_PIC32MX7MMB_LED0, (ledset & PIC32MX_PIC32MX7MMB_LED0_BIT) != 0);
+ pic32mx_setled(PIC32MX_PIC32MX7MMB_LED1, (ledset & PIC32MX_PIC32MX7MMB_LED1_BIT) != 0);
+ pic32mx_setled(PIC32MX_PIC32MX7MMB_LED2, (ledset & PIC32MX_PIC32MX7MMB_LED2_BIT) != 0);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledon(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledonvalues[led]);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledoff(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledoffvalues[led]);
+ }
+}
+#endif
diff --git a/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c b/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c
new file mode 100644
index 000000000..22d6252a9
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c
@@ -0,0 +1,554 @@
+/**************************************************************************************
+ * configs/stm32fdiscover/src/up_mio283qt2.c
+ * arch/arm/src/board/up_mio283qt2.c
+ *
+ * Interface definition for the MI0283QT-2 LCD from Multi-Inno Technology Co., Ltd.
+ * This LCD is based on the Himax HX8347-D LCD controller.
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/mio283qt2.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "pic32mx-internal.h"
+#include "pic32mx-pmp.h"
+#include "pic32mx7mmb_internal.h"
+
+#ifdef CONFIG_LCD_MIO283QT2
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+/* Configuration **********************************************************************/
+
+#ifndef CONFIG_PIC32MX_PMP
+# error "CONFIG_PIC32MX_PMP is required to use the LCD"
+#endif
+
+/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must
+ * also be enabled.
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+# undef CONFIG_DEBUG_LCD
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_LCD
+#endif
+
+/* PIC32MX7MMB LCD Hardware Definitions ***********************************************/
+/* --- ---------------------------------- -------------------- ------------------------
+ * PIN CONFIGURATIONS SIGNAL NAME ON-BOARD CONNECTIONS
+ * (Family Data Sheet Table 1-1) (PIC32MX7 Schematic)
+ * --- ---------------------------------- -------------------- ------------------------
+ * 6 RC1/T2CK LCD_RST TFT display
+ * 43 PMA1/AETXD3/AN14/ERXD2/PMALH/RB14 LCD-CS# TFT display, HDR2 pin 3
+ * 77 OC3/RD2 LCD_BLED LCD backlight LED
+ * 44 PMA0/AETXD2/AN15/CN12/ERXD3/OCFB/ LCD-RS TFT display
+ * PMALL/RB15
+ *
+ * 34 PMA13/AN10/RB10/CVREFOUT LCD-YD TFT display
+ * 35 PMA12/AETXERR/AN11/ERXERR/RB11 LCD-XR TFT display
+ * 41 PMA11/AECRS/AN12/ERXD0/RB12 LCD-YU TFT display
+ * 42 PMA10/AECOL/AN13/ERXD1/RB13 LCD-XL TFT display
+ *
+ * 93 PMD0/RE0 PMPD0 TFT display, HDR1 pin 18
+ * 94 PMD1/RE1 PMPD1 TFT display, HDR1 pin 17
+ * 98 PMD2/RE2 PMPD2 TFT display, HDR1 pin 16
+ * 99 PMD3/RE3 PMPD3 TFT display, HDR1 pin 15
+ * 100 PMD4/RE4 PMPD4 TFT display, HDR1 pin 14
+ * 3 PMD5/RE5 PMPD5 TFT display, HDR1 pin 13
+ * 4 PMD6/RE6 PMPD6 TFT display, HDR1 pin 12
+ * 5 PMD7/RE7 PMPD7 TFT display, HDR1 pin 11
+ * 90 PMD8/C2RX/RG0 PMPD8 TFT display, HDR1 pin 10
+ * 89 PMD9/C2TX/ETXERR/RG1 PMPD9 TFT display, HDR1 pin 9
+ * 88 PMD10/C1TX/ETXD0/RF1 PMPD10 TFT display, HDR1 pin 8
+ * 87 PMD11/C1RX/ETXD1/RF0 PMPD11 TFT display, HDR1 pin 7
+ * 79 PMD12/ETXD2/IC5/RD12 PMPD12 TFT display, HDR1 pin 6
+ * 80 PMD13/CN19/ETXD3/RD13 PMPD13 TFT display, HDR1 pin 5
+ * 83 PMD14/CN15/ETXEN/RD6 PMPD14 TFT display, HDR1 pin 4
+ * 84 PMD15/CN16/ETXCLK/RD7 PMPD15 TFT display, HDR1 pin 3
+ *
+ * 82 CN14/PMRD/RD5 PMPRD
+ * 81 CN13/OC5/PMWR/RD4 PMPWR
+ */
+
+/* RC1, Reset -- Low value holds in reset */
+
+#define GPIO_LCD_RST (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTC|GPIO_PIN1)
+
+/* RB14, LCD select -- Low value selects LCD */
+
+#define GPIO_LCD_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN14)
+
+/* RD2, Backlight -- Low value turns off */
+
+#define GPIO_LCD_BLED (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN2)
+
+/* RB15, RS -- High values selects data */
+
+#define GPIO_LCD_RS (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTB|GPIO_PIN15)
+
+ /* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg dbg
+# define lcdvdbg vdbg
+#else
+# define lcddbg(x...)
+# define lcdvdbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+struct pic32mx7mmb_dev_s
+{
+ struct mio283qt2_lcd_s dev; /* The externally visible part of the driver */
+ bool data; /* true=data selected */
+ bool selected; /* true=LCD selected */
+ bool reading; /* true=We are in a read sequence */
+ FAR struct lcd_dev_s *drvr; /* The saved instance of the LCD driver */
+};
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+/* Low Level LCD access */
+
+static void pic32mx_select(FAR struct mio283qt2_lcd_s *dev);
+static void pic32mx_deselect(FAR struct mio283qt2_lcd_s *dev);
+static void pic32mx_index(FAR struct mio283qt2_lcd_s *dev, uint8_t index);
+#ifndef CONFIG_MIO283QT2_WRONLY
+static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev);
+#endif
+static void pic32mx_write(FAR struct mio283qt2_lcd_s *dev, uint16_t data);
+static void pic32mx_backlight(FAR struct mio283qt2_lcd_s *dev, int power);
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is the driver state structure (there is no retained state information) */
+
+static struct pic32mx7mmb_dev_s g_pic32mx7mmb_lcd =
+{
+ {
+ .select = pic32mx_select,
+ .deselect = pic32mx_deselect,
+ .index = pic32mx_index,
+#ifndef CONFIG_MIO283QT2_WRONLY
+ .read = pic32mx_read,
+#endif
+ .write = pic32mx_write,
+ .backlight = pic32mx_backlight
+ }
+};
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: pic32mx_command
+ *
+ * Description:
+ * Configure to write an LCD command
+ *
+ **************************************************************************************/
+
+static void pic32mx_command(FAR struct pic32mx7mmb_dev_s *priv)
+{
+ /* Low selects command */
+
+ if (priv->data)
+ {
+ pic32mx_gpiowrite(GPIO_LCD_RS, false);
+
+ priv->data = false; /* Command, not data */
+ priv->reading = false; /* No read sequence in progress */
+ }
+}
+
+/**************************************************************************************
+ * Name: pic32mx_data
+ *
+ * Description:
+ * Configure to read or write LCD data
+ *
+ **************************************************************************************/
+
+static void pic32mx_data(FAR struct pic32mx7mmb_dev_s *priv)
+{
+ /* Hi selects data */
+
+ if (!priv->data)
+ {
+ pic32mx_gpiowrite(GPIO_LCD_RS, true);
+
+ priv->data = true; /* Data, not command */
+ priv->reading = false; /* No read sequence in progress */
+ }
+}
+
+/**************************************************************************************
+ * Name: pic32mx_data
+ *
+ * Description:
+ * Wait until the PMP is no longer busy
+ *
+ **************************************************************************************/
+
+static void pic32mx_busywait(void)
+{
+ while ((getreg32(PIC32MX_PMP_MODE) & PMP_MODE_BUSY) != 0);
+}
+
+/**************************************************************************************
+ * Name: pic32mx_select
+ *
+ * Description:
+ * Select the LCD device
+ *
+ **************************************************************************************/
+
+static void pic32mx_select(FAR struct mio283qt2_lcd_s *dev)
+{
+ FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev;
+
+ /* CS low selects */
+
+ if (!priv->selected)
+ {
+ pic32mx_gpiowrite(GPIO_LCD_CS, false);
+
+ priv->selected = true; /* LCD selected */
+ priv->reading = false; /* No read sequence in progress */
+ }
+}
+
+/**************************************************************************************
+ * Name: pic32mx_deselect
+ *
+ * Description:
+ * De-select the LCD device
+ *
+ **************************************************************************************/
+
+static void pic32mx_deselect(FAR struct mio283qt2_lcd_s *dev)
+{
+ FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev;
+
+ /* CS high de-selects */
+
+ if (priv->selected)
+ {
+ pic32mx_gpiowrite(GPIO_LCD_CS, true);
+
+ priv->selected = false; /* LCD not selected */
+ priv->reading = false; /* No read sequence in progress */
+ }
+}
+
+/**************************************************************************************
+ * Name: pic32mx_index
+ *
+ * Description:
+ * Set the index register
+ *
+ **************************************************************************************/
+
+static void pic32mx_index(FAR struct mio283qt2_lcd_s *dev, uint8_t index)
+{
+ FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev;
+
+ /* Make sure that the PMP is not busy from the last transaction. Read data is not
+ * available until the busy bit becomes zero.
+ */
+
+ pic32mx_busywait();
+
+ /* Write the 8-bit command (on the 16-bit data bus) */
+
+ pic32mx_command(priv);
+ putreg16((uint16_t)index, PIC32MX_PMP_DIN);
+}
+
+/**************************************************************************************
+ * Name: pic32mx_read
+ *
+ * Description:
+ * Read LCD data (GRAM data or register contents)
+ *
+ **************************************************************************************/
+
+#ifndef CONFIG_MIO283QT2_WRONLY
+static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev)
+{
+ FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev;
+ uint16_t data;
+
+ /* Make sure that the PMP is not busy from the last transaction. Read data is not
+ * available until the busy bit becomes zero.
+ */
+
+ pic32mx_busywait();
+
+ /* Read 16-bits of data */
+
+ pic32mx_data(priv);
+ data = getreg16(PIC32MX_PMP_DIN);
+
+ /* We need to discard the first 16-bits of data that we read and re-read inorder
+ * to get valid data (that is just the way that the PMP works).
+ */
+
+ if (!priv->reading)
+ {
+ data = getreg16(PIC32MX_PMP_DIN);
+ }
+
+ return data;
+}
+#endif
+
+/**************************************************************************************
+ * Name: pic32mx_write
+ *
+ * Description:
+ * Write LCD data (GRAM data or register contents)
+ *
+ **************************************************************************************/
+
+static void pic32mx_write(FAR struct mio283qt2_lcd_s *dev, uint16_t data)
+{
+ FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev;
+
+ /* Make sure that the PMP is not busy from the last transaction */
+
+ pic32mx_busywait();
+
+ /* Write 16-bits of data */
+
+ pic32mx_data(priv);
+ putreg16(data, PIC32MX_PMP_DIN);
+
+ /* We are not in a write sequence */
+
+ priv->reading = false;
+}
+
+/**************************************************************************************
+ * Name: pic32mx_write
+ *
+ * Description:
+ * Write LCD data (GRAM data or register contents)
+ *
+ **************************************************************************************/
+
+static void pic32mx_backlight(FAR struct mio283qt2_lcd_s *dev, int power)
+{
+ /* For now, we just control the backlight as a discrete. Pulse width modulation
+ * would be required to vary the backlight level. A low value turns the backlight
+ * off.
+ */
+
+ pic32mx_gpiowrite(GPIO_LCD_BLED, power > 0);
+}
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ uint32_t regval;
+
+ /* Only initialize the driver once. NOTE: The LCD GPIOs were already configured
+ * by pic32mx_lcdinitialize.
+ */
+
+ if (!g_pic32mx7mmb_lcd.drvr)
+ {
+ lcdvdbg("Initializing\n");
+
+ /* Hold the LCD in reset (active low) */
+
+ pic32mx_gpiowrite(GPIO_LCD_RST, false);
+
+ /* Configure PMP to support the LCD */
+
+ putreg32(0, PIC32MX_PMP_MODE);
+ putreg32(0, PIC32MX_PMP_AEN);
+ putreg32(0, PIC32MX_PMP_CON);
+
+ /* Set LCD timing values, PMP master mode 2, 16-bit mode, no address
+ * increment, and no interrupts.
+ */
+
+ regval = (PMP_MODE_WAITE_RD(0) | PMP_MODE_WAITM(3) | PMP_MODE_WAITB_1TPB |
+ PMP_MODE_MODE_MODE2 | PMP_MODE_MODE16 | PMP_MODE_INCM_NONE |
+ PMP_MODE_IRQM_NONE);
+ putreg32(regval, PIC32MX_PMP_MODE);
+
+ /* Enable the PMP for reading and writing */
+
+ regval = (PMP_CON_CSF_ADDR1415 | PMP_CON_PTRDEN | PMP_CON_PTWREN |
+ PMP_CON_ADRMUX_NONE | PMP_CON_ON);
+ putreg32(regval, PIC32MX_PMP_CON);
+
+ /* Bring the LCD out of reset */
+
+ up_mdelay(5);
+ pic32mx_gpiowrite(GPIO_LCD_RST, true);
+
+ /* Configure and enable the LCD */
+
+ up_mdelay(50);
+ g_pic32mx7mmb_lcd.drvr = mio283qt2_lcdinitialize(&g_pic32mx7mmb_lcd.dev);
+ if (!g_pic32mx7mmb_lcd.drvr)
+ {
+ lcddbg("ERROR: mio283qt2_lcdinitialize failed\n");
+ return -ENODEV;
+ }
+ }
+
+ /* Clear the display (setting it to the color 0=black) */
+
+#if 0 /* Already done in the driver */
+ mio283qt2_clear(g_pic32mx7mmb_lcd.drvr, 0);
+#endif
+
+ /* Turn the display off */
+
+ g_pic32mx7mmb_lcd.drvr->setpower(g_pic32mx7mmb_lcd.drvr, 0);
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return g_pic32mx7mmb_lcd.drvr;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ /* Turn the display off */
+
+ g_pic32mx7mmb_lcd.drvr->setpower(g_pic32mx7mmb_lcd.drvr, 0);
+}
+
+#endif /* CONFIG_LCD_MIO283QT2 */
+
+/****************************************************************************
+ * Name: pic32mx_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD. This function should be called early in the boot
+ * sequendce -- Even if the LCD is not enabled. In that case we should
+ * at a minimum at least disable the LCD backlight.
+ *
+ ****************************************************************************/
+
+void pic32mx_lcdinitialize(void)
+{
+ /* Configure all LCD discrete controls. LCD will be left in this state:
+ * 1. Held in reset,
+ * 2. Not selected,
+ * 3. Backlight off,
+ * 4. Command selected.
+ */
+
+#ifdef CONFIG_LCD_MIO283QT2
+ pic32mx_configgpio(GPIO_LCD_RST);
+ pic32mx_configgpio(GPIO_LCD_CS);
+ pic32mx_configgpio(GPIO_LCD_BLED);
+ pic32mx_configgpio(GPIO_LCD_RS);
+
+#else
+ /* Just configure the backlight control as an output and turn off the
+ * backlight for now.
+ */
+
+ pic32mx_configgpio(GPIO_LCD_BLED);
+#endif
+}
+
+
diff --git a/nuttx/configs/pic32mx7mmb/src/up_nsh.c b/nuttx/configs/pic32mx7mmb/src/up_nsh.c
new file mode 100644
index 000000000..d063450d3
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_nsh.c
@@ -0,0 +1,390 @@
+/****************************************************************************
+ * config/pic32mx7mmb/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+#include <nuttx/usb/usbhost.h>
+
+#include "pic32mx-internal.h"
+#include "pic32mx7mmb_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Assume that we have MMC/SD, USB host (and USB device) */
+
+#define NSH_HAVEMMCSD 1
+#define NSH_HAVEUSBHOST 1
+
+/* The Mikroelektronika PIC32MX7 MMB has one SD slot on board, connected to SPI 1. */
+
+#ifndef CONFIG_PIC32MX_MMCSDSPIPORTNO
+# define CONFIG_PIC32MX_MMCSDSPIPORTNO 1
+#endif
+
+/* Make sure that the configuration will support the SD card */
+
+#ifdef NSH_HAVEMMCSD
+
+ /* Make sure that the NSH configuration uses the correct SPI */
+
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO)
+# define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO
+# elif CONFIG_NSH_MMCSDSPIPORTNO != CONFIG_PIC32MX_MMCSDSPIPORTNO
+# warning "CONFIG_PIC32MX_MMCSDSPIPORTNO does not match CONFIG_NSH_MMCSDSPIPORTNO"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO CONFIG_PIC32MX_MMCSDSPIPORTNO
+# endif
+
+ /* Make sure that the NSH configuration uses slot 0 (there is only one
+ * SD slot on the Mikroelektronica PIC32MX7 MMB).
+ */
+
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# warning "The Mikroelektronika PIC32MX7 MMB has only one slot (0)"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+
+ /* Make sure that the correct SPI is enabled in the configuration */
+
+# if CONFIG_PIC32MX_MMCSDSPIPORTNO == 1 && !defined(CONFIG_PIC32MX_SPI1)
+# warning "CONFIG_PIC32MX_SPI1 is not enabled"
+# undef NSH_HAVEMMCSD
+# elif CONFIG_PIC32MX_MMCSDSPIPORTNO == 2 && !defined(CONFIG_PIC32MX_SPI2)
+# warning "CONFIG_PIC32MX_SPI2 is not enabled"
+# undef NSH_HAVEMMCSD
+# elif CONFIG_PIC32MX_MMCSDSPIPORTNO == 3 && !defined(CONFIG_PIC32MX_SPI3)
+# warning "CONFIG_PIC32MX_SPI3 is not enabled"
+# undef NSH_HAVEMMCSD
+# elif CONFIG_PIC32MX_MMCSDSPIPORTNO == 4 && !defined(CONFIG_PIC32MX_SPI4)
+# warning "CONFIG_PIC32MX_SPI4 is not enabled"
+# undef NSH_HAVEMMCSD
+# endif
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Select /dev/mmcsd0 if no other minor number is provided */
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* USB Host */
+
+#ifdef CONFIG_USBHOST
+# ifndef CONFIG_PIC32MX_USBHOST
+# error "CONFIG_PIC32MX_USBHOST is not selected"
+# undef NSH_HAVEUSBHOST
+# endif
+#endif
+
+#ifdef CONFIG_PIC32MX_USBHOST
+# ifndef CONFIG_USBHOST
+# warning "CONFIG_USBHOST is not selected"
+# undef NSH_HAVEUSBHOST
+# endif
+#endif
+
+#if !defined(CONFIG_USBHOST) || !defined(CONFIG_PIC32MX_USBHOST)
+# undef NSH_HAVEUSBHOST
+#endif
+
+#ifdef NSH_HAVEUSBHOST
+# ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+# endif
+# ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+# endif
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ message("nsh_waiter: Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ message("nsh_waiter: %s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Name: nsh_sdinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int nsh_sdinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ ret = -ENODEV;
+ goto errout;
+ }
+
+ message("Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* The SPI should be in 8-bit (default) and mode2: CKP=1, CKE=0.
+ * The MMC/SD driver will control the SPI frequency. WARNING:
+ * this is not the right way to do this... this should be done
+ * the MMC/SD driver: Other device on SPI1 may need other mode
+ * settings.
+ */
+
+ SPI_SETMODE(spi, SPIDEV_MODE2);
+
+ /* Bind the SPI port to the slot */
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR,
+ CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_sdinitialize: "
+ "Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO, ret);
+ goto errout;
+ }
+
+ message("Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+
+errout:
+ return ret;
+}
+#else
+# define nsh_sdinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbhostinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_usbhostinitialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ message("nsh_usbhostinitialize: Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ message("nsh_usbhostinitialize: Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ message("nsh_usbhostinitialize: Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ message("nsh_usbhostinitialize: Start nsh_waiter\n");
+
+#ifndef CONFIG_CUSTOM_STACK
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)nsh_waiter, (const char **)NULL);
+#else
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ (main_t)nsh_waiter, (const char **)NULL);
+#endif
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+ return -ENODEV;
+}
+#else
+# define nsh_usbhostinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbdevinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBDEV
+static int nsh_usbdevinitialize(void)
+{
+ /* The Mikroelektronika PIC32MX7 MMB has no way to know when the USB is
+ * connected. So we will fake it and tell the USB driver that the USB is
+ * connected now.
+ */
+
+ pic32mx_usbattach();
+ return OK;
+}
+#else
+# define nsh_usbdevinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ int ret;
+
+ /* Initialize SPI-based microSD */
+
+ ret = nsh_sdinitialize();
+ if (ret == OK)
+ {
+ /* Initialize USB host */
+
+ ret = nsh_usbhostinitialize();
+ }
+
+ if (ret == OK)
+ {
+ /* Initialize USB device */
+
+ ret = nsh_usbdevinitialize();
+ }
+ return ret;
+}
diff --git a/nuttx/configs/pic32mx7mmb/src/up_spi.c b/nuttx/configs/pic32mx7mmb/src/up_spi.c
new file mode 100644
index 000000000..a15881868
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_spi.c
@@ -0,0 +1,264 @@
+/************************************************************************************
+ * configs/pic32mx7mmb/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "pic32mx-internal.h"
+#include "pic32mx7mmb_internal.h"
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \
+ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* SPI1 and SD Card
+ *
+ * ------ -------- ------------------------- --------------------------------
+ * GPIO SIGNAL BOARD CONNECTION NOTES
+ * ------ -------- ------------------------- --------------------------------
+ * RC4 SPI1 SD card slot SPI1 data IN
+ * RD0 SPO1 SD card slot SPI1 data OUT
+ * RD10 SCK1 SD card slot SD card, SPI clock
+ *
+ * RA9 SD_CS# SD card slot SD card, SPI chip select (active low)
+ * RG6 SD_WP SD card slot SD card, write protect
+ * RG7 SD_CD# SD card slot SD card, card detect (not)
+ */
+
+#define GPIO_SD_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTA|GPIO_PIN9)
+#define GPIO_SD_WP (GPIO_INPUT|GPIO_PORTG|GPIO_PIN6)
+#define GPIO_SD_CD (GPIO_INPUT|GPIO_INT|GPIO_PORTG|GPIO_PIN7)
+
+/* The following enable debug output from this file (needs CONFIG_DEBUG too).
+ *
+ * CONFIG_DEBUG_SPI - Define to enable basic SPI debug
+ */
+
+#ifdef CONFIG_DEBUG_SPI
+# define spidbg lldbg
+# define spivdbg llvdbg
+#else
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Mikroelektronka PIC32MX7
+ * MMB board.
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_spiinitialize(void)
+{
+ /* Configure the SPI chip select, write protect, and card detect GPIOs */
+
+#ifdef CONFIG_PIC32MX_SPI1
+ pic32mx_configgpio(GPIO_SD_CS);
+ pic32mx_configgpio(GPIO_SD_WP);
+ pic32mx_configgpio(GPIO_SD_CD);
+#endif
+}
+
+/************************************************************************************
+ * Name: pic32mx_spiNselect, pic32mx_spiNstatus, and pic32mx_spiNcmddata
+ *
+ * Description:
+ * These external functions must be provided by board-specific logic. They are
+ * implementations of the select, status, and cmddata methods of the SPI interface
+ * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods
+ * including up_spiinitialize()) are provided by common PIC32MX logic. To use
+ * this common SPI logic on your board:
+ *
+ * 1. Provide logic in pic32mx_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide pic32mx_spiNselect() and pic32mx_spiNstatus() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
+ * pic32mx_spiNcmddata() functions in your board-specific logic. These
+ * functions will perform cmd/data selection operations using GPIOs in the way
+ * your board is configured.
+ * 3. Add a call to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+struct spi_dev_s;
+enum spi_dev_e;
+
+#ifdef CONFIG_PIC32MX_SPI1
+void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ pic32mx_gpiowrite(GPIO_SD_CS, !selected);
+ }
+}
+
+uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ uint8_t ret = 0;
+
+ /* Card detect active low. */
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ if (!pic32mx_gpioread(GPIO_SD_CD))
+ {
+ ret = SPI_STATUS_PRESENT;
+
+ /* A high value indicates the the card is write protected. */
+
+ if (pic32mx_gpioread(GPIO_SD_WP))
+ {
+ ret |= SPI_STATUS_WRPROTECTED;
+ }
+ }
+ }
+
+ spidbg("Returning %02x\n", ret);
+ return ret;
+}
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#ifdef CONFIG_PIC31MX_SPI2
+void pic31mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic31mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ spidbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+
+#ifdef CONFIG_SPI_CMDDATA
+int pic31mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#ifdef CONFIG_PIC31MX_SPI3
+void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ spidbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#ifdef CONFIG_PIC32MX_SPI4
+void pic32mx_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+#warning "Missing logic"
+}
+
+uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ spidbg("Returning nothing\n");
+#warning "Missing logic"
+ return 0;
+}
+
+#ifdef CONFIG_SPI_CMDDATA
+int pic32mx_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#warning "Missing logic"
+ return 0;
+}
+#endif
+#endif
+
+#endif /* CONFIG_PIC32MX_SPI1..4 */
diff --git a/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c b/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c
new file mode 100644
index 000000000..c8fe53507
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_touchscreen.c
@@ -0,0 +1,1463 @@
+/************************************************************************************
+ * configs/pic32mx7mmb/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <sched.h>
+#include <assert.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/clock.h>
+#include <nuttx/wqueue.h>
+#include <nuttx/fs/fs.h>
+#include <nuttx/input/touchscreen.h>
+
+#include <arch/board/board.h>
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "pic32mx-adc.h"
+#include "pic32mx-ioport.h"
+#include "pic32mx7mmb_internal.h"
+
+#ifdef CONFIG_INPUT
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+/* Reference counting is partially implemented, but not needed in the current design.
+ */
+
+#undef CONFIG_TOUCHSCREEN_REFCNT
+
+/* Should we try again on bad samples? */
+
+#undef CONFIG_TOUCHSCREEN_RESAMPLE
+
+/* Work queue support is required */
+
+#ifndef CONFIG_SCHED_WORKQUEUE
+# warning "Work queue support is required (CONFIG_SCHED_WORKQUEUE=y)
+#endif
+
+/* CONFIG_TOUCHSCREEN_THRESHX and CONFIG_TOUCHSCREEN_THRESHY
+ * Touchscreen data comes in a a very high rate. New touch positions
+ * will only be reported when the X or Y data changes by these thresholds.
+ * This trades reduces data rate for some loss in dragging accuracy. The
+ * touchscreen is configure for 10-bit values so the raw ranges are 0-1023. So
+ * for example, if your display is 320x240, then THRESHX=3 and THRESHY=4
+ * would correspond to one pixel. Default: 4
+ */
+
+#ifndef CONFIG_TOUCHSCREEN_THRESHX
+# define CONFIG_TOUCHSCREEN_THRESHX 4
+#endif
+
+#ifndef CONFIG_TOUCHSCREEN_THRESHY
+# define CONFIG_TOUCHSCREEN_THRESHY 4
+#endif
+
+/* Driver support *******************************************************************/
+/* This format is used to construct the /dev/input[n] device driver path. It is
+ * defined here so that it will be used consistently in all places.
+ */
+
+#define DEV_FORMAT "/dev/input%d"
+#define DEV_NAMELEN 16
+
+/* PIC32MX7MMB Touchscreen Hardware Definitions *************************************/
+/* ----- ------ --------------------
+ * GPIO ADC IN TFT Signal Name
+ * ----- ------ --------------------
+ * RB10 AN10 LCD-YD
+ * RB11 AN11 LCD-XR
+ * RB12 AN12 LCD-YU
+ * RB13 AN13 LCD-XL
+ */
+
+#define LCD_XPLUS_PIN (11)
+#define LCD_YPLUS_PIN (12)
+#define LCD_XMINUS_PIN (13)
+#define LCD_YMINUS_PIN (10)
+
+#define LCD_XPLUS_BIT (1 << LCD_XPLUS_PIN)
+#define LCD_YPLUS_BIT (1 << LCD_YPLUS_PIN)
+#define LCD_XMINUS_BIT (1 << LCD_XMINUS_PIN)
+#define LCD_YMINUS_BIT (1 << LCD_YMINUS_PIN)
+#define LCD_ALL_BITS (LCD_XPLUS_BIT | LCD_YPLUS_BIT | LCD_XMINUS_BIT | LCD_YMINUS_BIT)
+
+/* Conversions are performed as 10-bit samples represented as 16-bit unsigned integers: */
+
+#define MAX_ADC (1023)
+
+/* A measured value has to be within this range to be considered */
+
+#define UPPER_THRESHOLD (MAX_ADC-1)
+#define LOWER_THRESHOLD (1)
+
+/* Delays ***************************************************************************/
+/* All values will be increased by one system timer tick (probably 10MS). */
+
+#define TC_PENUP_POLL_TICKS (100 / MSEC_PER_TICK) /* IDLE polling rate: 100 MSec */
+#define TC_PENDOWN_POLL_TICKS (60 / MSEC_PER_TICK) /* Active polling rate: 60 MSec */
+#define TC_DEBOUNCE_TICKS (30 / MSEC_PER_TICK) /* Delay before re-sampling: 30 MSec */
+#define TC_SAMPLE_TICKS (4 / MSEC_PER_TICK) /* Delay for A/D sampling: 4 MSec */
+#define TC_RESAMPLE_TICKS TC_SAMPLE_TICKS
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This enumeration describes the state of touchscreen state machine */
+
+enum tc_state_e
+{
+ TC_READY = 0, /* Ready to begin next sample */
+ TC_YMPENDOWN, /* Allowing time for the Y- pen down sampling */
+ TC_DEBOUNCE, /* Allowing a debounce time for the first sample */
+ TC_RESAMPLE, /* Restart sampling on a bad measurement */
+ TC_YMSAMPLE, /* Allowing time for the Y- sampling */
+ TC_YPSAMPLE, /* Allowing time for the Y+ sampling */
+ TC_XPSAMPLE, /* Allowing time for the X+ sampling */
+ TC_XMSAMPLE, /* Allowing time for the X- sampling */
+ TC_PENDOWN, /* Conversion is complete -- pen down */
+ TC_PENUP /* Conversion is complete -- pen up */
+};
+
+/* This describes the state of one contact */
+
+enum tc_contact_e
+{
+ CONTACT_NONE = 0, /* No contact */
+ CONTACT_DOWN, /* First contact */
+ CONTACT_MOVE, /* Same contact, possibly different position */
+ CONTACT_UP, /* Contact lost */
+};
+
+/* This structure describes the results of one touchscreen sample */
+
+struct tc_sample_s
+{
+ uint8_t id; /* Sampled touch point ID */
+ uint8_t contact; /* Contact state (see enum tc_contact_e) */
+ bool valid; /* True: x,y contain valid, sampled data */
+ uint16_t x; /* Thresholded X position */
+ uint16_t y; /* Thresholded Y position */
+};
+
+/* This structure describes the state of one touchscreen driver instance */
+
+struct tc_dev_s
+{
+#ifdef CONFIG_TOUCHSCREEN_REFCNT
+ uint8_t crefs; /* Number of times the device has been opened */
+#endif
+ uint8_t state; /* See enum tc_state_e */
+ uint8_t nwaiters; /* Number of threads waiting for touchscreen data */
+ uint8_t id; /* Current touch point ID */
+ volatile bool penchange; /* An unreported event is buffered */
+ uint16_t value; /* Partial sample value (Y+ or X-) */
+ uint16_t newy; /* New, un-thresholded Y value */
+ sem_t devsem; /* Manages exclusive access to this structure */
+ sem_t waitsem; /* Used to wait for the availability of data */
+ struct tc_sample_s sample; /* Last sampled touch point data */
+ struct work_s work; /* Supports the state machine delayed processing */
+
+ /* The following is a list if poll structures of threads waiting for
+ * driver events. The 'struct pollfd' reference for each open is also
+ * retained in the f_priv field of the 'struct file'.
+ */
+
+#ifndef CONFIG_DISABLE_POLL
+ struct pollfd *fds[CONFIG_TOUCHSCREEN_NPOLLWAITERS];
+#endif
+};
+
+/************************************************************************************
+ * Private Function Prototypes
+ ************************************************************************************/
+
+static void tc_adc_sample(int pin);
+static uint16_t tc_adc_convert(void);
+static void tc_yminus_sample(void);
+static void tc_yplus_sample(void);
+static void tc_xplus_sample(void);
+static void tc_xminus_sample(void);
+static inline bool tc_valid_sample(uint16_t sample);
+
+static void tc_notify(FAR struct tc_dev_s *priv);
+static int tc_sample(FAR struct tc_dev_s *priv,
+ FAR struct tc_sample_s *sample);
+static int tc_waitsample(FAR struct tc_dev_s *priv,
+ FAR struct tc_sample_s *sample);
+static void tc_worker(FAR void *arg);
+
+/* Character driver methods */
+
+static int tc_open(FAR struct file *filep);
+static int tc_close(FAR struct file *filep);
+static ssize_t tc_read(FAR struct file *filep, FAR char *buffer, size_t len);
+static int tc_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+#ifndef CONFIG_DISABLE_POLL
+static int tc_poll(FAR struct file *filep, struct pollfd *fds, bool setup);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This the the vtable that supports the character driver interface */
+
+static const struct file_operations tc_fops =
+{
+ tc_open, /* open */
+ tc_close, /* close */
+ tc_read, /* read */
+ 0, /* write */
+ 0, /* seek */
+ tc_ioctl /* ioctl */
+#ifndef CONFIG_DISABLE_POLL
+ , tc_poll /* poll */
+#endif
+};
+
+/* If only a single touchscreen device is supported, then the driver state
+ * structure may as well be pre-allocated.
+ */
+
+#ifndef CONFIG_TOUCHSCREEN_MULTIPLE
+static struct tc_dev_s g_touchscreen;
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+/************************************************************************************
+ * Name: tc_adc_sample
+ *
+ * Description:
+ * Perform A/D sampling. Time must be allowed betwen the start of sampling
+ * and conversion (approx. 100Ms).
+ *
+ ************************************************************************************/
+
+static void tc_adc_sample(int pin)
+{
+ /* Configure the pins for as an analog input. AD1PCFG specifies the
+ * configuration of device pins to be used as analog inputs. A pin
+ * is configured as an analog input when the corresponding PCFGn bit
+ * is 0.
+ */
+
+ putreg32(ADC_CFG(pin), PIC32MX_ADC_CFGCLR);
+
+ /* Set SAMP=0, format 16-bit unsigned integer, manual conversion,
+ * SAMP=1 will trigger.
+ */
+
+ putreg32(0, PIC32MX_ADC_CON1);
+
+ /* Select the pin as the MUXA CH0 input (positive) */
+
+ putreg32(ADC_CHS_CH0SA(pin), PIC32MX_ADC_CHS);
+
+ /* No input scan */
+
+ putreg32(0, PIC32MX_ADC_CSSL);
+
+ /* Manual sample, TAD = internal, 6 TPB */
+
+ putreg32(ADC_CON3_ADCS(6) | ADC_CON3_SAMC(0), PIC32MX_ADC_CON3);
+
+ /* No interrrupts, no scan, internal voltage reference */
+
+ putreg32(ADC_CON2_VCFG_AVDDAVSS, PIC32MX_ADC_CON2);
+
+ /* Turn on the ADC */
+
+ putreg32(ADC_CON1_ON, PIC32MX_ADC_CON1SET);
+
+ /* Start sampling */
+
+ putreg32(ADC_CON1_SAMP, PIC32MX_ADC_CON1SET);
+}
+
+/************************************************************************************
+ * Name: tc_adc_convert
+ *
+ * Description:
+ * Begin A/D conversion. Time must be allowed betwen the start of sampling
+ * and conversion (approx. 100Ms).
+ *
+ * Assumptions:
+ * 1) All output pins configured as outputs:
+ * 2) Approprite pins are driven high and low
+ *
+ ************************************************************************************/
+
+static uint16_t tc_adc_convert(void)
+{
+ uint32_t retval;
+
+ /* Start conversion */
+
+ putreg32(ADC_CON1_SAMP, PIC32MX_ADC_CON1CLR);
+
+ /* Wait for the conversion to complete */
+
+ while ((getreg32(PIC32MX_ADC_CON1) & ADC_CON1_DONE) == 0);
+
+ /* Then read the converted ADC value */
+
+ retval = getreg32(PIC32MX_ADC_BUF0);
+
+ /* Disable the ADC */
+
+ putreg32(ADC_CON1_ON, PIC32MX_ADC_CON1CLR);
+
+ /* Reset all pins to digital function */
+
+ putreg32(LCD_ALL_BITS, PIC32MX_ADC_CFGSET);
+ return (uint16_t)retval;
+}
+
+/************************************************************************************
+ * Name: tc_yminus_sample
+ *
+ * Description:
+ * Initiate sampling on Y-
+ *
+ ************************************************************************************/
+
+static void tc_yminus_sample(void)
+{
+ /* Configure X- as an input and X+, Y+, and Y- as outputs */
+
+ putreg32(LCD_XPLUS_BIT | LCD_YPLUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISCLR);
+ putreg32(LCD_XMINUS_BIT, PIC32MX_IOPORTB_TRISSET);
+
+ /* Energize the X plate: Y+ and Y- high, X+ low */
+
+ putreg32(LCD_XPLUS_BIT, PIC32MX_IOPORTB_PORTCLR);
+ putreg32(LCD_YPLUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_PORTSET);
+
+ /* Start the Y axis sampling */
+
+ tc_adc_sample(LCD_XMINUS_PIN);
+}
+
+/************************************************************************************
+ * Name: tc_yplus_sample
+ *
+ * Description:
+ * Initiate sampling on Y+
+ *
+ ************************************************************************************/
+
+static void tc_yplus_sample(void)
+{
+ /* Configure X+ as an input and X-, Y+, and Y- as outputs */
+
+ putreg32(LCD_XMINUS_BIT | LCD_YPLUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISCLR);
+ putreg32(LCD_XPLUS_BIT, PIC32MX_IOPORTB_TRISSET);
+
+ /* Energize the X plate: Y+ and Y- High, X- low (X+ is an input) */
+
+ putreg32(LCD_XMINUS_BIT, PIC32MX_IOPORTB_PORTCLR);
+ putreg32(LCD_YPLUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_PORTSET);
+
+ /* Start the Y axis sampling */
+
+ tc_adc_sample(LCD_XPLUS_PIN);
+}
+
+/************************************************************************************
+ * Name: tc_xplus_sample
+ *
+ * Description:
+ * Initiate sampling on X+
+ *
+ ************************************************************************************/
+
+static void tc_xplus_sample(void)
+{
+ /* Configure Y+ as an input and X+, X-, and Y- as outputs */
+
+ putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT | LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISCLR);
+ putreg32(LCD_YPLUS_BIT, PIC32MX_IOPORTB_TRISSET);
+
+ /* Energize the Y plate: X+ and X- high, Y- low (Y+ is an input) */
+
+ putreg32(LCD_YMINUS_BIT, PIC32MX_IOPORTB_PORTCLR);
+ putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT, PIC32MX_IOPORTB_PORTSET);
+
+ /* Read the X axis value */
+
+ tc_adc_sample(LCD_YPLUS_PIN);
+}
+
+/************************************************************************************
+ * Name: tc_xminus_sample
+ *
+ * Description:
+ * Initiate sampling on X-
+ *
+ ************************************************************************************/
+
+static void tc_xminus_sample(void)
+{
+ /* Configure Y- as an input and X+, Y+, and X- as outputs */
+
+ putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT | LCD_YPLUS_BIT, PIC32MX_IOPORTB_TRISCLR);
+ putreg32(LCD_YMINUS_BIT, PIC32MX_IOPORTB_TRISSET);
+
+ /* Energize the Y plate: X+ and X- high, Y+ low (Y- is an input) */
+
+ putreg32(LCD_YPLUS_BIT, PIC32MX_IOPORTB_PORTCLR);
+ putreg32(LCD_XPLUS_BIT | LCD_XMINUS_BIT, PIC32MX_IOPORTB_PORTSET);
+
+ /* Start X axis sampling */
+
+ tc_adc_sample(LCD_YMINUS_PIN);
+}
+
+/****************************************************************************
+ * Name: tc_valid_sample
+ ****************************************************************************/
+
+static inline bool tc_valid_sample(uint16_t sample)
+{
+ return (sample > LOWER_THRESHOLD /* && sample < UPPER_THRESHOLD */);
+}
+
+/****************************************************************************
+ * Name: tc_notify
+ ****************************************************************************/
+
+static void tc_notify(FAR struct tc_dev_s *priv)
+{
+#ifndef CONFIG_DISABLE_POLL
+ int i;
+#endif
+
+ /* If there are threads waiting for read data, then signal one of them
+ * that the read data is available.
+ */
+
+ if (priv->nwaiters > 0)
+ {
+ /* After posting this semaphore, we need to exit because the touchscreen
+ * is no longer available.
+ */
+
+ sem_post(&priv->waitsem);
+ }
+
+ /* If there are threads waiting on poll() for touchscreen data to become available,
+ * then wake them up now. NOTE: we wake up all waiting threads because we
+ * do not know that they are going to do. If they all try to read the data,
+ * then some make end up blocking after all.
+ */
+
+#ifndef CONFIG_DISABLE_POLL
+ for (i = 0; i < CONFIG_TOUCHSCREEN_NPOLLWAITERS; i++)
+ {
+ struct pollfd *fds = priv->fds[i];
+ if (fds)
+ {
+ fds->revents |= POLLIN;
+ ivdbg("Report events: %02x\n", fds->revents);
+ sem_post(fds->sem);
+ }
+ }
+#endif
+}
+
+/****************************************************************************
+ * Name: tc_sample
+ *
+ * Assumptions: pre-emption is disabled
+ *
+ ****************************************************************************/
+
+static int tc_sample(FAR struct tc_dev_s *priv,
+ FAR struct tc_sample_s *sample)
+{
+ int ret = -EAGAIN;
+
+ /* Is there new touchscreen sample data available? */
+
+ if (priv->penchange)
+ {
+ /* Yes.. the state has changed in some way. Return a copy of the
+ * sampled data.
+ */
+
+ memcpy(sample, &priv->sample, sizeof(struct tc_sample_s ));
+
+ /* Now manage state transitions */
+
+ if (sample->contact == CONTACT_UP)
+ {
+ /* Next.. no contact. Increment the ID so that next contact ID
+ * will be unique. X/Y positions are no longer valid.
+ */
+
+ priv->sample.contact = CONTACT_NONE;
+ priv->sample.valid = false;
+ priv->id++;
+ }
+ else if (sample->contact == CONTACT_DOWN)
+ {
+ /* First report -- next report will be a movement */
+
+ priv->sample.contact = CONTACT_MOVE;
+ }
+
+ priv->penchange = false;
+ ret = OK;
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: tc_waitsample
+ ****************************************************************************/
+
+static int tc_waitsample(FAR struct tc_dev_s *priv,
+ FAR struct tc_sample_s *sample)
+{
+ int ret;
+
+ /* Pre-emption must be disabled when this is called to to prevent sampled
+ * data from changing until it has been reported.
+ */
+
+ sched_lock();
+
+ /* Now release the semaphore that manages mutually exclusive access to
+ * the device structure. This may cause other tasks to become ready to
+ * run, but they cannot run yet because pre-emption is disabled.
+ */
+
+ sem_post(&priv->devsem);
+
+ /* Try to get the a sample... if we cannot, then wait on the semaphore
+ * that is posted when new sample data is availble.
+ */
+
+ while (tc_sample(priv, sample) < 0)
+ {
+ /* Wait for a change in the touchscreen state */
+
+ priv->nwaiters++;
+ ret = sem_wait(&priv->waitsem);
+ priv->nwaiters--;
+
+ if (ret < 0)
+ {
+ /* If we are awakened by a signal, then we need to return
+ * the failure now.
+ */
+
+ DEBUGASSERT(errno == EINTR);
+ ret = -EINTR;
+ goto errout;
+ }
+ }
+
+ /* Re-acquire the the semaphore that manages mutually exclusive access to
+ * the device structure. We may have to wait here. But we have our sample.
+ * Interrupts and pre-emption will be re-enabled while we wait.
+ */
+
+ ret = sem_wait(&priv->devsem);
+
+errout:
+ /* Restore pre-emption. We might get suspended here but that is okay
+ * because we already have our sample. Note: this means that if there
+ * were two threads reading from the touchscreen for some reason, the data
+ * might be read out of order.
+ */
+
+ sched_unlock();
+ return ret;
+}
+
+/****************************************************************************
+ * Name: tc_worker
+ ****************************************************************************/
+
+static void tc_worker(FAR void *arg)
+{
+ FAR struct tc_dev_s *priv = (FAR struct tc_dev_s *)arg;
+ uint32_t delay;
+ uint16_t value;
+ uint16_t newx;
+ int16_t xdiff;
+ int16_t ydiff;
+ int ret;
+
+ ASSERT(priv != NULL);
+
+ /* Perform the next action based on the state of the conversions */
+
+ switch (priv->state)
+ {
+ /* The touchscreen is IDLE and we are ready to begin the next sample */
+
+ case TC_READY:
+ {
+ /* Start Y- sampling */
+
+ tc_yminus_sample();
+
+ /* Allow time for the Y- pend down sampling */
+
+ priv->state = TC_YMPENDOWN;
+ delay = TC_SAMPLE_TICKS;
+ }
+ break;
+
+ /* The Y- sampling time has elapsed and the Y- value should be ready
+ * for conversion
+ */
+
+ case TC_YMPENDOWN:
+ {
+ /* Convert the Y- sample value */
+
+ value = tc_adc_convert();
+
+ /* A converted value at the minimum would mean that there is no touch
+ * and that the sampling period is complete.
+ */
+
+ if (!tc_valid_sample(value))
+ {
+ priv->state = TC_PENUP;
+ }
+ else
+ {
+ /* Allow time for touch inputs to stabilize */
+
+ priv->state = TC_DEBOUNCE;
+ delay = TC_DEBOUNCE_TICKS;
+ }
+ }
+ break;
+
+ /* The debounce time period has elapsed and we are ready to re-sample
+ * the touchscreen.
+ */
+
+ case TC_RESAMPLE:
+ case TC_DEBOUNCE:
+ {
+ /* (Re-)start Y- sampling */
+
+ tc_yminus_sample();
+
+ /* Allow time for the Y- sampling */
+
+ priv->state = TC_YMSAMPLE;
+ delay = TC_SAMPLE_TICKS;
+ }
+ break;
+
+ /* The Y- sampling period has elapsed and we are ready to perform the
+ * conversion.
+ */
+
+ case TC_YMSAMPLE:
+ {
+ /* Convert and save the Y- sample value */
+
+ value = tc_adc_convert();
+
+ /* A converted value at the minimum would mean that there is no touch
+ * and that the sampling period is complete. At converted value at
+ * the maximum value is probably bad too.
+ */
+
+ if (!tc_valid_sample(value))
+ {
+ priv->state = TC_PENUP;
+ }
+ else
+ {
+ /* Save the Y- sample and start Y+ sampling */
+
+ priv->value = value;
+ tc_yplus_sample();
+
+ /* Allow time for the Y+ sampling */
+
+ priv->state = TC_YPSAMPLE;
+ delay = TC_SAMPLE_TICKS;
+ }
+ }
+ break;
+
+ /* The Y+ sampling period has elapsed and we are ready to perform the
+ * conversion.
+ */
+
+ case TC_YPSAMPLE: /* Allowing time for the Y+ sampling */
+ {
+ /* Read the Y+ axis position */
+
+ value = tc_adc_convert();
+
+ /* A converted value at the minimum would mean that we lost the contact
+ * before all of the conversions were completed. At converted value at
+ * the maximum value is probably bad too.
+ */
+
+ if (!tc_valid_sample(value))
+ {
+#ifdef CONFIG_TOUCHSCREEN_RESAMPLE
+ priv->state = TC_RESAMPLE;
+ delay = TC_RESAMPLE_TICKS;
+#else
+ priv->state = TC_PENUP;
+#endif
+ }
+ else
+ {
+ value = MAX_ADC - value;
+ priv->newy = (value + priv->value) >> 1;
+ ivdbg("Y-=%d Y+=%d[%d] Y=%d\n", priv->value, value, MAX_ADC - value, priv->newy);
+
+ /* Start X+ sampling */
+
+ tc_xplus_sample();
+
+ /* Allow time for the X+ sampling */
+
+ priv->state = TC_XPSAMPLE;
+ delay = TC_SAMPLE_TICKS;
+ }
+ }
+ break;
+
+ /* The X+ sampling period has elapsed and we are ready to perform the
+ * conversion.
+ */
+
+ case TC_XPSAMPLE:
+ {
+ /* Convert the X+ sample value */
+
+ value = tc_adc_convert();
+
+ /* A converted value at the minimum would mean that we lost the contact
+ * before all of the conversions were completed. At converted value at
+ * the maximum value is probably bad too.
+ */
+
+ if (!tc_valid_sample(value))
+ {
+#ifdef CONFIG_TOUCHSCREEN_RESAMPLE
+ priv->state = TC_RESAMPLE;
+ delay = TC_RESAMPLE_TICKS;
+#else
+ priv->state = TC_PENUP;
+#endif
+ }
+ else
+ {
+ /* Save the X+ sample value */
+
+ priv->value = value;
+
+ /* Start X- sampling */
+
+ tc_xminus_sample();
+
+ /* Allow time for the X- pend down sampling */
+
+ priv->state = TC_XMSAMPLE;
+ delay = TC_SAMPLE_TICKS;
+ }
+ }
+ break;
+
+ /* The X+ sampling period has elapsed and we are ready to perform the
+ * conversion.
+ */
+
+ case TC_XMSAMPLE: /* Allowing time for the X- sampling */
+ {
+ /* Read the converted X- axis position */
+
+ value = tc_adc_convert();
+
+ /* A converted value at the minimum would mean that we lost the contact
+ * before all of the conversions were completed. At converted value at
+ * the maximum value is probably bad too.
+ */
+
+ if (!tc_valid_sample(value))
+ {
+#ifdef CONFIG_TOUCHSCREEN_RESAMPLE
+ priv->state = TC_RESAMPLE;
+ delay = TC_RESAMPLE_TICKS;
+#else
+ priv->state = TC_PENUP;
+#endif
+ }
+ else
+ {
+ /* Calculate the X- axis position */
+
+ value = MAX_ADC - value;
+ newx = (value + priv->value) >> 1;
+ ivdbg("X+=%d X-=%d[%d] X=%d\n", priv->value, value, MAX_ADC - value, newx);
+
+ /* Samples are available */
+
+ priv->state = TC_PENDOWN;
+ }
+ }
+ break;
+ }
+
+ /* Check for terminal conditions.. */
+
+ /* Check if the sampling resulted in a pen up decision. If so, we need to
+ * handle the change from pen down to pen up.
+ */
+
+ if (priv->state == TC_PENUP)
+ {
+ /* Ignore if the pen was already down (CONTACT_NONE == pen up and already
+ * reported. CONTACT_UP == pen up, but not reported)
+ */
+
+ if (priv->sample.contact != CONTACT_NONE)
+ {
+ /* The pen is up. We know from the above test, that this is a
+ * loss of contact condition. This will be changed to CONTACT_NONE
+ * after the loss of contact is sampled.
+ */
+
+ priv->sample.contact = CONTACT_UP;
+
+ /* Indicate the availability of new sample data for this ID */
+
+ priv->sample.id = priv->id;
+ priv->penchange = true;
+
+ /* Notify any waiters that nes touchscreen data is available */
+
+ tc_notify(priv);
+ }
+
+ /* Set up for the next poll */
+
+ priv->sample.valid = false;
+ priv->state = TC_READY;
+ delay = TC_PENUP_POLL_TICKS;
+ }
+
+ /* Check if the sampling resulted in a pen down decision. */
+
+ else if (priv->state == TC_PENDOWN)
+ {
+ /* It is a pen down event. If the last loss-of-contact event has not been
+ * processed yet, then we have to ignore the pen down event (or else it will
+ * look like a drag event)
+ */
+
+ if (priv->sample.contact != CONTACT_UP)
+ {
+ /* Perform a thresholding operation so that the results will be more stable.
+ * If the difference from the last sample is small, then ignore the event.
+ */
+
+ xdiff = (int16_t)priv->sample.x - (int16_t)newx;
+ if (xdiff < 0)
+ {
+ xdiff = -xdiff;
+ }
+
+ ydiff = (int16_t)priv->sample.y - (int16_t)priv->newy;
+ if (ydiff < 0)
+ {
+ ydiff = -ydiff;
+ }
+
+ if (xdiff >= CONFIG_TOUCHSCREEN_THRESHX ||
+ ydiff >= CONFIG_TOUCHSCREEN_THRESHY)
+ {
+ /* There is some change above the threshold... Report the change. */
+
+ priv->sample.x = newx;
+ priv->sample.y = priv->newy;
+ priv->sample.valid = true;
+
+ /* If this is the first (acknowledged) penddown report, then report
+ * this as the first contact. If contact == CONTACT_DOWN, it will be
+ * set to set to CONTACT_MOVE after the contact is first sampled.
+ */
+
+ if (priv->sample.contact != CONTACT_MOVE)
+ {
+ /* First contact */
+
+ priv->sample.contact = CONTACT_DOWN;
+ }
+
+ /* Indicate the availability of new sample data for this ID */
+
+ priv->sample.id = priv->id;
+ priv->penchange = true;
+
+ /* Notify any waiters that nes touchscreen data is available */
+
+ tc_notify(priv);
+ }
+ }
+
+ /* Set up for the next poll */
+
+ priv->state = TC_READY;
+ delay = TC_PENDOWN_POLL_TICKS;
+ }
+
+ /* Set up the next sample event */
+
+ ret = work_queue(HPWORK, &priv->work, tc_worker, priv, delay);
+ ASSERT(ret == 0);
+}
+
+/****************************************************************************
+ * Name: tc_open
+ ****************************************************************************/
+
+static int tc_open(FAR struct file *filep)
+{
+#ifdef CONFIG_TOUCHSCREEN_REFCNT
+ FAR struct inode *inode;
+ FAR struct tc_dev_s *priv;
+ uint8_t tmp;
+ int ret;
+
+ DEBUGASSERT(filep);
+ inode = filep->f_inode;
+
+ DEBUGASSERT(inode && inode->i_private);
+ priv = (FAR struct tc_dev_s *)inode->i_private;
+
+ /* Get exclusive access to the driver data structure */
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ /* This should only happen if the wait was canceled by an signal */
+
+ DEBUGASSERT(errno == EINTR);
+ return -EINTR;
+ }
+
+ /* Increment the reference count */
+
+ tmp = priv->crefs + 1;
+ if (tmp == 0)
+ {
+ /* More than 255 opens; uint8_t overflows to zero */
+
+ ret = -EMFILE;
+ goto errout_with_sem;
+ }
+
+ /* When the reference increments to 1, this is the first open event
+ * on the driver.. and an opportunity to do any one-time initialization.
+ */
+
+ /* Save the new open count on success */
+
+ priv->crefs = tmp;
+
+errout_with_sem:
+ sem_post(&priv->devsem);
+ return ret;
+#else
+ return OK;
+#endif
+}
+
+/****************************************************************************
+ * Name: tc_close
+ ****************************************************************************/
+
+static int tc_close(FAR struct file *filep)
+{
+#ifdef CONFIG_TOUCHSCREEN_REFCNT
+ FAR struct inode *inode;
+ FAR struct tc_dev_s *priv;
+ int ret;
+
+ DEBUGASSERT(filep);
+ inode = filep->f_inode;
+
+ DEBUGASSERT(inode && inode->i_private);
+ priv = (FAR struct tc_dev_s *)inode->i_private;
+
+ /* Get exclusive access to the driver data structure */
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ /* This should only happen if the wait was canceled by an signal */
+
+ DEBUGASSERT(errno == EINTR);
+ return -EINTR;
+ }
+
+ /* Decrement the reference count unless it would decrement a negative
+ * value. When the count decrements to zero, there are no further
+ * open references to the driver.
+ */
+
+ if (priv->crefs >= 1)
+ {
+ priv->crefs--;
+ }
+
+ sem_post(&priv->devsem);
+#endif
+ return OK;
+}
+
+/****************************************************************************
+ * Name: tc_read
+ ****************************************************************************/
+
+static ssize_t tc_read(FAR struct file *filep, FAR char *buffer, size_t len)
+{
+ FAR struct inode *inode;
+ FAR struct tc_dev_s *priv;
+ FAR struct touch_sample_s *report;
+ struct tc_sample_s sample;
+ int ret;
+
+ DEBUGASSERT(filep);
+ inode = filep->f_inode;
+
+ DEBUGASSERT(inode && inode->i_private);
+ priv = (FAR struct tc_dev_s *)inode->i_private;
+
+ /* Verify that the caller has provided a buffer large enough to receive
+ * the touch data.
+ */
+
+ if (len < SIZEOF_TOUCH_SAMPLE_S(1))
+ {
+ /* We could provide logic to break up a touch report into segments and
+ * handle smaller reads... but why?
+ */
+
+ return -ENOSYS;
+ }
+
+ /* Get exclusive access to the driver data structure */
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ /* This should only happen if the wait was canceled by an signal */
+
+ DEBUGASSERT(errno == EINTR);
+ return -EINTR;
+ }
+
+ /* Try to read sample data. */
+
+ ret = tc_sample(priv, &sample);
+ if (ret < 0)
+ {
+ /* Sample data is not available now. We would ave to wait to get
+ * receive sample data. If the user has specified the O_NONBLOCK
+ * option, then just return an error.
+ */
+
+ if (filep->f_oflags & O_NONBLOCK)
+ {
+ ret = -EAGAIN;
+ goto errout;
+ }
+
+ /* Wait for sample data */
+
+ ret = tc_waitsample(priv, &sample);
+ if (ret < 0)
+ {
+ /* We might have been awakened by a signal */
+
+ goto errout;
+ }
+ }
+
+ /* In any event, we now have sampled touchscreen data that we can report
+ * to the caller.
+ */
+
+ report = (FAR struct touch_sample_s *)buffer;
+ memset(report, 0, SIZEOF_TOUCH_SAMPLE_S(1));
+ report->npoints = 1;
+ report->point[0].id = sample.id;
+ report->point[0].x = sample.x;
+ report->point[0].y = sample.y;
+
+ /* Report the appropriate flags */
+
+ if (sample.contact == CONTACT_UP)
+ {
+ /* Pen is now up. Is the positional data valid? This is important to
+ * know because the release will be sent to the window based on its
+ * last positional data.
+ */
+
+ if (sample.valid)
+ {
+ report->point[0].flags = TOUCH_UP | TOUCH_ID_VALID |
+ TOUCH_POS_VALID | TOUCH_PRESSURE_VALID;
+ }
+ else
+ {
+ report->point[0].flags = TOUCH_UP | TOUCH_ID_VALID;
+ }
+ }
+ else
+ {
+ if (sample.contact == CONTACT_DOWN)
+ {
+ /* First contact */
+
+ report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID | TOUCH_POS_VALID;
+ }
+ else /* if (sample->contact == CONTACT_MOVE) */
+ {
+ /* Movement of the same contact */
+
+ report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID | TOUCH_POS_VALID;
+ }
+ }
+
+ ret = SIZEOF_TOUCH_SAMPLE_S(1);
+
+errout:
+ sem_post(&priv->devsem);
+ return ret;
+}
+
+/****************************************************************************
+ * Name:tc_ioctl
+ ****************************************************************************/
+
+static int tc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+{
+#if 1
+ ivdbg("cmd: %d arg: %ld\n", cmd, arg);
+ return -ENOTTY; /* None yet supported */
+#else
+ FAR struct inode *inode;
+ FAR struct tc_dev_s *priv;
+ int ret;
+
+ ivdbg("cmd: %d arg: %ld\n", cmd, arg);
+ DEBUGASSERT(filep);
+ inode = filep->f_inode;
+
+ DEBUGASSERT(inode && inode->i_private);
+ priv = (FAR struct tc_dev_s *)inode->i_private;
+
+ /* Get exclusive access to the driver data structure */
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ /* This should only happen if the wait was canceled by an signal */
+
+ DEBUGASSERT(errno == EINTR);
+ return -EINTR;
+ }
+
+ /* Process the IOCTL by command */
+
+ switch (cmd)
+ {
+ /* ADD IOCTL COMMAND CASES HERE */
+
+ default:
+ ret = -ENOTTY;
+ break;
+ }
+
+ sem_post(&priv->devsem);
+ return ret;
+#endif
+}
+
+/****************************************************************************
+ * Name: tc_poll
+ ****************************************************************************/
+
+#ifndef CONFIG_DISABLE_POLL
+static int tc_poll(FAR struct file *filep, FAR struct pollfd *fds,
+ bool setup)
+{
+ FAR struct inode *inode;
+ FAR struct tc_dev_s *priv;
+ int ret;
+ int i;
+
+ ivdbg("setup: %d\n", (int)setup);
+ DEBUGASSERT(filep && fds);
+ inode = filep->f_inode;
+
+ DEBUGASSERT(inode && inode->i_private);
+ priv = (FAR struct tc_dev_s *)inode->i_private;
+
+ /* Are we setting up the poll? Or tearing it down? */
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ /* This should only happen if the wait was canceled by an signal */
+
+ DEBUGASSERT(errno == EINTR);
+ return -EINTR;
+ }
+
+ if (setup)
+ {
+ /* Ignore waits that do not include POLLIN */
+
+ if ((fds->events & POLLIN) == 0)
+ {
+ idbg("Missing POLLIN: revents: %08x\n", fds->revents);
+ ret = -EDEADLK;
+ goto errout;
+ }
+
+ /* This is a request to set up the poll. Find an available
+ * slot for the poll structure reference
+ */
+
+ for (i = 0; i < CONFIG_TOUCHSCREEN_NPOLLWAITERS; i++)
+ {
+ /* Find an available slot */
+
+ if (!priv->fds[i])
+ {
+ /* Bind the poll structure and this slot */
+
+ priv->fds[i] = fds;
+ fds->priv = &priv->fds[i];
+ break;
+ }
+ }
+
+ if (i >= CONFIG_TOUCHSCREEN_NPOLLWAITERS)
+ {
+ idbg("No availabled slot found: %d\n", i);
+ fds->priv = NULL;
+ ret = -EBUSY;
+ goto errout;
+ }
+
+ /* Should we immediately notify on any of the requested events? */
+
+ if (priv->penchange)
+ {
+ tc_notify(priv);
+ }
+ }
+ else if (fds->priv)
+ {
+ /* This is a request to tear down the poll. */
+
+ struct pollfd **slot = (struct pollfd **)fds->priv;
+ DEBUGASSERT(slot != NULL);
+
+ /* Remove all memory of the poll setup */
+
+ *slot = NULL;
+ fds->priv = NULL;
+ }
+
+errout:
+ sem_post(&priv->devsem);
+ return ret;
+}
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: arch_tcinitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * configure the touchscreen device. This function will register the driver
+ * as /dev/inputN where N is the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int arch_tcinitialize(int minor)
+{
+ FAR struct tc_dev_s *priv;
+ char devname[DEV_NAMELEN];
+#ifdef CONFIG_TOUCHSCREEN_MULTIPLE
+ irqstate_t flags;
+#endif
+ int ret;
+
+ ivdbg("minor: %d\n", minor);
+ DEBUGASSERT(minor >= 0 && minor < 100);
+
+ /* Configure all touchscreen pins as inputs, undriven */
+
+ putreg32(LCD_ALL_BITS, PIC32MX_IOPORTB_TRISSET);
+
+ /* Configure all pins for as digital. AD1PCFG specifies the configuration
+ * of device pins to be used as analog inputs. A pin is configured as an
+ * analog input when the corresponding PCFGn bit is 0.
+ */
+
+ putreg32(LCD_ALL_BITS, PIC32MX_ADC_CFGSET);
+
+ /* Create and initialize a touchscreen device driver instance */
+
+#ifndef CONFIG_TOUCHSCREEN_MULTIPLE
+ priv = &g_touchscreen;
+#else
+ priv = (FAR struct tc_dev_s *)kmalloc(sizeof(struct tc_dev_s));
+ if (!priv)
+ {
+ idbg("kmalloc(%d) failed\n", sizeof(struct tc_dev_s));
+ return -ENOMEM;
+ }
+#endif
+
+ /* Initialize the touchscreen device driver instance */
+
+ memset(priv, 0, sizeof(struct tc_dev_s));
+ sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */
+ sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
+
+ /* Register the device as an input device */
+
+ (void)snprintf(devname, DEV_NAMELEN, DEV_FORMAT, minor);
+ ivdbg("Registering %s\n", devname);
+
+ ret = register_driver(devname, &tc_fops, 0666, priv);
+ if (ret < 0)
+ {
+ idbg("register_driver() failed: %d\n", ret);
+ goto errout_with_priv;
+ }
+
+ /* Schedule work to perform the initial sampling and to set the data
+ * availability conditions.
+ */
+
+ priv->state = TC_READY;
+ ret = work_queue(HPWORK, &priv->work, tc_worker, priv, 0);
+ if (ret != 0)
+ {
+ idbg("Failed to queue work: %d\n", ret);
+ goto errout_with_priv;
+ }
+
+ /* And return success (?) */
+
+ return OK;
+
+errout_with_priv:
+ sem_destroy(&priv->devsem);
+#ifdef CONFIG_TOUCHSCREEN_MULTIPLE
+ kfree(priv);
+#endif
+ return ret;
+}
+
+/****************************************************************************
+ * Name: arch_tcuninitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * uninitialize the touchscreen device.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None.
+ *
+ ****************************************************************************/
+
+void arch_tcuninitialize(void)
+{
+ /* Need to unregister the /dev/inputN device here. */
+}
+
+#endif /* CONFIG_INPUT */
diff --git a/nuttx/configs/pic32mx7mmb/src/up_usbdev.c b/nuttx/configs/pic32mx7mmb/src/up_usbdev.c
new file mode 100644
index 000000000..5d82f5f65
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_usbdev.c
@@ -0,0 +1,163 @@
+/************************************************************************************
+ * configs/pic32mx7mmb/src/up_usbdev.c
+ * arch/arm/src/board/up_usbdev.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "pic32mx7mmb_internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/*
+ * PIN NAME SIGNAL NOTES
+ * ---- ------------------------------- -------------- ------------------------------
+ * 20 VBUSON/C1IN+/AN5/CN7/RB5 VBUSON To USB VBUS circuitry
+ * 43 C2IN+/AN3/CN5/RB3 USB_PGOOD Power good (low if bad)
+ */
+
+#define GPIO_USB_VBUSON (GPIO_INPUT|GPIO_PORTB|GPIO_PIN5)
+#define GPIO_USB_PGOOD (GPIO_INPUT|GPIO_PORTB|GPIO_PIN3)
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_usbdevinitialize
+ *
+ * Description:
+ * Called to configure the mini-A/B J5 on the Mikroelektronika PIC32MX7 MMB for the
+ * USB device
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_usbdevinitialize(void)
+{
+ /* Connect the PHY to the USB mini-B port. Order and timing matter! */
+
+ pic32mx_configgpio(GPIO_USB_PGOOD);
+
+ /* Notes from the Sure Electronics sample code:
+ *
+ * "The USB specifications require that USB peripheral devices must never source
+ * current onto the Vbus pin. Additionally, USB peripherals should not source
+ * current on D+ or D- when the host/hub is not actively powering the Vbus line.
+ * When designing a self powered (as opposed to bus powered) USB peripheral
+ * device, the firmware should make sure not to turn on the USB module and D+
+ * or D- pull up resistor unless Vbus is actively powered. Therefore, the
+ * firmware needs some means to detect when Vbus is being powered by the host.
+ * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and
+ * can be used to detect when Vbus is high (host actively powering), or low
+ * (host is shut down or otherwise not supplying power). The USB firmware
+ * can then periodically poll this I/O pin to know when it is okay to turn on
+ * the USB module/D+/D- pull up resistor. When designing a purely bus powered
+ * peripheral device, it is not possible to source current on D+ or D- when the
+ * host is not actively providing power on Vbus. Therefore, implementing this
+ * bus sense feature is optional. ..."
+ */
+
+#ifdef CONFIG_USBHOST
+ // pic32mx_configgpio(GPIO_USB_VBUSON);
+#endif
+
+ /* "If the host PC sends a GetStatus (device) request, the firmware must respond
+ * and let the host know if the USB peripheral device is currently bus powered
+ * or self powered. See chapter 9 in the official USB specifications for details
+ * regarding this request. If the peripheral device is capable of being both
+ * self and bus powered, it should not return a hard coded value for this request.
+ * Instead, firmware should check if it is currently self or bus powered, and
+ * respond accordingly. If the hardware has been configured like demonstrated
+ * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the
+ * currently selected power source. ..."
+ */
+
+#ifdef CONFIG_USB_PWRSENSE
+ // pic32mx_configgpio(GPIO_USB_PWRSENSE);
+#endif
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB
+ * software connect and disconnect), then the board software must provide
+ * stm32_pullup. See include/nuttx/usb/usbdev.h for additional description
+ * of this method. Alternatively, if no pull-up GPIO the following EXTERN
+ * can be redefined to be NULL.
+ *
+ ************************************************************************************/
+
+int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ /* The Mikroelektronika PIC32MX7 MMB does not have a USB pull-up */
+
+ return OK;
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver
+ * is used. This function is called whenever the USB enters or leaves
+ * suspend mode. This is an opportunity for the board logic to shutdown
+ * clocks, power, etc. while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ /* Do nothing */
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV */
diff --git a/nuttx/configs/pic32mx7mmb/src/up_usbmsc.c b/nuttx/configs/pic32mx7mmb/src/up_usbmsc.c
new file mode 100644
index 000000000..fbebaa3d1
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_usbmsc.c
@@ -0,0 +1,95 @@
+/****************************************************************************
+ * configs/pic32mx7mmb/src/up_usbmsc.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "pic32mx7mmb_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization as needed to establish
+ * the mass storage device that will be exported by the USB MSC device.
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+# warning "Missing Logic"
+#endif /* CONFIG_EXAMPLES_USBMSC_BUILTIN */
+
+ return 0;
+}
diff --git a/nuttx/configs/pic32mx7mmb/src/up_usbterm.c b/nuttx/configs/pic32mx7mmb/src/up_usbterm.c
new file mode 100644
index 000000000..e9da92be8
--- /dev/null
+++ b/nuttx/configs/pic32mx7mmb/src/up_usbterm.c
@@ -0,0 +1,106 @@
+/************************************************************************************
+ * configs/pic32mx7mmb/src/up_usbterm.c
+ * arch/arm/src/board/up_usbterm.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "pic32mx7mmb_internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV) && defined(CONFIG_EXAMPLES_USBTERM_DEVINIT)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its initialization.
+ *
+ ****************************************************************************/
+
+int usbterm_devinit(void)
+{
+ /* The Mikroelektronika PIC32MX7 MMB has no way to know when the USB is
+ * connected. So we will fake it and tell the USB driver that the USB is
+ * connected now.
+ *
+ * If examples/usbterm is built as an NSH built-in application, then
+ * pic32mx_usbattach() will be called in nsh_archinitialize().
+ */
+
+#ifndef CONFIG_EXAMPLES_USBTERM_BUILTIN
+ pic32mx_usbattach();
+#endif
+ return OK;
+}
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its termination sequence.
+ *
+ ****************************************************************************/
+
+void usbterm_devuninit(void)
+{
+ /* Tell the USB driver that the USB is no longer connected */
+
+ pic32mx_usbdetach();
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV && CONFIG_EXAMPLES_USBTERM_DEVINIT */
diff --git a/nuttx/configs/pjrc-8051/Kconfig b/nuttx/configs/pjrc-8051/Kconfig
new file mode 100644
index 000000000..afa9f6a9f
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_PJRC_87C52
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/pjrc-8051/Make.defs b/nuttx/configs/pjrc-8051/Make.defs
new file mode 100644
index 000000000..b5c86d7f5
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/Make.defs
@@ -0,0 +1,98 @@
+############################################################################
+# configs/pjrc-8051/Make.defs
+#
+# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHCPUFLAGS = -mmcs51 --stack-auto --model-large --int-long-reent --float-reent
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+LD = aslink
+AS = asx8051
+AR = sdcclib -a
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+ASMEXT = .asm
+OBJEXT = .rel
+LIBEXT = .lib
+EXEEXT = .hex
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
+
diff --git a/nuttx/configs/pjrc-8051/README.txt b/nuttx/configs/pjrc-8051/README.txt
new file mode 100644
index 000000000..dae92b59b
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/README.txt
@@ -0,0 +1,37 @@
+pjrc-8051 README
+^^^^^^^^^^^^^^^^
+
+This port uses the PJRC 87C52 development system and the SDCC toolchain.
+
+The PJRC 87C52 development system can be obtained from http://www.pjrc.com/.
+
+The SDCC toolchain is available from http://sdcc.sourceforge.net/. All
+testing has been performed using verison 2.6.0 of the SDDC toolchain.
+
+Building the SDCC toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The SDCC toolchain is built with the standard configure/make/make install
+sequence. However, some special actions are required to generate libraries
+compatible with this build. First start with the usual steps
+
+ download
+ unpack
+ cd sdcc
+ ./configure
+ make
+
+But before installing, we need to apply a patch to the SDCC 2.6.0 source.
+WARNING: This patch is specific to the particular combination of CFLAGS
+that are used in the compilation. If you change Make.defs, then you will
+likely have to change the patch as well.
+
+ Apply sdcc-2.6.0.patch
+ cd sdcc/device/lib
+ make model-mcs51-stack-auto
+
+Then
+
+ cd sdcc
+ make install
+
diff --git a/nuttx/configs/pjrc-8051/appconfig b/nuttx/configs/pjrc-8051/appconfig
new file mode 100644
index 000000000..7beb0d691
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/pjrc-8051/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/pjrc-8051/defconfig b/nuttx/configs/pjrc-8051/defconfig
new file mode 100644
index 000000000..0232376cf
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/defconfig
@@ -0,0 +1,211 @@
+############################################################################
+# configs/pjrc-8051/defconfig
+#
+# Copyright (C) 2007-2011, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="8051"
+CONFIG_ARCH_8051=y
+CONFIG_ARCH_CHIP_8051=n
+CONFIG_ARCH_CHIP_8052=y
+CONFIG_ARCH_BOARD="pjrc-8051"
+CONFIG_ARCH_BOARD_PJRC_87C52=y
+
+#
+# Architecture-specific settings. These may mean nothing to
+# other architectures.
+#
+# CONFIG-ARCH_PJRC - Set if using the PJRC 87C52 board
+#
+CONFIG_ARCH_PJRC=y
+CONFIG_ARCH_LEDS=y
+CONFIG_8052_TIMER2=y
+
+CONFIG_ARCH_BRINGUP=y
+CONFIG_FRAME_DUMP=n
+CONFIG_FRAME_DUMP_SHORT=n
+CONFIG_SUPPRESS_INTERRUPTS=y
+CONFIG_SWITCH_FRAME_DUMP=n
+CONFIG_INTERRUPT_FRAME_DUMP=n
+CONFIG_LED_DEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=y
+CONFIG_IDLETHREAD_STACKSIZE=
+CONFIG_USERMAIN_STACKSIZE=
+CONFIG_PTHREAD_STACK_MIN=
+CONFIG_PTHREAD_STACK_DEFAULT=
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/pjrc-8051/include/README.txt b/nuttx/configs/pjrc-8051/include/README.txt
new file mode 100644
index 000000000..073c155f0
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the PJRC 87C52 development board.
diff --git a/nuttx/configs/pjrc-8051/include/board.h b/nuttx/configs/pjrc-8051/include/board.h
new file mode 100644
index 000000000..9f518f81e
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/include/board.h
@@ -0,0 +1,51 @@
+/************************************************************
+ * board/board.h
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************
+ * Included Files
+ ************************************************************/
+
+/************************************************************
+ * Definitions
+ ************************************************************/
+
+/************************************************************
+ * Inline Functions
+ ************************************************************/
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/pjrc-8051/include/pjrc.h b/nuttx/configs/pjrc-8051/include/pjrc.h
new file mode 100644
index 000000000..9d0d9482a
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/include/pjrc.h
@@ -0,0 +1,215 @@
+/**************************************************************************
+ * pjrc.h
+ *
+ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************/
+
+#ifndef __PJRC_H
+#define __PJRC_H
+
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
+#include <stdint.h>
+
+/**************************************************************************
+ * Public Definitions
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Types
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Variables
+ **************************************************************************/
+
+/* Memory Map
+ *
+ * BEGIN END DESCRIPTION
+ * 0x0000 0x1fff CODE: ROM containg PAULMON2
+ * DATA: RAM for program variables
+ * 0x2000 0x7fff COMMON: RAM for program code or
+ * variables
+ * 0x8000 0xf7ff COMMON: FLASH for program code
+ * 0xf800 0xfeff COMMON: Peripherals
+ * 0xff00 0xffff COMMON: unused
+ *
+ * Program code may be loaded at the RAM location 0x2000-0x7fff
+ * for testing. If loaded into the FLASH location at
+ * 0x8000-0xf7ff, PAULMON2 will automatically write the program
+ * into flash. The program is configured in the RAM-based test
+ * configuration:
+ */
+
+#define RAM_BLOCK_START IRAM_SIZE
+#define RAM_BLOCK_END 0x1fff
+
+#define PROGRAM_BASE 0x2000
+#define PROGRAM_END 0x7fff
+
+#define FLASH_BASE 0x8000
+#define FLASH_END 0xf7ff
+
+/* Well-known entry points to access PAULMON2's built-in functions */
+
+#define PM2_ENTRY_PHEX1 0x002e
+#define PM2_ENTRY_COUT 0x0030
+#define PM2_ENTRY_CIN 0x0032
+#define PM2_ENTRY_PHEX 0x0034
+#define PM2_ENTRY_PHEX16 0x0036
+#define PM2_ENTRY_PSTR 0x0038
+#define PM2_ENTRY_ESC 0x003e
+#define PM2_ENTRY_UPPER 0x0040
+#define PM2_ENTRY_PINT8U 0x004D
+#define PM2_ENTRY_PINT8 0x0050
+#define PM2_ENTRY_PINT16U 0x0053
+#define PM2_ENTRY_NEWLINE 0x0048
+#define PM2_ENTRY_PRGM 0x0059
+#define PM2_ENTRY_ERBLOCK 0x0067
+
+/* PAULMON2 captures all interrupt vectors in ROM but relays them
+ * through the following RAM addresses:
+ */
+
+#define PM2_VECTOR_BASE PROGRAM_BASE
+#define PM2_VECTOR_EXTINT0 (PM2_VECTOR_BASE + 3)
+#define PM2_VECTOR_TIMER0 (PM2_VECTOR_BASE + 11)
+#define PM2_VECTOR_EXTINT1 (PM2_VECTOR_BASE + 19)
+#define PM2_VECTOR_TIMER1 (PM2_VECTOR_BASE + 27)
+#define PM2_VECTOR_UART (PM2_VECTOR_BASE + 35)
+#define PM2_VECTOR_TIMER2 (PM2_VECTOR_BASE + 43)
+
+/* Peripheral Mapping
+ *
+ * Begin End Peripheral Addr Acc Function
+ * F800 F8FF 82C55 (A, B, C) F800 R/W Port A
+ * F801 R/W Port B
+ * F802 R/W Port C
+ * F803 W Config A,B,C
+ * F900 F9FF 82C55 (D, E, F) F900 R/W Port D
+ * F901 R/W Port E (LEDs)
+ * F902 R/W Port F
+ * F903 W Config D,E,F
+ * FA00 FAFF User Expansion
+ * FB00 FBFF User Expansion
+ * FC00 FCFF User Expansion
+ * FD00 FDFF User Expansion
+ * FE00 FEFF LCD Port FE00 W Command Register
+ * FE01 R Status Register
+ * FE02 W Display or CGRAM Buffer
+ * FE03 R " " "" " " " "
+ *
+ * These are the memory-mapped locations used to access the two 82C55
+ * chips
+ */
+
+#ifndef __ASSEMBLY__
+xdata at 0xF800 uint8_t p82c55_port_a;
+xdata at 0xF801 uint8_t p82c55_port_b;
+xdata at 0xF802 uint8_t p82c55_port_c;
+xdata at 0xF803 uint8_t p82c55_abc_config;
+xdata at 0xF900 uint8_t p82c55_port_d;
+xdata at 0xF901 uint8_t p82c55_port_e;
+xdata at 0xF902 uint8_t p82c55_port_f;
+xdata at 0xF903 uint8_t p82c55_def_config;
+#endif
+
+/* LED (Port E) bit definitions */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_IDLE 3
+#define LED_UNUSED2 4
+#define LED_INIRQ 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Registers. 8052 regiser definitions are provided in the SDCC header
+ * file 8052.h. However, a few SFR registers are missing from that
+ * file (they can be found in mcs51reg.h, but that file is too much
+ * when the following simple addtions do the job).
+ */
+
+#ifndef __ASSEMBLY__
+sfr at 0xc9 T2MOD ;
+#endif
+
+/* Timing information.
+ *
+ * The PJRC board is based on a standard 87C52 CPU clocked at 22.1184 MHz.
+ * The CPU clock is divided by 12 to yield a clock frequency of 1.8432 MHz.
+ */
+
+#define CPU_CLOCK_HZ 22118400L
+#define TIMER_CLOCK_HZ 1843200L
+
+/* The 87C52 has three timers, timer 0, timer 1, and timer 2. On the PJRC
+ * board, timer 1 and 2 have dedicated functions. They provide baud support
+ * support for the boards two serial ports. Unfortunately, only timer 2
+ * can generate the accurate 100Hz timer desired by the OS.
+ *
+ * Timer 0 provides only a 8-bit auto-reload mode.
+ */
+
+#ifdef CONFIG_8052_TIMER2
+
+/* To use timer 2 as the 100Hz system timer, we need to calculate a 16-bit
+ * reload value that results in 100Hz overflow interrupts. That value
+ * is given by:
+ *
+ * Timer ticks = TIMER_CLOCK_HZ / (desired ticks-per-second)
+ * = 18432
+ * Capture value = 0xffff - (Timer ticks)
+ * = 47103 = 0x67ff
+ */
+
+# define TIMER2_CAPTURE_LOW 0xff
+# define TIMER2_CAPTURE_HIGH 0x67
+
+#else
+
+/* Timer 0, mode 0 can be used as a system timer. In that mode, the
+ * 1.8432 is further divided by 32. A single 8-bit value is incremented
+ * at 57600 Hz, which results in 225 Timer 0 overflow interrupts per
+ * second.
+ */
+
+#endif
+
+/**************************************************************************
+ * Public Function Prototypes
+ **************************************************************************/
+
+#endif /* __PJRC_H */
diff --git a/nuttx/configs/pjrc-8051/sdcc-2.6.0.patch b/nuttx/configs/pjrc-8051/sdcc-2.6.0.patch
new file mode 100644
index 000000000..beb8bf2ea
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/sdcc-2.6.0.patch
@@ -0,0 +1,28 @@
+diff -u sdcc/device/lib/Makefile.orig sdcc/device/lib/Makefile
+--- sdcc/device/lib/Makefile.orig 2007-03-06 09:55:01.000000000 -0600
++++ sdcc/device/lib/Makefile 2007-03-06 09:58:32.000000000 -0600
+@@ -242,7 +242,7 @@
+ model-mcs51-stack-auto:
+ if [ "`grep mcs51 $(top_builddir)ports.build`" = mcs51 ]; then \
+ for model in $(MODELS); do \
+- $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model PORTDIR=$(BUILDDIR)/$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
++ $(MAKE) MODELFLAGS="--model-$$model --stack-auto --int-long-reent --float-reent" PORT=$$model PORTDIR=$(BUILDDIR)/$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
+ done \
+ fi
+
+diff -u sdcc/device/include/stdarg.h.orig sdcc/device/include/stdarg.h
+--- sdcc/device/include/stdarg.h.orig 2007-03-11 13:21:15.000000000 -0600
++++ sdcc/device/include/stdarg.h 2007-03-11 13:26:59.000000000 -0600
+@@ -25,9 +25,9 @@
+
+ #else
+
+-typedef unsigned char __data * va_list ;
+-#define va_arg(marker,type) *((type __data * )(marker -= sizeof(type)))
+-#define va_start(marker,first) { marker = (va_list) ((char __data * )&first); }
++typedef unsigned char * va_list ;
++#define va_arg(marker,type) *((type * )(marker -= sizeof(type)))
++#define va_start(marker,first) { marker = (va_list) ((char * )&first); }
+
+ #endif
+
diff --git a/nuttx/configs/pjrc-8051/setenv.sh b/nuttx/configs/pjrc-8051/setenv.sh
new file mode 100755
index 000000000..d71c234ba
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# pjrc-8051/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/pjrc-8051/src/Makefile b/nuttx/configs/pjrc-8051/src/Makefile
new file mode 100644
index 000000000..7783ad1fb
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/src/Makefile
@@ -0,0 +1,76 @@
+############################################################################
+# configs/pjrc-8051/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/pjrc-8051/src/README.txt b/nuttx/configs/pjrc-8051/src/README.txt
new file mode 100644
index 000000000..74f820427
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the PJRC 87C52 board.
diff --git a/nuttx/configs/pjrc-8051/src/up_leds.c b/nuttx/configs/pjrc-8051/src/up_leds.c
new file mode 100644
index 000000000..64446b5e3
--- /dev/null
+++ b/nuttx/configs/pjrc-8051/src/up_leds.c
@@ -0,0 +1,207 @@
+/************************************************************************
+ * up_leds.c
+ *
+ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include "up_internal.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+#define RESET_KLUDGE_NEEDED 1
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+static uint8_t g_ledstate;
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+#if defined(CONFIG_LED_DEBUG) && defined(CONFIG_ARCH_LEDS)
+static void _up_puthex(uint8_t hex) __naked
+{
+ hex; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_PHEX
+ _endasm;
+}
+
+static void _up_putch(uint8_t ch) __naked
+{
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_COUT
+ _endasm;
+}
+
+static void _up_putnl(void) __naked
+{
+ _asm
+ ljmp PM2_ENTRY_NEWLINE
+ _endasm;
+}
+
+# define _up_showledinit() \
+ _up_putch('I'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+# define _up_showledreset() \
+ _up_putch('R'); \
+ _up_puthex(led); _up_putch(':'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+# define _up_showledon() \
+ _up_putch('+'); \
+ _up_puthex(led); _up_putch(':'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+# define _up_showledoff() \
+ _up_putch('-'); \
+ _up_puthex(led); _up_putch(':'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+#else
+
+# define _up_showledinit()
+# define _up_showledreset()
+# define _up_showledon()
+# define _up_showledoff()
+
+#endif
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_ledinit
+ ************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Set all ports as outputs */
+
+ p82c55_def_config = 128;
+
+ /* Turn LED 1-7 off; turn LED 0 on */
+
+ g_ledstate = 0xfe;
+ p82c55_port_e = g_ledstate;
+
+ _up_showledinit();
+}
+
+/************************************************************************
+ * Name: up_ledon
+ ************************************************************************/
+
+void up_ledon(uint8_t led)
+{
+ /* This may be called from an interrupt handler */
+
+ irqstate_t flags = irqsave();
+
+#ifdef RESET_KLUDGE_NEEDED
+ /* I don't understand why this happens yet, but sometimes
+ * it is necessary to reconfigure port E.
+ */
+
+ if (g_ledstate != p82c55_port_e)
+ {
+ _up_showledreset();
+ p82c55_def_config = 128;
+ }
+#endif
+
+ /* Clear the bit in port E corresponding to LED to turn it on */
+
+ if (led < 8)
+ {
+ g_ledstate &= ~(g_ntobit[led]);
+ p82c55_port_e = g_ledstate;
+ }
+
+ _up_showledon();
+ irqrestore(flags);
+}
+
+/************************************************************************
+ * Name: up_ledoff
+ ************************************************************************/
+
+void up_ledoff(uint8_t led)
+{
+ /* This may be called from an interrupt handler */
+
+ irqstate_t flags = irqsave();
+
+#ifdef RESET_KLUDGE_NEEDED
+ /* I don't understand why this happens yet, but sometimes
+ * it is necessary to reconfigure port E.
+ */
+
+ if (g_ledstate != p82c55_port_e)
+ {
+ _up_showledreset();
+ p82c55_def_config = 128;
+ }
+#endif
+
+ /* Set the bit in port E corresponding to LED to turn it off */
+
+ if (led < 8)
+ {
+ g_ledstate |= g_ntobit[led];
+ p82c55_port_e = g_ledstate;
+ }
+
+ _up_showledoff();
+ irqrestore(flags);
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/qemu-i486/Kconfig b/nuttx/configs/qemu-i486/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/qemu-i486/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/qemu-i486/README.txt b/nuttx/configs/qemu-i486/README.txt
new file mode 100644
index 000000000..254f8a131
--- /dev/null
+++ b/nuttx/configs/qemu-i486/README.txt
@@ -0,0 +1,166 @@
+README
+======
+
+This README file describes the contents of the build configurations available
+for the NuttX QEMU i486 port.
+
+Contents
+========
+
+ * QEMU
+ - Building QEMU
+ - Cygwin Build Problems
+ - Running QEMU
+ * Toolchains
+ - Cygwin Buildroot Toolchain
+ - Buildroot Instructions
+ * FAQ
+ * Configurations
+ - ostest
+ - nsh
+
+QEMU
+====
+
+QEMU is a generic and open source machine emulator and virtualizer. Here are
+some links (which will probably be mostly outdated by the time your read this):
+
+ Home Page: http://wiki.qemu.org/Main_Page
+ Downloads: http://wiki.qemu.org/Download
+ Documentation: http://wiki.qemu.org/Manual
+ Usage: qemu -nographic -kernel nuttx.elf
+
+Building QEMU
+-------------
+
+ tar zxf qemu-0.14.0.tar.gz
+ cd qemu-0.14.0
+ ./configure --target-list=i386-softmmu
+ make
+ make install
+
+Cygwin Build Problems
+---------------------
+
+ Error:
+
+ "gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler."
+
+ Workaround:
+
+ None known. It does not seem possible to build QEMU using the Cygwin gcc.
+ I tried editing configure. Removing the following line will allow QEMU to
+ configure:
+
+ QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
+
+ However, it then fails later during the compilation phase.
+
+ Recommendation:
+
+ 1. Google for "qemu windows download" and download some pre-built QEMU
+ binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or
+ 2. Try building QEMU with MingGW (I understand that this is difficult).
+
+ NOTE: As of this writing, I have not been successful getting ANY pre-built
+ version of QEMU to work successfully with WinXP. The same binaries work
+ fine on Vista, however.
+
+Running QEMU
+------------
+
+ In the top-level NuttX directory:
+
+ qemu -cpu 486 -m 2 -kernel nuttx.elf -nographic
+
+ The -nographic option redirects COM1 to your console. However, the -nographic
+ option does not work under Cygwin. For simple testing under Cygwin, I use
+
+ qemu -cpu 486 -m 2 -kernel nuttx.elf -serial file:test.txt
+
+ which will send COM1 output to the file test.txt.
+
+Toolchains
+==========
+
+ Two target environments are supported: (1) Linux and (2) Cygwin under Windows.
+ Any GCC toolchain that can produce i486 ELF binaries should work. On Linux,
+ you can probably use the installed system gcc. But that will not work with
+ Cygwin. Why? Because the Cygwin gcc (and probably the MinGW gcc as well) do
+ not produce ELF final binaries but, rather, DOS MZ executables (i.e., .exe
+ files). Those cannot be used with QEMU.
+
+ The file */setenv.sh should be modified to point to the correct path to the
+ GCC toolchain (if different from the default in your PATH variable).
+
+Cygwin Buildroot Toolchain
+--------------------------
+
+ With Cygwin the solution is to build an i486 cross-development toolchain to
+ generate the i486 ELF files needed by QEMU. The NuttX buildroot package will
+ create such a toolchain.
+
+ NOTE: As of this writing, none of the released buildroot packages support the
+ i486 build. This is only available in SVN or in any any 1.10 or later buildroot
+ release.
+
+Buildroot Instructions
+----------------------
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh qemu-i486/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/i486-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ run into problems building the toolchain for Cygwin under Windows.
+
+FAQ
+===
+
+Q: I get the following error message, "undefined reference to '__stack_chk_fail'"
+A: Add -fno-stack-protector to ARCHCPUFLAGS in you Make.defs file. Switch the
+ commenting on the following two lines in the Make.defs file:
+
+ ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
+ #ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
+
+Configurations
+==============
+
+ostest
+------
+
+ The "standard" NuttX examples/ostest configuration. This
+ configuration may be selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh qemu-i486/ostest
+
+nsh
+---
+
+ Configures the NuttShell (nsh) located at examples/nsh. This
+ configuration may be selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh qemu-i486/nsh
+
diff --git a/nuttx/configs/qemu-i486/include/README.txt b/nuttx/configs/qemu-i486/include/README.txt
new file mode 100644
index 000000000..c1f417b12
--- /dev/null
+++ b/nuttx/configs/qemu-i486/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the QEMU i486 platform.
diff --git a/nuttx/configs/qemu-i486/include/board.h b/nuttx/configs/qemu-i486/include/board.h
new file mode 100644
index 000000000..4dcd9d7a8
--- /dev/null
+++ b/nuttx/configs/qemu-i486/include/board.h
@@ -0,0 +1,101 @@
+/************************************************************************************
+ * configs/qemu-i486/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_QEMU_I486_INCLUDE_BOARD_H
+#define _CONFIGS_QEMU_I486_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* Programmable interval timer (PIT) */
+
+#define PIT_CLOCK 1041816 /* PIT input clock */
+
+/* LED definitions ******************************************************************/
+
+/* Button definitions ***************************************************************/
+
+/* Alternate pin selections *********************************************************/
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All x86 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void up_boardinitialize(void);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_QEMU_I486_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/qemu-i486/nsh/Make.defs b/nuttx/configs/qemu-i486/nsh/Make.defs
new file mode 100644
index 000000000..398c11496
--- /dev/null
+++ b/nuttx/configs/qemu-i486/nsh/Make.defs
@@ -0,0 +1,135 @@
+############################################################################
+# configs/qemu-i486/nsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
+#ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+
+ifeq ($(HOSTOS),FreeBSD)
+ HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"}
+ ifeq ($(HOST_ARCH),amd64)
+ ARCHCPUFLAGS += -m32
+ endif
+endif
+
+# We have to use a cross-development toolchain under Cygwin because the native
+# Cygwin toolchains don't generate ELF binaries.
+
+ifeq ($(HOSTOS),Cygwin)
+CROSSDEV = i486-elf-
+else
+CROSSDEV =
+endif
+
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT = .elf
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDESv = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/qemu-i486/nsh/appconfig b/nuttx/configs/qemu-i486/nsh/appconfig
new file mode 100644
index 000000000..1bdd7ce5d
--- /dev/null
+++ b/nuttx/configs/qemu-i486/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/qemu-i486/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/qemu-i486/nsh/defconfig b/nuttx/configs/qemu-i486/nsh/defconfig
new file mode 100644
index 000000000..72e97539a
--- /dev/null
+++ b/nuttx/configs/qemu-i486/nsh/defconfig
@@ -0,0 +1,312 @@
+############################################################################
+# configs/qemu-i486/nsh/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="x86"
+CONFIG_ARCH_X86=y
+CONFIG_ARCH_I486=y
+CONFIG_ARCH_CHIP="qemu"
+CONFIG_ARCH_CHIP_QEMU=y
+CONFIG_ARCH_BOARD="qemu-i486"
+CONFIG_ARCH_BOARD_QEMU_I486=y
+CONFIG_BOARD_LOOPSPERMSEC=999
+CONFIG_BOOT_RUNFROMEXTSRAM=y
+CONFIG_DRAM_SIZE=1048576
+CONFIG_DRAM_START=0x00100000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# 16550 UART Settings
+#
+CONFIG_16550_UART=y
+CONFIG_16550_REGINCR=1
+CONFIG_16550_REGWIDTH=8
+CONFIG_16550_ADDRWIDTH=16
+CONFIG_16550_SUPRESS_CONFIG=y
+CONFIG_SUPPRESS_SERIAL_INTS=n
+
+CONFIG_16550_UART0=y
+CONFIG_16550_UART0_BASE=0x3f8
+CONFIG_16550_UART0_CLOCK=16000000
+CONFIG_16550_UART0_IRQ=IRQ4
+
+CONFIG_16550_UART1=n
+CONFIG_16550_UART1_BASE=0x2f8
+CONFIG_16550_UART1_CLOCK=16000000
+CONFIG_16550_UART1_IRQ=IRQ3
+
+CONFIG_16550_UART2=n
+CONFIG_16550_UART2_BASE=0x3e8
+CONFIG_16550_UART2_CLOCK=16000000
+CONFIG_16550_UART2_IRQ=IRQ4
+
+CONFIG_16550_UART3=n
+CONFIG_16550_UART3_BASE=0x2e8
+CONFIG_16550_UART3_CLOCK=16000000
+CONFIG_16550_UART3_IRQ=IRQ3
+
+#
+# Serial device driver settings
+#
+CONFIG_16550_UART0_SERIAL_CONSOLE=y
+CONFIG_16550_UART1_SERIAL_CONSOLE=n
+CONFIG_16550_UART2_SERIAL_CONSOLE=n
+CONFIG_16550_UART3_SERIAL_CONSOLE=n
+
+CONFIG_16550_UART0_TXBUFSIZE=256
+CONFIG_16550_UART1_TXBUFSIZE=256
+CONFIG_16550_UART2_TXBUFSIZE=256
+CONFIG_16550_UART3_TXBUFSIZE=256
+
+CONFIG_16550_UART0_RXBUFSIZE=256
+CONFIG_16550_UART1_RXBUFSIZE=256
+CONFIG_16550_UART2_RXBUFSIZE=256
+CONFIG_16550_UART3_RXBUFSIZE=256
+
+CONFIG_16550_UART0_BAUD=57600
+CONFIG_16550_UART2_BAUD=57600
+CONFIG_16550_UART3_BAUD=57600
+CONFIG_16550_UART1_BAUD=57600
+
+CONFIG_16550_UART0_BITS=8
+CONFIG_16550_UART1_BITS=8
+CONFIG_16550_UART2_BITS=8
+CONFIG_16550_UART3_BITS=8
+
+CONFIG_16550_UART0_PARITY=0
+CONFIG_16550_UART1_PARITY=0
+CONFIG_16550_UART2_PARITY=0
+CONFIG_16550_UART3_PARITY=0
+
+CONFIG_16550_UART0_2STOP=0
+CONFIG_16550_UART1_2STOP=0
+CONFIG_16550_UART2_2STOP=0
+CONFIG_16550_UART3_2STOP=0
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=3
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=y
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories ofAPIs supported by the OS.
+# If the compiler supports weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage of those APIs.
+#
+# There are certain dependency relationships in these features.
+#
+# o mq_notify logic depends on signals to awaken tasks waiting for queues to
+# become full or empty.
+# o pthread_condtimedwait() depends on signals to wake up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the following to improve
+# system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/qemu-i486/nsh/ld.script b/nuttx/configs/qemu-i486/nsh/ld.script
new file mode 100755
index 000000000..3fffc8459
--- /dev/null
+++ b/nuttx/configs/qemu-i486/nsh/ld.script
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * configs/qemu-i486/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(i386)
+ENTRY(__start)
+SECTIONS
+{
+ . = 0x00100000;
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.gnu.linkonce.t.*)
+ _etext = ABSOLUTE(.);
+ }
+
+ .text ALIGN (0x1000) : {
+ _srodata = ABSOLUTE(.);
+ *(.rodata .rodata.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _erodata = ABSOLUTE(.);
+ }
+
+ .data ALIGN (0x1000) : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/qemu-i486/nsh/setenv.sh b/nuttx/configs/qemu-i486/nsh/setenv.sh
new file mode 100755
index 000000000..25ae59d71
--- /dev/null
+++ b/nuttx/configs/qemu-i486/nsh/setenv.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# configs/qemu-i486/nsh/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+# Uncomment and modify the following if you are using anything other
+# than the system GCC
+# WD=`pwd`
+# export BUILDROOT_BIN="${WD}/../../../buildroot/build_i486/staging_dir/bin"
+# export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/qemu-i486/ostest/Make.defs b/nuttx/configs/qemu-i486/ostest/Make.defs
new file mode 100644
index 000000000..1bd0b63d6
--- /dev/null
+++ b/nuttx/configs/qemu-i486/ostest/Make.defs
@@ -0,0 +1,135 @@
+############################################################################
+# configs/qemu-i486/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
+#ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+
+ifeq ($(HOSTOS),FreeBSD)
+ HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"}
+ ifeq ($(HOST_ARCH),amd64)
+ ARCHCPUFLAGS += -m32
+ endif
+endif
+
+# We have to use a cross-development toolchain under Cygwin because the native
+# Cygwin toolchains don't generate ELF binaries.
+
+ifeq ($(HOSTOS),Cygwin)
+CROSSDEV = i486-elf-
+else
+CROSSDEV =
+endif
+
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT = .elf
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDESv = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/qemu-i486/ostest/appconfig b/nuttx/configs/qemu-i486/ostest/appconfig
new file mode 100644
index 000000000..c78f650b2
--- /dev/null
+++ b/nuttx/configs/qemu-i486/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/qemu-i486/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/qemu-i486/ostest/defconfig b/nuttx/configs/qemu-i486/ostest/defconfig
new file mode 100644
index 000000000..3f87e11cd
--- /dev/null
+++ b/nuttx/configs/qemu-i486/ostest/defconfig
@@ -0,0 +1,228 @@
+############################################################################
+# configs/qemu-i486/ostest/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="x86"
+CONFIG_ARCH_X86=y
+CONFIG_ARCH_I486=y
+CONFIG_ARCH_CHIP="qemu"
+CONFIG_ARCH_CHIP_QEMU=y
+CONFIG_ARCH_BOARD="qemu-i486"
+CONFIG_ARCH_BOARD_QEMU_I486=y
+CONFIG_BOARD_LOOPSPERMSEC=999
+CONFIG_BOOT_RUNFROMEXTSRAM=y
+CONFIG_DRAM_SIZE=1048576
+CONFIG_DRAM_START=0x00100000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=3
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=y
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories ofAPIs supported by the OS.
+# If the compiler supports weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage of those APIs.
+#
+# There are certain dependency relationships in these features.
+#
+# o mq_notify logic depends on signals to awaken tasks waiting for queues to
+# become full or empty.
+# o pthread_condtimedwait() depends on signals to wake up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the following to improve
+# system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/qemu-i486/ostest/ld.script b/nuttx/configs/qemu-i486/ostest/ld.script
new file mode 100755
index 000000000..d59771078
--- /dev/null
+++ b/nuttx/configs/qemu-i486/ostest/ld.script
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * configs/qemu-i486/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(i386)
+ENTRY(__start)
+SECTIONS
+{
+ . = 0x00100000;
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.gnu.linkonce.t.*)
+ _etext = ABSOLUTE(.);
+ }
+
+ .text ALIGN (0x1000) : {
+ _srodata = ABSOLUTE(.);
+ *(.rodata .rodata.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _erodata = ABSOLUTE(.);
+ }
+
+ .data ALIGN (0x1000) : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/qemu-i486/ostest/setenv.sh b/nuttx/configs/qemu-i486/ostest/setenv.sh
new file mode 100755
index 000000000..f9c3bdec8
--- /dev/null
+++ b/nuttx/configs/qemu-i486/ostest/setenv.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# configs/qemu-i486/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+# Uncomment and modify the following if you are using anything other
+# than the system GCC
+# WD=`pwd`
+# export BUILDROOT_BIN="${WD}/../../../buildroot/build_i486/staging_dir/bin"
+# export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/qemu-i486/src/Makefile b/nuttx/configs/qemu-i486/src/Makefile
new file mode 100644
index 000000000..287e4e728
--- /dev/null
+++ b/nuttx/configs/qemu-i486/src/Makefile
@@ -0,0 +1,83 @@
+############################################################################
+# configs/qemu-i486/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/qemu-i486/src/README.txt b/nuttx/configs/qemu-i486/src/README.txt
new file mode 100644
index 000000000..2ab000313
--- /dev/null
+++ b/nuttx/configs/qemu-i486/src/README.txt
@@ -0,0 +1 @@
+This directory contains source files unique to the QEMU i486 platform.
diff --git a/nuttx/configs/qemu-i486/src/qemui486_internal.h b/nuttx/configs/qemu-i486/src/qemui486_internal.h
new file mode 100644
index 000000000..6a0466149
--- /dev/null
+++ b/nuttx/configs/qemu-i486/src/qemui486_internal.h
@@ -0,0 +1,69 @@
+/************************************************************************************
+ * configs/qemu-i486/src/qemui486_internal.h
+ * arch/x86/src/board/qemui486_internal.n
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef _CONFIGS_QEMU_I486_SRC_QEMUI486_INTERNAL_H
+#define _CONFIGS_QEMU_I486_SRC_QEMUI486_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* GPIO Pin Definitions *************************************************************/
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ASSEMBLY__ */
+#endif /* _CONFIGS_QEMU_I486_SRC_QEMUI486_INTERNAL_H */
+
diff --git a/nuttx/configs/qemu-i486/src/up_boot.c b/nuttx/configs/qemu-i486/src/up_boot.c
new file mode 100644
index 000000000..bd7646992
--- /dev/null
+++ b/nuttx/configs/qemu-i486/src/up_boot.c
@@ -0,0 +1,82 @@
+/************************************************************************************
+ * configs/qemu-i486/src/up_boot.c
+ * arch/x86/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "qemu_internal.h"
+#include "qemui486_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All x86 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void up_boardinitialize(void)
+{
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/rgmp/Kconfig b/nuttx/configs/rgmp/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/rgmp/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/rgmp/README.txt b/nuttx/configs/rgmp/README.txt
new file mode 100644
index 000000000..3e4603e7e
--- /dev/null
+++ b/nuttx/configs/rgmp/README.txt
@@ -0,0 +1,93 @@
+RGMP README File
+================
+
+RGMP stands for RTOS and GPOS on Multi-Processor. RGMP is a project for
+running GPOS and RTOS simultaneously on multi-processor platforms. You can
+port your favorite RTOS to RGMP together with an unmodified Linux to form a
+hybrid operating system. This makes your application able to use both RTOS
+and GPOS features.
+
+See http://rgmp.sourceforge.net/wiki/index.php/Main_Page for further
+information about RGMP.
+
+The updated build instructions can be found at:
+http://rgmp.sourceforge.net/wiki/index.php/Documentation
+
+Ubuntu Build Instructions
+--------------------------
+Build requirements:
+ * x86 PC:
+ Ubuntu 10.04, 10.10 or 11.04
+ * OMAP4430 pandaboard:
+ Ubuntu 11.04
+
+Run requirements:
+ * multi-processor x86 PC:
+ Ubuntu 10.04, 10.10 or 11.04
+ * OMAP4430 pandaboard:
+ Ubuntu 11.04
+
+1. Download RGMP from the following URL:
+
+ http://rgmp.sourceforge.net/wiki/index.php/Download
+
+ You should choose a right verion of RGMP compatible with this NuttX release.
+ Extract the tar file:
+
+ $ tar -xjvf rgmp-<RGMP-version>.tar.bz2
+
+2. Get Linux kernel header:
+
+ $ sudo apt-get install linux-headers-$(uname -r)
+
+3. Build and install RGMP:
+
+ $ cd <rgmp-dir>
+ $ ./configure
+ $ make
+ $ sudo make install
+ $ sudo /usr/rgmp/setup
+ $ exit
+
+4. Configure NuttX. For example, for the RGMP x86 NSH configuration, do the
+ following:
+
+ $ cd <nuttx-dir>
+ $ cd tools
+ $ ./configure.sh rgmp/x86/nsh
+ $ cd ..
+
+5. Build NuttX. Get the binary image at <nuttx-dir>/kernel.img.
+
+ $ cd <nuttx-dir>
+ $ make
+
+6. Run NuttX in RGMP:
+
+ $ cd <nuttx-dir>
+ $ su
+ $ rgmp_run
+
+
+Other Linux OS Build Instruction
+--------------------------------------
+Requirements:
+ * multi-processor x86 PC
+ running Linux kernel 2.6.32, 2.6.35 or 2.6.38
+ * OMAP4430 pandaboard
+ running Linux kernel 2.6.38
+
+1. Get your running Linux kernel header under /usr/src/linux-headers-$(uname -r)
+ directory.
+
+2. Following the Ubuntu steps begin at 3.
+
+Note: You can configure the RGMP to find Linux kernel header in a different
+ place and install RGMP to a different place. See information printed
+ by the following instruction:
+
+ $ cd <rgmp-dir>
+ $ ./configure -h
+
+
+
diff --git a/nuttx/configs/rgmp/arm/default/Make.defs b/nuttx/configs/rgmp/arm/default/Make.defs
new file mode 100644
index 000000000..fdb39e6d6
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/default/Make.defs
@@ -0,0 +1,118 @@
+############################################################################
+# configs/rgmp/default/Make.defs
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+RGMPLIBDIR := $(RGMP_INST_DIR)/lib
+RGMPINCDIR := $(RGMP_INST_DIR)/include
+RGMPLKSCPT := $(RGMP_INST_DIR)/etc/rgmp.ld
+
+HOSTOS = ${shell uname -o}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -O2 -gstabs
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector -fno-omit-frame-pointer \
+ -marm -march=armv7-a
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
+ -I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/arm
+ARCHSCRIPT =
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDFLAGS += -nostdlib
+EXTRA_LIBS =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/rgmp/arm/default/appconfig b/nuttx/configs/rgmp/arm/default/appconfig
new file mode 100644
index 000000000..c57f8696b
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/default/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sim/default/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/rgmp
+
diff --git a/nuttx/configs/rgmp/arm/default/defconfig b/nuttx/configs/rgmp/arm/default/defconfig
new file mode 100644
index 000000000..d722dd5e7
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/default/defconfig
@@ -0,0 +1,240 @@
+############################################################################
+# configs/rgmp/default/defconfig
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="rgmp"
+CONFIG_ARCH_RGMP=y
+CONFIG_ARCH_BOARD="rgmp"
+CONFIG_ARCH_BOARD_RGMP=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="rgmp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_MSEC_PER_TICK=1
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=27
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=y
+CONFIG_ARCH_MEMCMP=y
+CONFIG_ARCH_MEMMOVE=y
+CONFIG_ARCH_MEMSET=y
+CONFIG_ARCH_STRCMP=y
+CONFIG_ARCH_STRCPY=y
+CONFIG_ARCH_STRNCPY=y
+CONFIG_ARCH_STRLEN=y
+CONFIG_ARCH_STRNLEN=y
+CONFIG_ARCH_BZERO=n
+CONFIG_ARCH_MATH_H=y
+CONFIG_ARCH_STDINT_H=y
+CONFIG_ARCH_STDBOOL_H=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+CONFIG_STDIO_LINEBUFFER=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=5
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=1514
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=128
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_LLH_LEN=14
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80a02
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80a01
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+
+##########################################
+# RGMP specific configuration
+##########################################
+
+#
+# arch
+#
+CONFIG_RGMP_SUBARCH=arm
+
+#
+# VNET
+#
+CONFIG_NET_VNET=y
+CONFIG_VNET_NINTERFACES=1
+
+
diff --git a/nuttx/configs/rgmp/arm/default/setenv.sh b/nuttx/configs/rgmp/arm/default/setenv.sh
new file mode 100644
index 000000000..bfb02549b
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/default/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# config/rgmp/default/setenv.sh
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/rgmp/arm/nsh/Make.defs b/nuttx/configs/rgmp/arm/nsh/Make.defs
new file mode 100644
index 000000000..3e97c6153
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/nsh/Make.defs
@@ -0,0 +1,118 @@
+############################################################################
+# configs/rgmp/nsh/Make.defs
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+RGMPLIBDIR := $(RGMP_INST_DIR)/lib
+RGMPINCDIR := $(RGMP_INST_DIR)/include
+RGMPLKSCPT := $(RGMP_INST_DIR)/etc/rgmp.ld
+
+HOSTOS = ${shell uname -o}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -O2 -gstabs
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector -fno-omit-frame-pointer \
+ -marm -march=armv7-a
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
+ -I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/arm
+ARCHSCRIPT =
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDFLAGS += -nostdlib
+EXTRA_LIBS =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/rgmp/arm/nsh/appconfig b/nuttx/configs/rgmp/arm/nsh/appconfig
new file mode 100644
index 000000000..b5e5d0203
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/nsh/appconfig
@@ -0,0 +1,55 @@
+############################################################################
+# configs/rgmp/nsh/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+CONFIGURED_APPS += system/readline
+
+# The NSH Library
+
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+endif
+
+
diff --git a/nuttx/configs/rgmp/arm/nsh/defconfig b/nuttx/configs/rgmp/arm/nsh/defconfig
new file mode 100644
index 000000000..279437d47
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/nsh/defconfig
@@ -0,0 +1,241 @@
+############################################################################
+# configs/rgmp/nsh/defconfig
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="rgmp"
+CONFIG_ARCH_RGMP=y
+CONFIG_ARCH_BOARD="rgmp"
+CONFIG_ARCH_BOARD_RGMP=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_MSEC_PER_TICK=1
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=27
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=y
+CONFIG_ARCH_MEMCMP=y
+CONFIG_ARCH_MEMMOVE=y
+CONFIG_ARCH_MEMSET=y
+CONFIG_ARCH_STRCMP=y
+CONFIG_ARCH_STRCPY=y
+CONFIG_ARCH_STRNCPY=y
+CONFIG_ARCH_STRLEN=y
+CONFIG_ARCH_STRNLEN=y
+CONFIG_ARCH_BZERO=n
+CONFIG_ARCH_MATH_H=y
+CONFIG_ARCH_STDINT_H=y
+CONFIG_ARCH_STDBOOL_H=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+CONFIG_STDIO_LINEBUFFER=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=5
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=1514
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_RECEIVE_WINDOW=128
+CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_LLH_LEN=14
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0xc0a80a02
+CONFIG_NSH_DRIPADDR=0xc0a80a01
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+
+##########################################
+# RGMP specific configuration
+##########################################
+
+#
+# arch
+#
+CONFIG_RGMP_SUBARCH=arm
+
+#
+# VNET
+#
+CONFIG_NET_VNET=y
+CONFIG_VNET_NINTERFACES=1
+
+
diff --git a/nuttx/configs/rgmp/arm/nsh/setenv.sh b/nuttx/configs/rgmp/arm/nsh/setenv.sh
new file mode 100644
index 000000000..b2180473b
--- /dev/null
+++ b/nuttx/configs/rgmp/arm/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# config/rgmp/nsh/setenv.sh
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/rgmp/include/README.txt b/nuttx/configs/rgmp/include/README.txt
new file mode 100644
index 000000000..006f13e7c
--- /dev/null
+++ b/nuttx/configs/rgmp/include/README.txt
@@ -0,0 +1 @@
+This directory is reserved for RGMP header files
diff --git a/nuttx/configs/rgmp/include/stdarg.h b/nuttx/configs/rgmp/include/stdarg.h
new file mode 100644
index 000000000..b748243d1
--- /dev/null
+++ b/nuttx/configs/rgmp/include/stdarg.h
@@ -0,0 +1,8 @@
+#ifndef _CONFIG_RGMP_STDARG_H
+#define _CONFIG_RGMP_STDARG_H
+
+
+#include <rgmp/stdarg.h>
+
+
+#endif
diff --git a/nuttx/configs/rgmp/src/README.txt b/nuttx/configs/rgmp/src/README.txt
new file mode 100644
index 000000000..d7d216e24
--- /dev/null
+++ b/nuttx/configs/rgmp/src/README.txt
@@ -0,0 +1 @@
+This directory is reserved for RGMP source files
diff --git a/nuttx/configs/rgmp/x86/default/Make.defs b/nuttx/configs/rgmp/x86/default/Make.defs
new file mode 100644
index 000000000..e69ed7078
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/default/Make.defs
@@ -0,0 +1,117 @@
+############################################################################
+# configs/rgmp/default/Make.defs
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+RGMPLIBDIR := $(RGMP_INST_DIR)/lib
+RGMPINCDIR := $(RGMP_INST_DIR)/include
+RGMPLKSCPT := $(RGMP_INST_DIR)/etc/rgmp.ld
+
+HOSTOS = ${shell uname -o}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -O2 -gstabs
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
+ -I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86
+ARCHSCRIPT =
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDFLAGS += -nostdlib
+EXTRA_LIBS =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/rgmp/x86/default/appconfig b/nuttx/configs/rgmp/x86/default/appconfig
new file mode 100644
index 000000000..c57f8696b
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/default/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sim/default/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/rgmp
+
diff --git a/nuttx/configs/rgmp/x86/default/defconfig b/nuttx/configs/rgmp/x86/default/defconfig
new file mode 100644
index 000000000..4e37d9092
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/default/defconfig
@@ -0,0 +1,254 @@
+############################################################################
+# configs/rgmp/default/defconfig
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="rgmp"
+CONFIG_ARCH_RGMP=y
+CONFIG_ARCH_BOARD="rgmp"
+CONFIG_ARCH_BOARD_RGMP=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="rgmp_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_MSEC_PER_TICK=1
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=27
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=y
+CONFIG_ARCH_MEMCMP=y
+CONFIG_ARCH_MEMMOVE=y
+CONFIG_ARCH_MEMSET=y
+CONFIG_ARCH_STRCMP=y
+CONFIG_ARCH_STRCPY=y
+CONFIG_ARCH_STRNCPY=y
+CONFIG_ARCH_STRLEN=y
+CONFIG_ARCH_STRNLEN=y
+CONFIG_ARCH_BZERO=n
+CONFIG_ARCH_MATH_H=y
+CONFIG_ARCH_STDINT_H=y
+CONFIG_ARCH_STDBOOL_H=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+CONFIG_STDIO_LINEBUFFER=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=5
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=1514
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=128
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_LLH_LEN=14
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80a02
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80a01
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+
+##########################################
+# RGMP specific configuration
+##########################################
+
+#
+# arch
+#
+CONFIG_RGMP_SUBARCH=x86
+
+#
+# VNET
+#
+CONFIG_NET_VNET=y
+CONFIG_VNET_NINTERFACES=1
+
+#
+# Serial port
+#
+CONFIG_COM1=y
+CONFIG_COM2=y
+CONFIG_COM3=n
+CONFIG_COM4=n
+
+#
+# E1000
+#
+CONFIG_NET_E1000=n
+CONFIG_E1000_N_TX_DESC=128
+CONFIG_E1000_N_RX_DESC=128
+CONFIG_E1000_BUFF_SIZE=0x800
diff --git a/nuttx/configs/rgmp/x86/default/setenv.sh b/nuttx/configs/rgmp/x86/default/setenv.sh
new file mode 100644
index 000000000..bfb02549b
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/default/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# config/rgmp/default/setenv.sh
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/rgmp/x86/nsh/Make.defs b/nuttx/configs/rgmp/x86/nsh/Make.defs
new file mode 100644
index 000000000..8d1bde092
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/nsh/Make.defs
@@ -0,0 +1,117 @@
+############################################################################
+# configs/rgmp/nsh/Make.defs
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+RGMPLIBDIR := $(RGMP_INST_DIR)/lib
+RGMPINCDIR := $(RGMP_INST_DIR)/include
+RGMPLKSCPT := $(RGMP_INST_DIR)/etc/rgmp.ld
+
+HOSTOS = ${shell uname -o}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -O2 -gstabs
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
+ -I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86
+ARCHSCRIPT =
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDFLAGS += -nostdlib
+EXTRA_LIBS =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/rgmp/x86/nsh/appconfig b/nuttx/configs/rgmp/x86/nsh/appconfig
new file mode 100644
index 000000000..b5e5d0203
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/nsh/appconfig
@@ -0,0 +1,55 @@
+############################################################################
+# configs/rgmp/nsh/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+CONFIGURED_APPS += system/readline
+
+# The NSH Library
+
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+endif
+
+
diff --git a/nuttx/configs/rgmp/x86/nsh/defconfig b/nuttx/configs/rgmp/x86/nsh/defconfig
new file mode 100644
index 000000000..363ef609d
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/nsh/defconfig
@@ -0,0 +1,255 @@
+############################################################################
+# configs/rgmp/nsh/defconfig
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="rgmp"
+CONFIG_ARCH_RGMP=y
+CONFIG_ARCH_BOARD="rgmp"
+CONFIG_ARCH_BOARD_RGMP=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_MSEC_PER_TICK=1
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=27
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=y
+CONFIG_ARCH_MEMCMP=y
+CONFIG_ARCH_MEMMOVE=y
+CONFIG_ARCH_MEMSET=y
+CONFIG_ARCH_STRCMP=y
+CONFIG_ARCH_STRCPY=y
+CONFIG_ARCH_STRNCPY=y
+CONFIG_ARCH_STRLEN=y
+CONFIG_ARCH_STRNLEN=y
+CONFIG_ARCH_BZERO=n
+CONFIG_ARCH_MATH_H=y
+CONFIG_ARCH_STDINT_H=y
+CONFIG_ARCH_STDBOOL_H=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+CONFIG_STDIO_LINEBUFFER=y
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=5
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=1514
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_RECEIVE_WINDOW=128
+CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_LLH_LEN=14
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0xc0a80a02
+CONFIG_NSH_DRIPADDR=0xc0a80a01
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+
+##########################################
+# RGMP specific configuration
+##########################################
+
+#
+# arch
+#
+CONFIG_RGMP_SUBARCH=x86
+
+#
+# VNET
+#
+CONFIG_NET_VNET=y
+CONFIG_VNET_NINTERFACES=1
+
+#
+# Serial port
+#
+CONFIG_COM1=y
+CONFIG_COM2=y
+CONFIG_COM3=n
+CONFIG_COM4=n
+
+#
+# E1000
+#
+CONFIG_NET_E1000=n
+CONFIG_E1000_N_TX_DESC=128
+CONFIG_E1000_N_RX_DESC=128
+CONFIG_E1000_BUFF_SIZE=0x800
diff --git a/nuttx/configs/rgmp/x86/nsh/setenv.sh b/nuttx/configs/rgmp/x86/nsh/setenv.sh
new file mode 100644
index 000000000..b2180473b
--- /dev/null
+++ b/nuttx/configs/rgmp/x86/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# config/rgmp/nsh/setenv.sh
+#
+# Copyright (C) 2011 Yu Qiang. All rights reserved.
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Authors: Yu Qiang <yuq825@gmail.com>
+# Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sam3u-ek/Kconfig b/nuttx/configs/sam3u-ek/Kconfig
new file mode 100644
index 000000000..f4daa81fe
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_SAM3UEK
+endif
diff --git a/nuttx/configs/sam3u-ek/README.txt b/nuttx/configs/sam3u-ek/README.txt
new file mode 100644
index 000000000..cb0b82c8f
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/README.txt
@@ -0,0 +1,368 @@
+README
+^^^^^^
+
+This README discusses issues unique to NuttX configurations for the
+Atmel SAM3U-EK development board.
+
+Contents
+^^^^^^^^
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - LEDs
+ - SAM3U-EK-specific Configuration Options
+ - Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain, ok
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_SAM3U_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_SAM3U_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_SAM3U_DEVKITARM=y : devkitARM under Windows
+ CONFIG_SAM3U_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_SAM3U_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/sam3u,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/sam3u/sam3u_vectors.S. You may need to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh sam3u-ek/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+LEDs
+^^^^
+
+The SAM3U-EK board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
+the board. Usage of these LEDs is defined in include/board.h and src/up_leds.c.
+They are encoded as follows:
+
+ SYMBOL Meaning LED0* LED1 LED2
+ ------------------- ----------------------- ------- ------- -------
+ LED_STARTED NuttX has been started OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
+ LED_IRQSENABLED Interrupts enabled OFF ON OFF
+ LED_STACKCREATED Idle stack created OFF ON ON
+ LED_INIRQ In an interrupt** N/C FLASH N/C
+ LED_SIGNAL In a signal handler*** N/C N/C FLASH
+ LED_ASSERTION An assertion failed FLASH N/C N/C
+ LED_PANIC The system has crashed FLASH N/C N/C
+
+ * If LED1 and LED2 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED0=OFF, LED2=ON and LED1 faintly glowing. This faint
+ glow is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+*** LED2 may also flicker normally if signals are processed.
+
+SAM3U-EK-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=sam3u
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_AT91SAM3U4
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=sam3u_ek (for the SAM3U-EK development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_SAM3UEK=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x0000c000 (48Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The SAM3UF103Z supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_SAM3U_DMA
+ CONFIG_SAM3U_HSMCI
+ CONFIG_SAM3U_NAND
+ CONFIG_SAM3U_SPI
+ CONFIG_SAM3U_UART
+ CONFIG_SAM3U_USART0
+ CONFIG_SAM3U_USART1
+ CONFIG_SAM3U_USART2
+ CONFIG_SAM3U_USART3
+
+ Some subsystems can be configured to operate in different ways. The drivers
+ need to know how to configure the subsystem.
+
+ CONFIG_GPIOA_IRQ
+ CONFIG_GPIOB_IRQ
+ CONFIG_GPIOC_IRQ
+ CONFIG_USART0_ISUART
+ CONFIG_USART1_ISUART
+ CONFIG_USART2_ISUART
+ CONFIG_USART3_ISUART
+
+ AT91SAM3U specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ LCD Options. Other than the standard LCD configuration options
+ (see configs/README.txt), the SAM3U-EK driver also supports:
+
+ CONFIG_LCD_PORTRAIT - Present the display in the standard 240x320
+ "Portrait" orientation. Default: The display is rotated to
+ support a 320x240 "Landscape" orientation.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each SAM3U-EK configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh sam3u-ek/<subdir>
+ cd -
+ . ./setenv.sh
+
+Before sourcing the setenv.sh file above, you should examine it and perform
+edits as necessary so that BUILDROOT_BIN is the correct path to the directory
+than holds your toolchain binaries.
+
+And then build NuttX by simply typing the following. At the conclusion of
+the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
+
+ make
+
+The <subdir> that is provided above as an argument to the tools/configure.sh
+must be is one of the following:
+
+ knsh:
+ This is identical to the nsh configuration below except that NuttX
+ is built as a kernel-mode, monolithic module and the user applications
+ are built separately. This build requires a special make command; not
+ just 'make' but make with the following two arguments:
+
+ make pass1 pass2
+
+ This is required because in the normal case (just 'make'), make will
+ create all dependencies then execute the pass1 and pass2 targets. But
+ this example, pass2 depends on auto-generatd files produced during pass1.
+ This specall make command ('make pass1 pass2') will make the dependencies
+ separately for each pass.
+
+ At there end of the build, there four files will top-level build
+ directory:
+
+ nuttx_user.elf - The pass1 ELF file
+ nuttx - The pass2 ELF file
+ nuttx_user.hex - The pass1 Intel HEX format file
+ nuttx.hex - The pass2 Intel HEX file
+
+ The J-Link program will except files in .hex, .mot, .srec, and .bin
+ formats.
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+ nx:
+ Configures to use examples/nx using the HX834x LCD hardwar on
+ the SAM3U-EK development board.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ touchscreen:
+ This configuration implements an NSH configuratin with several
+ built-in applications. The configuration is called touchscreen
+ because we intend to use this configuration to develop the
+ SAM3U-EK touchscreen. However, there is no touchscreen driver
+ in place as of this writing.
diff --git a/nuttx/configs/sam3u-ek/include/board.h b/nuttx/configs/sam3u-ek/include/board.h
new file mode 100644
index 000000000..01817c784
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/include/board.h
@@ -0,0 +1,206 @@
+/************************************************************************************
+ * configs/sam3u-ek/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include "sam3u_internal.h"
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+# ifdef CONFIG_GPIO_IRQ
+# include <arch/irq.h>
+# endif
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* After power-on reset, the sam3u device is running on a 4MHz internal RC. These
+ * definitions will configure clocking with MCK = 48MHz, PLLA = 96, and CPU=48MHz.
+ */
+
+/* Main oscillator register settings */
+
+#define BOARD_CKGR_MOR_MOSCXTST (63 << CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */
+
+/* PLLA configuration */
+
+#define BOARD_CKGR_PLLAR_MULA (7 << CKGR_PLLAR_MULA_SHIFT)
+#define BOARD_CKGR_PLLAR_STMODE CKGR_PLLAR_STMODE_FAST
+#define BOARD_CKGR_PLLAR_PLLACOUNT (63 << CKGR_PLLAR_PLLACOUNT_SHIFT)
+#define BOARD_CKGR_PLLAR_DIVA CKGR_PLLAR_DIVA_BYPASS
+
+/* PMC master clock register settings */
+
+#define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLA
+#define BOARD_PMC_MCKR_PRES PMC_MCKR_PRES_DIV2
+
+/* USB UTMI PLL start-up time */
+
+#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << CKGR_UCKR_UPLLCOUNT_SHIFT)
+
+/* Resulting frequencies */
+
+#define SAM3U_MAINOSC_FREQUENCY (12000000)
+#define SAM3U_MCK_FREQUENCY (48000000)
+#define SAM3U_PLLA_FREQUENCY (96000000)
+#define SAM3U_CPU_FREQUENCY (48000000)
+
+/* HSMCI clocking
+ *
+ * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
+ * divided by (2*(CLKDIV+1)).
+ *
+ * MCI_SPEED = MCK / (2*(CLKDIV+1))
+ * CLKDIV = MCI / MCI_SPEED / 2 - 1
+ */
+
+/* MCK = 48MHz, CLKDIV = 59, MCI_SPEED = 48MHz / 2 * (59+1) = 400 KHz */
+
+#define HSMCI_INIT_CLKDIV (59 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 48MHz, CLKDIV = 1, MCI_SPEED = 48MHz / 2 * (1+1) = 12 MHz */
+
+#define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
+
+/* MCK = 48MHz, CLKDIV = 0, MCI_SPEED = 48MHz / 2 * (0+1) = 24 MHz */
+
+#define HSMCI_SDXFR_CLKDIV (0 << HSMCI_MR_CLKDIV_SHIFT)
+#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
+
+/* LED definitions ******************************************************************/
+
+#define LED_STARTED 0 /* LED0=OFF LED1=OFF LED2=OFF */
+#define LED_HEAPALLOCATE 1 /* LED0=OFF LED1=OFF LED2=ON */
+#define LED_IRQSENABLED 2 /* LED0=OFF LED1=ON LED2=OFF */
+#define LED_STACKCREATED 3 /* LED0=OFF LED1=ON LED2=ON */
+
+#define LED_INIRQ 4 /* LED0=XXX LED1=TOG LED2=XXX */
+#define LED_SIGNAL 5 /* LED0=XXX LED1=XXX LED2=TOG */
+#define LED_ASSERTION 6 /* LED0=TOG LED1=XXX LED2=XXX */
+#define LED_PANIC 7 /* LED0=TOG LED1=XXX LED2=XXX */
+
+/* Button definitions ***************************************************************/
+
+#define BUTTON1 1 /* Bit 0: Button 1 */
+#define BUTTON2 2 /* Bit 1: Button 2 */
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: sam3u_boardinitialize
+ *
+ * Description:
+ * All SAM3U architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void sam3u_boardinitialize(void);
+
+/************************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the current state of all buttons or
+ * up_irqbutton() may be called to register button interrupt handlers.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+
+/************************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * After up_buttoninit() has been called, up_buttons() may be called to collect
+ * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit
+ * associated with a button. See the BUTTON* definitions above for the meaning of
+ * each bit in the returned value.
+ *
+ ************************************************************************************/
+
+EXTERN uint8_t up_buttons(void);
+
+/************************************************************************************
+ * Name: up_irqbutton
+ *
+ * Description:
+ * This function may be called to register an interrupt handler that will be
+ * called when a button is depressed or released. The ID value is one of the
+ * BUTTON* definitions provided above. The previous interrupt handler address is
+ * returned (so that it may restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_GPIOA_IRQ
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/sam3u-ek/kernel/Makefile b/nuttx/configs/sam3u-ek/kernel/Makefile
new file mode 100644
index 000000000..24934c479
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/kernel/Makefile
@@ -0,0 +1,136 @@
+############################################################################
+# configs/sam3u-ek/kernel/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+
+# This is the directory for the board-specific header files
+
+BOARD_INCLUDE = $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/include
+
+# Get the paths to the libraries and the links script path in format that
+# is appropriate for the host OS
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)/$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
+ USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/kernel/kernel.ld}"
+else
+ # Linux/Cygwin-native toolchain
+ USER_LIBPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(USERLIBS)))
+ USER_LDSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/kernel/kernel.ld
+endif
+
+USER_LDFLAGS = $(USER_LDSCRIPT)
+USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS))))
+USER_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
+
+# Targets:
+
+all: $(TOPDIR)/nuttx_user.elf $(TOPDIR)/User.map $(BOARD_INCLUDE)/user_map.h
+
+.PHONY: depend clean distclean
+
+# Create the nuttx_user.elf file containing all of the user-mode code
+
+nuttx_user.elf:
+ @$(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC)
+
+$(TOPDIR)/nuttx_user.elf: nuttx_user.elf
+ @echo "LD: nuttx_user.elf"
+ @cp -a nuttx_user.elf $(TOPDIR)/nuttx_user.elf
+ifeq ($(CONFIG_INTELHEX_BINARY),y)
+ @echo "CP: nuttx_user.hex"
+ @$(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx_user.elf $(TOPDIR)/nuttx_user.hex
+endif
+ifeq ($(CONFIG_MOTOROLA_SREC),y)
+ @echo "CP: nuttx_user.srec"
+ @$(OBJCOPY) $(OBJCOPYARGS) -O srec nuttx_user.elf $(TOPDIR)/nuttx_user.srec
+endif
+ifeq ($(CONFIG_RAW_BINARY),y)
+ @echo "CP: nuttx_user.bin"
+ @$(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(TOPDIR)/nuttx_user.bin
+endif
+
+$(TOPDIR)/User.map: nuttx_user.elf
+ @echo "MK: User.map"
+ @$(NM) nuttx_user.elf >$(TOPDIR)/User.map
+ @$(CROSSDEV)size nuttx_user.elf
+
+$(BOARD_INCLUDE)/user_map.h: $(TOPDIR)/User.map
+ @echo "MK: user_map.h"
+ @echo "/* configs/$(CONFIG_ARCH_BOARD)/include/user_map.h" > $(BOARD_INCLUDE)/user_map.h
+ @echo " *" >> $(BOARD_INCLUDE)/user_map.h
+ @echo " * This is an auto-generated file.. Do not edit this file!" >> $(BOARD_INCLUDE)/user_map.h
+ @echo " */" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#ifndef __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "/* General memory map */" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_ENTRYPOINT 0x`grep \" user_start$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_TEXTSTART 0x`grep \" _stext\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_TEXTEND 0x`grep \" _etext$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_DATADESTSTART 0x`grep \" _sdata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_DATADESTEND 0x`grep \" _edata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_BSSSTART 0x`grep \" _sbss\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_BSSEND 0x`grep \" _ebss$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "/* Memory manager entry points */" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MMINIT 0x`grep \" mm_initialize$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MMADDREGION 0x`grep \" mm_addregion$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MMTRYSEM 0x`grep \" mm_trysemaphore$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MMGIVESEM 0x`grep \" mm_givesemaphore$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MALLOC 0x`grep \" malloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_REALLOC 0x`grep \" realloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_ZALLOC 0x`grep \" zalloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_FREE 0x`grep \" free$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#endif /* __ARCH_BOARD_USER_MAP_H */" >> $(BOARD_INCLUDE)/user_map.h
+
+.depend:
+
+depend: .depend
+
+clean:
+ @rm -f nuttx_user.elf *~ .*.swp
+ @rm -f $(TOPDIR)/nuttx_user.elf $(TOPDIR)/User.map
+
+distclean: clean
+
diff --git a/nuttx/configs/sam3u-ek/kernel/kernel.ld b/nuttx/configs/sam3u-ek/kernel/kernel.ld
new file mode 100644
index 000000000..9388bf88c
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/kernel/kernel.ld
@@ -0,0 +1,147 @@
+/****************************************************************************
+ * configs/sam3u-ek/kernal/kernel.ld
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
+ * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
+ * at address 0x2008:000 (used only for heap). When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ *
+ * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of
+ * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See
+ * also configs/sam3u-ek/knsh/ld.script
+ */
+
+MEMORY
+{
+ /* 256Kb FLASH */
+
+ kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K
+ uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K
+
+ /* 32Kb SRAM */
+
+ ksram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
+ usram1 (rwx) : ORIGIN = 0x20001000, LENGTH = 28K
+
+ /* 16Kb SRAM */
+
+ sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+}
+
+/* Force user_start into the link. This is the application entry point */
+
+EXTERN(user_start)
+
+/* Make sure that the critical memory management functions are in user-space.
+ * Currently, the plan is that the memory manager will reside in user-space
+ * but be usable both by kernel- and user-space code
+ */
+
+EXTERN(mm_initialize)
+EXTERN(mm_addregion)
+EXTERN(mm_trysemaphore)
+EXTERN(mm_givesemaphore)
+
+EXTERN(malloc)
+EXTERN(realloc)
+EXTERN(zalloc)
+EXTERN(free)
+
+OUTPUT_ARCH(arm)
+ENTRY(user_start)
+
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > uflash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > usram1 AT > uflash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >usram1
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >usram1
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > usram1
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam3u-ek/knsh/Make.defs b/nuttx/configs/sam3u-ek/knsh/Make.defs
new file mode 100644
index 000000000..313d15b52
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/knsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/sam3u-ek/knsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_SAM3U_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_SAM3U_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/knsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/knsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sam3u-ek/knsh/appconfig b/nuttx/configs/sam3u-ek/knsh/appconfig
new file mode 100644
index 000000000..3e94f548d
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/knsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/sam3u-ek/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/sam3u-ek/knsh/defconfig b/nuttx/configs/sam3u-ek/knsh/defconfig
new file mode 100755
index 000000000..06b93cc13
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/knsh/defconfig
@@ -0,0 +1,480 @@
+############################################################################
+# configs/sam3u-ek/knsh/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSPIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="sam3u"
+CONFIG_ARCH_CHIP_AT91SAM3U4E=y
+CONFIG_ARCH_BOARD="sam3u-ek"
+CONFIG_ARCH_BOARD_SAM3UEK=y
+CONFIG_BOARD_LOOPSPERMSEC=4768
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_SAM3U_CODESOURCERYW=n
+CONFIG_SAM3U_CODESOURCERYL=n
+CONFIG_SAM3U_DEVKITARM=n
+CONFIG_SAM3U_BUILDROOT=y
+
+#
+# Cortex-M3 features
+#
+CONFIG_ARMV7M_MPU=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_SAM3U_DMA=n
+CONFIG_SAM3U_NAND=n
+CONFIG_SAM3U_HSMCI=n
+CONFIG_SAM3U_UART=y
+CONFIG_SAM3U_USART0=n
+CONFIG_SAM3U_USART1=n
+CONFIG_SAM3U_USART2=n
+CONFIG_SAM3U_USART3=n
+
+#
+# Some subsystems can be configured to operate in different ways..
+# The drivers need to know how to configure the subsystem.
+#
+
+CONFIG_GPIOA_IRQ=n
+CONFIG_GPIOB_IRQ=n
+CONFIG_GPIOC_IRQ=n
+CONFIG_USART0_ISUART=y
+CONFIG_USART1_ISUART=y
+CONFIG_USART2_ISUART=y
+CONFIG_USART3_ISUART=y
+
+#
+# SAM3U specific serial device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=Y
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_UART_BAUD=115200
+CONFIG_USART0_BAUD=115200
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_UART_BITS=8
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_UART_PARITY=0
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_UART_2STOP=0
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# Setup for a two-pass build
+#
+CONFIG_BUILD_2PASS=y
+CONFIG_PASS1_BUILDIR=configs/sam3u-ek/kernel
+CONFIG_PASS1_TARGET=all
+CONFIG_PASS1_OBJECT=
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_NUTTX_KERNEL=y
+CONFIG_SYS_RESERVED=3
+CONFIG_MM_REGIONS=3
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# These NSH commands are (temporarily) disable because more support is needed
+# for these commands to work with CONFIG_NUTTX_KERNEL
+#
+CONFIG_NSH_DISABLE_MKRD=y
+CONFIG_NSH_DISABLE_MKFATFS=y
+CONFIG_NSH_DISABLE_LOSETUP=y
+CONFIG_NSH_DISABLE_DD=y
+CONFIG_NSH_DISABLE_PS=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_SDIO_BLOCKSETUP=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=31
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sam3u-ek/knsh/ld.script b/nuttx/configs/sam3u-ek/knsh/ld.script
new file mode 100755
index 000000000..34c4fbb32
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/knsh/ld.script
@@ -0,0 +1,127 @@
+/****************************************************************************
+ * configs/sam3u-ek/knsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
+ * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
+ * at address 0x2008:000 (used only for heap). When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ *
+ * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of
+ * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See
+ * also configs/sam3u-ek/kernel/kernel.ld.
+ */
+
+MEMORY
+{
+ /* 256Kb FLASH */
+
+ kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K
+ uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K
+
+ /* 32Kb SRAM */
+
+ ksram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
+ usram1 (rwx) : ORIGIN = 0x20001000, LENGTH = 28K
+
+ /* 16Kb SRAM */
+
+ sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > kflash
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > ksram1 AT > kflash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >ksram1
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >ksram1
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > ksram1
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam3u-ek/knsh/setenv.sh b/nuttx/configs/sam3u-ek/knsh/setenv.sh
new file mode 100755
index 000000000..3b27c3d9f
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/knsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/sam3u-ek/knsh/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sam3u-ek/nsh/Make.defs b/nuttx/configs/sam3u-ek/nsh/Make.defs
new file mode 100644
index 000000000..ad48c1d82
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/sam3u-ek/nsh/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_SAM3U_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_SAM3U_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sam3u-ek/nsh/appconfig b/nuttx/configs/sam3u-ek/nsh/appconfig
new file mode 100644
index 000000000..3e94f548d
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/sam3u-ek/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/sam3u-ek/nsh/defconfig b/nuttx/configs/sam3u-ek/nsh/defconfig
new file mode 100755
index 000000000..a336861f5
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nsh/defconfig
@@ -0,0 +1,455 @@
+############################################################################
+# configs/sam3u-ek/nsh/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSPIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="sam3u"
+CONFIG_ARCH_CHIP_AT91SAM3U4E=y
+CONFIG_ARCH_BOARD="sam3u-ek"
+CONFIG_ARCH_BOARD_SAM3UEK=y
+CONFIG_BOARD_LOOPSPERMSEC=4768
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_SAM3U_CODESOURCERYW=n
+CONFIG_SAM3U_CODESOURCERYL=n
+CONFIG_SAM3U_DEVKITARM=n
+CONFIG_SAM3U_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_SAM3U_DMA=n
+CONFIG_SAM3U_NAND=n
+CONFIG_SAM3U_HSMCI=n
+CONFIG_SAM3U_UART=y
+CONFIG_SAM3U_USART0=n
+CONFIG_SAM3U_USART1=n
+CONFIG_SAM3U_USART2=n
+CONFIG_SAM3U_USART3=n
+
+#
+# Some subsystems can be configured to operate in different ways..
+# The drivers need to know how to configure the subsystem.
+#
+
+CONFIG_GPIOA_IRQ=n
+CONFIG_GPIOB_IRQ=n
+CONFIG_GPIOC_IRQ=n
+CONFIG_USART0_ISUART=y
+CONFIG_USART1_ISUART=y
+CONFIG_USART2_ISUART=y
+CONFIG_USART3_ISUART=y
+
+#
+# SAM3U specific serial device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=Y
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_UART_BAUD=115200
+CONFIG_USART0_BAUD=115200
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_UART_BITS=8
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_UART_PARITY=0
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_UART_2STOP=0
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=3
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_SDIO_BLOCKSETUP=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=31
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sam3u-ek/nsh/ld.script b/nuttx/configs/sam3u-ek/nsh/ld.script
new file mode 100755
index 000000000..94ae47403
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nsh/ld.script
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/sam3u-ek/nsh/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
+ * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
+ * at address 0x2008:000 (used only for heap). When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00080000, LENGTH = 256K
+ sram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram1 AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram1
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram1
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram1
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam3u-ek/nsh/setenv.sh b/nuttx/configs/sam3u-ek/nsh/setenv.sh
new file mode 100755
index 000000000..3f4e60221
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/sam3u-ek/nsh/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sam3u-ek/nx/Make.defs b/nuttx/configs/sam3u-ek/nx/Make.defs
new file mode 100644
index 000000000..119e4d321
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nx/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/sam3u-ek/nx/Make.defs
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_SAM3U_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_SAM3U_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sam3u-ek/nx/appconfig b/nuttx/configs/sam3u-ek/nx/appconfig
new file mode 100644
index 000000000..a5ea3cccc
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sam3u-ek/nx/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/sam3u-ek/nx/defconfig b/nuttx/configs/sam3u-ek/nx/defconfig
new file mode 100755
index 000000000..5bf51a0fb
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nx/defconfig
@@ -0,0 +1,481 @@
+############################################################################
+# configs/sam3u-ek/nx/defconfig
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSPIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="sam3u"
+CONFIG_ARCH_CHIP_AT91SAM3U4E=y
+CONFIG_ARCH_BOARD="sam3u-ek"
+CONFIG_ARCH_BOARD_SAM3UEK=y
+CONFIG_BOARD_LOOPSPERMSEC=4768
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_SAM3U_CODESOURCERYW=n
+CONFIG_SAM3U_CODESOURCERYL=n
+CONFIG_SAM3U_DEVKITARM=n
+CONFIG_SAM3U_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_SAM3U_DMA=n
+CONFIG_SAM3U_NAND=n
+CONFIG_SAM3U_HSMCI=n
+CONFIG_SAM3U_UART=y
+CONFIG_SAM3U_USART0=n
+CONFIG_SAM3U_USART1=n
+CONFIG_SAM3U_USART2=n
+CONFIG_SAM3U_USART3=n
+
+#
+# Some subsystems can be configured to operate in different ways..
+# The drivers need to know how to configure the subsystem.
+#
+
+CONFIG_GPIOA_IRQ=n
+CONFIG_GPIOB_IRQ=n
+CONFIG_GPIOC_IRQ=n
+CONFIG_USART0_ISUART=y
+CONFIG_USART1_ISUART=y
+CONFIG_USART2_ISUART=y
+CONFIG_USART3_ISUART=y
+
+#
+# SAM3U specific serial device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=Y
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_UART_BAUD=115200
+CONFIG_USART0_BAUD=115200
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_UART_BITS=8
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_UART_PARITY=0
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_UART_2STOP=0
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_MM_REGIONS=3
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=18
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_SDIO_BLOCKSETUP=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=31
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x7b5d
+CONFIG_EXAMPLES_NX_COLOR1=0xe73f
+CONFIG_EXAMPLES_NX_COLOR2=0xdefb
+CONFIG_EXAMPLES_NX_TBCOLOR=0xad55
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sam3u-ek/nx/ld.script b/nuttx/configs/sam3u-ek/nx/ld.script
new file mode 100755
index 000000000..56ae5d6a4
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nx/ld.script
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/sam3u-ek/nx/ld.script
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
+ * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
+ * at address 0x2008:000 (used only for heap). When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00080000, LENGTH = 256K
+ sram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram1 AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram1
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram1
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram1
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam3u-ek/nx/setenv.sh b/nuttx/configs/sam3u-ek/nx/setenv.sh
new file mode 100755
index 000000000..a7e9efc84
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/nx/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/sam3u-ek/nx/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sam3u-ek/ostest/Make.defs b/nuttx/configs/sam3u-ek/ostest/Make.defs
new file mode 100644
index 000000000..79ff50e14
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/sam3u-ek/ostest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_SAM3U_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_SAM3U_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sam3u-ek/ostest/appconfig b/nuttx/configs/sam3u-ek/ostest/appconfig
new file mode 100644
index 000000000..687a5c13f
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sam3u-ek/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/sam3u-ek/ostest/defconfig b/nuttx/configs/sam3u-ek/ostest/defconfig
new file mode 100755
index 000000000..2757531f0
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/ostest/defconfig
@@ -0,0 +1,455 @@
+############################################################################
+# configs/sam3u-ek/ostest/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSPIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="sam3u"
+CONFIG_ARCH_CHIP_AT91SAM3U4E=y
+CONFIG_ARCH_BOARD="sam3u-ek"
+CONFIG_ARCH_BOARD_SAM3UEK=y
+CONFIG_BOARD_LOOPSPERMSEC=4768
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_SAM3U_CODESOURCERYW=n
+CONFIG_SAM3U_CODESOURCERYL=n
+CONFIG_SAM3U_DEVKITARM=n
+CONFIG_SAM3U_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_SAM3U_DMA=n
+CONFIG_SAM3U_NAND=n
+CONFIG_SAM3U_HSMCI=n
+CONFIG_SAM3U_UART=y
+CONFIG_SAM3U_USART0=n
+CONFIG_SAM3U_USART1=n
+CONFIG_SAM3U_USART2=n
+CONFIG_SAM3U_USART3=n
+CONFIG_SAM3U_NAND=n
+
+#
+# Some subsystems can be configured to operate in different ways..
+# The drivers need to know how to configure the subsystem.
+#
+
+CONFIG_GPIOA_IRQ=n
+CONFIG_GPIOB_IRQ=n
+CONFIG_GPIOC_IRQ=n
+CONFIG_USART0_ISUART=y
+CONFIG_USART1_ISUART=y
+CONFIG_USART2_ISUART=y
+CONFIG_USART3_ISUART=y
+
+#
+# SAM3U specific serial device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=Y
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_UART_BAUD=115200
+CONFIG_USART0_BAUD=115200
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_UART_BITS=8
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_UART_PARITY=0
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_UART_2STOP=0
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=3
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=31
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sam3u-ek/ostest/ld.script b/nuttx/configs/sam3u-ek/ostest/ld.script
new file mode 100755
index 000000000..70fd611e7
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/ostest/ld.script
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/sam3u-ek/ostest/ld.script
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
+ * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
+ * at address 0x2008:000 (used only for heap). When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00080000, LENGTH = 256K
+ sram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram1 AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram1
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram1
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram1
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam3u-ek/ostest/setenv.sh b/nuttx/configs/sam3u-ek/ostest/setenv.sh
new file mode 100755
index 000000000..06d5eb547
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/sam3u-ek/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sam3u-ek/src/Makefile b/nuttx/configs/sam3u-ek/src/Makefile
new file mode 100644
index 000000000..193be03d0
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/Makefile
@@ -0,0 +1,96 @@
+############################################################################
+# configs/sam3u-ek/src/Makefile
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_leds.c up_buttons.c up_spi.c up_usbdev.c up_lcd.c
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+ifeq ($(CONFIG_SAM3U_HSMCI),y)
+CSRCS += up_mmcsd.c
+endif
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+ifeq ($(CONFIG_INPUT_ADS7843E),y)
+CSRCS += up_touchscreen.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/sam3u-ek/src/sam3uek_internal.h b/nuttx/configs/sam3u-ek/src/sam3uek_internal.h
new file mode 100644
index 000000000..5b5138960
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/sam3uek_internal.h
@@ -0,0 +1,257 @@
+/************************************************************************************
+ * configs/sam3uek_eval/src/sam3uek_internal.h
+ * arch/arm/src/board/sam3uek_internal.n
+ *
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_SAM3U_EK_SRC_SAM3UEK_INTERNAL_H
+#define __CONFIGS_SAM3U_EK_SRC_SAM3UEK_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include <stdint.h>
+
+#include <arch/irq.h>
+#include <nuttx/irq.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* External Memory Usage ************************************************************/
+/* LCD on CS2 */
+
+#define LCD_BASE SAM3U_EXTCS2_BASE
+
+/* Touchscreen controller (TSC) */
+
+#define CONFIG_TSC_ADS7843 1 /* ADS7843 present on board */
+#define CONFIG_TSC_SPI 0 /* On SPI0 */
+
+/* SAM3U-EK GPIO Pin Definitions ****************************************************/
+
+/* LCD:
+ * LCD Module Pin Out: AT91SAM3U PIO:
+ * -------------------------------------------- --------------------------------------
+ * Pin Symbol Function LCD PeriphA PeriphB Extra
+ * ---- ------ -------------------------------- -------------- -------- ------- ------
+ * 1 GND Ground N/A --- --- ---
+ * 2 CS Chip Select PC16 NCS2 PWML3 AD12BAD5
+ * 3 RS Register select signal PB8 (see A1) CTS0 A1 AD3
+ * 4 WR Write operation signal PB23 (NWE) NWR0/NEW PCK1 ---
+ * 5 RD Read operation signal PB19 (NRD) NRD PWML2 ---
+ * 6 DB0 Data bus PB9 D0 DTR0 ---
+ * 7 DB1 Data bus PB10 D1 DSR0 ---
+ * 8 DB2 Data bus PB11 D2 DCD0 ---
+ * 9 DB3 Data bus PB12 D3 RI0 ---
+ * 10 DB4 Data bus PB13 D4 PWMH0 ---
+ * 11 DB5 Data bus PB14 D5 PWMH1 ---
+ * 12 DB6 Data bus PB15 D6 PWMH2 ---
+ * 13 DB7 Data bus PB16 D7 PMWH3 ---
+ * 14 DB8 Data bus PB25 D8 PWML0 ---
+ * 15 DB9 Data bus PB26 D9 PWML1 ---
+ * 16 DB10 Data bus PB27 D10 PWML2 ---
+ * 17 DB11 Data bus PB28 D11 PWML3 ---
+ * 18 DB12 Data bus PB29 D12 --- ---
+ * 19 DB13 Data bus PB30 D13 --- ---
+ * 20 DB14 Data bus PB31 D14 --- ---
+ * 21 DB15 Data bus PB6 TIOA1 D15 AD1
+ * 22 NC No connection N/A --- --- ---
+ * 23 NC No connection N/A --- --- ---
+ * 24 RESET Reset signal N/A --- --- ---
+ * 25 GND Ground N/A --- --- ---
+ * 26 X+ Touch panel X_RIGHT PA15 SPCK PWMH2 ---
+ * 27 Y+ Touch panel Y_UP PA14 MOSI --- ---
+ * 28 X- Touch panel X_LEFT PA13 MISO --- ---
+ * 29 Y- Touch panel Y_DOWN PC14 A3 NPCS2 ---
+ * 30 GND Ground N/A --- --- ---
+ * 31 VDD1 Power supply for digital IO Pad N/A --- --- ---
+ * 32 VDD2 Power supply for analog circuit N/A --- --- ---
+ * 33 A1 Power supply for backlight PB8 (see RS) CTS0 A1 AD3
+ * 34 A2 Power supply for backlight N/A --- --- ---
+ * 35 A3 Power supply for backlight N/A --- --- ---
+ * 36 A4 Power supply for backlight N/A --- --- ---
+ * 37 NC No connection N/A --- --- ---
+ * 38 NC No connection N/A --- --- ---
+ * 39 K Backlight ground N/A --- --- ---
+ */
+
+#define GPIO_LCD_NCS2 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOC|GPIO_PIN16)
+#define GPIO_LCD_RS (GPIO_PERIPHB|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN8)
+#define GPIO_LCD_NWE (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN23)
+#define GPIO_LCD_NRD (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN19)
+
+#define GPIO_LCD_D0 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN9)
+#define GPIO_LCD_D1 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN10)
+#define GPIO_LCD_D2 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN11)
+#define GPIO_LCD_D3 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN12)
+#define GPIO_LCD_D4 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN13)
+#define GPIO_LCD_D5 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN14)
+#define GPIO_LCD_D6 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN15)
+#define GPIO_LCD_D7 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN16)
+#define GPIO_LCD_D8 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN25)
+#define GPIO_LCD_D9 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN26)
+#define GPIO_LCD_D10 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN27)
+#define GPIO_LCD_D11 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN28)
+#define GPIO_LCD_D12 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN29)
+#define GPIO_LCD_D13 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN30)
+#define GPIO_LCD_D14 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN31)
+#define GPIO_LCD_D15 (GPIO_PERIPHB|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN6)
+
+/* LCD Backlight pin definition. */
+
+#define GPIO_LCD_BKL (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_OUTPUT_CLEAR|GPIO_PORT_PIOC|GPIO_PIN19)
+
+/* Touchscreen controller (TSC) */
+
+#define GPIO_TCS_IRQ (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN24)
+#define GPIO_TCS_BUSY (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN2)
+
+#define SAM3U_TCS_IRQ SAM3U_IRQ_PA24
+
+/* LEDs */
+
+#define GPIO_LED0 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_CLEAR|GPIO_PIN0)
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN1)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN2)
+
+/* BUTTONS */
+
+#define GPIO_BUTTON1 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN18)
+#define GPIO_BUTTON2 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN19)
+
+#define IRQ_BUTTON1 SAM3U_IRQ_PA18
+#define IRQ_BUTTON2 SAM3U_IRQ_PA19
+
+/* SD Card Detect */
+
+#define GPIO_MCI_CD (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN25)
+
+/* SPI Chip Selects */
+
+/* Chip select pin connected to the touchscreen controller and to the ZigBee module
+ * connector. Notice that the touchscreen chip select is implemented as a GPIO
+ * OUTPUT that must be controlled by board-specific. This is because the ADS7843E
+ * driver must be able to sample the device BUSY GPIO input between SPI transfers.
+ * However, the AD7843E will tri-state the BUSY input whenever the chip select is
+ * de-asserted. So the only option is to control the chip select manually and hold
+ * it low throughout the SPI transfer.
+ */
+
+#define GPIO_TSC_NPCS2 (GPIO_OUTPUT|GPIO_CFG_PULLUP|GPIO_OUTPUT_SET|\
+ GPIO_PORT_PIOC|GPIO_PIN14)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam3u_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the SAM3U-EK board.
+ *
+ ************************************************************************************/
+
+extern void weak_function sam3u_spiinitialize(void);
+
+/************************************************************************************
+ * Name: sam3u_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the SAM3U-EK board.
+ *
+ ************************************************************************************/
+
+extern void weak_function sam3u_usbinitialize(void);
+
+/****************************************************************************
+ * Name: sam3u_hsmciinit
+ *
+ * Description:
+ * Initialize HSMCI support
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SAM3U_HSMCI
+extern int weak_function sam3u_hsmciinit(void);
+#else
+# define sam3u_hsmciinit()
+#endif
+
+/****************************************************************************
+ * Name: sam3u_cardinserted
+ *
+ * Description:
+ * Check if a card is inserted into the selected HSMCI slot
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SAM3U_HSMCI
+extern bool sam3u_cardinserted(unsigned char slot);
+#else
+# define sam3u_cardinserted(slot) (false)
+#endif
+
+/****************************************************************************
+ * Name: sam3u_writeprotected
+ *
+ * Description:
+ * Check if a card is inserted into the selected HSMCI slot
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SAM3U_HSMCI
+extern bool sam3u_writeprotected(unsigned char slot);
+#else
+# define sam3u_writeprotected(slot) (false)
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SAM3U_EK_SRC_SAM3UEK_INTERNAL_H */
+
diff --git a/nuttx/configs/sam3u-ek/src/up_boot.c b/nuttx/configs/sam3u-ek/src/up_boot.c
new file mode 100644
index 000000000..87e91f039
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_boot.c
@@ -0,0 +1,113 @@
+/************************************************************************************
+ * configs/sam3u-ek/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "sam3uek_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam3u_boardinitialize
+ *
+ * Description:
+ * All SAM3U architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void sam3u_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * sam3u_spiinitialize() has been brought into the link.
+ */
+
+#ifdef CONFIG_SAM3U_SPI
+ if (sam3u_spiinitialize)
+ {
+ sam3u_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB if 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function sam3u_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_SAM3U_USB)
+ if (sam3u_usbinitialize)
+ {
+ sam3u_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+
+ /* Setup SD card-related PIOs if 1) HSMCI is selected and 2) the weak
+ * function sam3u_hsmciinit() has been brought into the build.
+ */
+
+#ifdef CONFIG_SAM3U_HSMCI
+ if (sam3u_hsmciinit)
+ {
+ sam3u_hsmciinit();
+ }
+#endif
+}
diff --git a/nuttx/configs/sam3u-ek/src/up_buttons.c b/nuttx/configs/sam3u-ek/src/up_buttons.c
new file mode 100644
index 000000000..a4b8e0fd7
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_buttons.c
@@ -0,0 +1,185 @@
+/****************************************************************************
+ * configs/sam3u-ek/src/up_leds.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <nuttx/irq.h>
+
+#include <arch/irq.h>
+#include <arch/board/board.h>
+
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static xcpt_t g_irqbutton1;
+static xcpt_t g_irqbutton2;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_irqbuttonx
+ *
+ * Description:
+ * This function implements the core of the up_irqbutton() logic.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
+static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler, xcpt_t *store)
+{
+ xcpt_t oldhandler;
+ irqstate_t flags;
+
+ /* Disable interrupts until we are done. This guarantees that the following
+ * operations are atomic.
+ */
+
+ flags = irqsave();
+
+ /* Get the old button interrupt handler and save the new one */
+
+ oldhandler = *store;
+ *store = irqhandler;
+
+ /* Configure the interrupt */
+
+ sam3u_gpioirq(irq);
+ (void)irq_attach(irq, irqhandler);
+ sam3u_gpioirqenable(irq);
+ irqrestore(flags);
+
+ /* Return the old button handler (so that it can be restored) */
+
+ return oldhandler;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ (void)sam3u_configgpio(GPIO_BUTTON1);
+ (void)sam3u_configgpio(GPIO_BUTTON2);
+}
+
+/************************************************************************************
+ * Name: up_buttons
+ *
+ * Description:
+ * After up_buttoninit() has been called, up_buttons() may be called to collect
+ * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit
+ * associated with a button. See the BUTTON* definitions above for the meaning of
+ * each bit in the returned value.
+ *
+ ************************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t retval;
+
+ retval = sam3u_gpioread(GPIO_BUTTON1) ? 0 : GPIO_BUTTON1;
+ retval |= sam3u_gpioread(GPIO_BUTTON2) ? 0 : GPIO_BUTTON2;
+
+ return retval;
+}
+
+/****************************************************************************
+ * Name: up_irqbutton
+ *
+ * Description:
+ * This function may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is one
+ * of the BUTTON* definitions provided above. The previous interrupt
+ * handler address isreturned (so that it may restored, if so desired).
+ *
+ * Configuration Notes:
+ * Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
+ * overall GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
+ * CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
+ * interrupts on. For button support, bits 2 and 3 must be set in
+ * CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3).
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ if (id == BUTTON1)
+ {
+ return up_irqbuttonx(IRQ_BUTTON1, irqhandler, &g_irqbutton1);
+ }
+ else if (id == BUTTON2)
+ {
+ return up_irqbuttonx(IRQ_BUTTON2, irqhandler, &g_irqbutton2);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+#endif
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/sam3u-ek/src/up_lcd.c b/nuttx/configs/sam3u-ek/src/up_lcd.c
new file mode 100644
index 000000000..de897ab9f
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_lcd.c
@@ -0,0 +1,1069 @@
+/**************************************************************************************
+ * configs/sam3u-ek/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/**************************************************************************************
+ * The SAM3U-EK developement board features a TFT/Transmissive color LCD module with
+ * touch-screen, FTM280C12D, with integratd driver IC HX8346. The LCD display size
+ * is 2.8 inches, with a native resolution of 240 x 320 pixels.
+ *
+ * LCD Module Pin Out: AT91SAM3U PIO:
+ * -------------------------------------------- --------------------------------------
+ * Pin Symbol Function LCD PeriphA PeriphB Extra
+ * ---- ------ -------------------------------- -------------- -------- ------- ------
+ * 1 GND Ground N/A --- --- ---
+ * 2 CS Chip Select PC16 NCS2 PWML3 AD12BAD5
+ * 3 RS Register select signal PB8 (see A1) CTS0 A1 AD3
+ * 4 WR Write operation signal PB23 (NWE) NWR0/NEW PCK1 ---
+ * 5 RD Read operation signal PB19 (NRD) NRD PWML2 ---
+ * 6 DB0 Data bus PB9 D0 DTR0 ---
+ * 7 DB1 Data bus PB10 D1 DSR0 ---
+ * 8 DB2 Data bus PB11 D2 DCD0 ---
+ * 9 DB3 Data bus PB12 D3 RI0 ---
+ * 10 DB4 Data bus PB13 D4 PWMH0 ---
+ * 11 DB5 Data bus PB14 D5 PWMH1 ---
+ * 12 DB6 Data bus PB15 D6 PWMH2 ---
+ * 13 DB7 Data bus PB16 D7 PMWH3 ---
+ * 14 DB8 Data bus PB25 D8 PWML0 ---
+ * 15 DB9 Data bus PB26 D9 PWML1 ---
+ * 16 DB10 Data bus PB27 D10 PWML2 ---
+ * 17 DB11 Data bus PB28 D11 PWML3 ---
+ * 18 DB12 Data bus PB29 D12 --- ---
+ * 19 DB13 Data bus PB30 D13 --- ---
+ * 20 DB14 Data bus PB31 D14 --- ---
+ * 21 DB15 Data bus PB6 TIOA1 D15 AD1
+ * 22 NC No connection N/A --- --- ---
+ * 23 NC No connection N/A --- --- ---
+ * 24 RESET Reset signal N/A --- --- ---
+ * 25 GND Ground N/A --- --- ---
+ * 26 X+ Touch panel X_RIGHT PA15 SPCK PWMH2 ---
+ * 27 Y+ Touch panel Y_UP PA14 MOSI --- ---
+ * 28 X- Touch panel X_LEFT PA13 MISO --- ---
+ * 29 Y- Touch panel Y_DOWN PC14 A3 NPCS2 ---
+ * 30 GND Ground N/A --- --- ---
+ * 31 VDD1 Power supply for digital IO Pad N/A --- --- ---
+ * 32 VDD2 Power supply for analog circuit N/A --- --- ---
+ * 33 A1 Power supply for backlight PB8 (see RS) CTS0 A1 AD3
+ * 34 A2 Power supply for backlight N/A --- --- ---
+ * 35 A3 Power supply for backlight N/A --- --- ---
+ * 36 A4 Power supply for backlight N/A --- --- ---
+ * 37 NC No connection N/A --- --- ---
+ * 38 NC No connection N/A --- --- ---
+ * 39 K Backlight ground N/A --- --- ---
+ *
+ * The LCD module gets its reset from NRST. As explained previously, this NRST is
+ * shared with the JTAG port and the push button BP1. The LCD chip select signal is
+ * connected to NCS2 (a dedicated jumper can disable it, making NCS2 available for
+ * other custom usage).
+ *
+ * The SAM3U4E communicates with the LCD through PIOB where a 16-bit parallel
+ * “8080-like” protocol data bus has to be implemented by software.
+ *
+ * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3194
+ * charge pump, MN4. The AAT3194 is controlled by the SAM3U4E through a single line
+ * Simple Serial Control (S2Cwire) interface, which permits to enable, disable, and
+ * set the LED drive current (LED brightness control) from a 32-level logarithmic
+ * scale. Four resistors R93/R94/R95/R96 are implemented for optional current
+ * limitation.
+ *
+ * The LCD module integrates a 4-wire touch screen panel controlled by
+ * MN5, ADS7843, which is a slave device on the SAM3U4E SPI bus. The ADS7843 touch
+ * ADC auxiliary inputs IN3/IN4 are connected to test points for optional function
+ * extension.
+ *
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/rgbcolors.h>
+
+#include <arch/irq.h>
+
+#include "up_arch.h"
+#include "sam3u_pmc.h"
+#include "sam3u_smc.h"
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+
+/* Configuration **********************************************************************/
+
+/* Define the following to enable register-level debug output */
+
+#undef CONFIG_LCD_REGDEBUG
+
+/* Verbose debug must also be enabled */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_LCD_REGDEBUG
+#endif
+
+/* CONFIG_LCD_MAXCONTRAST -- must be defined and less than 32 */
+
+#if !defined(CONFIG_LCD_MAXCONTRAST) || CONFIG_LCD_MAXCONTRAST < 1 || CONFIG_LCD_MAXCONTRAST > 31
+# error "CONFIG_LCD_MAXCONTRAST must be defined in the range 1 to 31"
+#endif
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_LCD_REGDEBUG
+# define regdbg(format, arg...) vdbg(format, ##arg)
+#else
+# define regdbg(x...)
+#endif
+
+/* Graphics Capbilities ***************************************************************/
+
+/* LCD resolution: 320 (columns) by 240 (rows). The physical dimensions of the device
+ * are really 240 (columns) by 320 (rows), but unless CONFIG_LCD_PORTRAIT is defined,
+ * we swap rows and columns in setcursor to make things behave nicer (there IS a
+ * performance hit for this swap!).
+ */
+
+#ifdef CONFIG_LCD_PORTRAIT
+# define SAM3UEK_XRES 240
+# define SAM3UEK_YRES 320
+#else
+# define SAM3UEK_XRES 320
+# define SAM3UEK_YRES 240
+#endif
+
+/* Color depth and format. BPP=16 R=6, G=6, B=5: RRRR RBBB BBBG GGGG */
+
+#define SAM3UEK_BPP 16
+#define SAM3UEK_RGBFMT FB_FMT_RGB16_565
+
+/* HX834x Definitions ****************************************************************/
+
+/* HX834x register select */
+
+#define HX843X_LCD_RS (1 << 1)
+
+/* HX8347 ID code */
+
+#define HX8347_CHIPID 0x47
+
+/* HX8347 LCD Registers */
+
+#define HX8347_R00H 0x00
+#define HX8347_R01H 0x01
+#define HX8347_R02H 0x02
+#define HX8347_R03H 0x03
+#define HX8347_R04H 0x04
+#define HX8347_R05H 0x05
+#define HX8347_R06H 0x06
+#define HX8347_R07H 0x07
+#define HX8347_R08H 0x08
+#define HX8347_R09H 0x09
+#define HX8347_R0AH 0x0a
+#define HX8347_R0CH 0x0c
+#define HX8347_R0DH 0x0d
+#define HX8347_R0EH 0x0e
+#define HX8347_R0FH 0x0f
+#define HX8347_R10H 0x10
+#define HX8347_R11H 0x11
+#define HX8347_R12H 0x12
+#define HX8347_R13H 0x13
+#define HX8347_R14H 0x14
+#define HX8347_R15H 0x15
+#define HX8347_R16H 0x16
+#define HX8347_R18H 0x18
+#define HX8347_R19H 0x19
+#define HX8347_R1AH 0x1a
+#define HX8347_R1BH 0x1b
+#define HX8347_R1CH 0x1c
+#define HX8347_R1DH 0x1d
+#define HX8347_R1EH 0x1e
+#define HX8347_R1FH 0x1f
+#define HX8347_R20H 0x20
+#define HX8347_R21H 0x21
+#define HX8347_R22H 0x22
+#define HX8347_R23H 0x23
+#define HX8347_R24H 0x24
+#define HX8347_R25H 0x25
+#define HX8347_R26H 0x26
+#define HX8347_R27H 0x27
+#define HX8347_R28H 0x28
+#define HX8347_R29H 0x29
+#define HX8347_R2AH 0x2a
+#define HX8347_R2BH 0x2b
+#define HX8347_R2CH 0x2c
+#define HX8347_R2DH 0x2d
+#define HX8347_R35H 0x35
+#define HX8347_R36H 0x36
+#define HX8347_R37H 0x37
+#define HX8347_R38H 0x38
+#define HX8347_R39H 0x39
+#define HX8347_R3AH 0x3a
+#define HX8347_R3BH 0x3b
+#define HX8347_R3CH 0x3c
+#define HX8347_R3DH 0x3d
+#define HX8347_R3EH 0x3e
+#define HX8347_R40H 0x40
+#define HX8347_R41H 0x41
+#define HX8347_R42H 0x42
+#define HX8347_R43H 0x43
+#define HX8347_R44H 0x44
+#define HX8347_R45H 0x45
+#define HX8347_R46H 0x46
+#define HX8347_R47H 0x47
+#define HX8347_R48H 0x48
+#define HX8347_R49H 0x49
+#define HX8347_R4AH 0x4a
+#define HX8347_R4BH 0x4b
+#define HX8347_R4CH 0x4c
+#define HX8347_R4DH 0x4d
+#define HX8347_R4EH 0x4e
+#define HX8347_R4FH 0x4f
+#define HX8347_R50H 0x50
+#define HX8347_R51H 0x51
+#define HX8347_R64H 0x64
+#define HX8347_R65H 0x65
+#define HX8347_R66H 0x66
+#define HX8347_R67H 0x67
+#define HX8347_R70H 0x70
+#define HX8347_R72H 0x72
+#define HX8347_R90H 0x90
+#define HX8347_R91H 0x91
+#define HX8347_R93H 0x93
+#define HX8347_R94H 0x94
+#define HX8347_R95H 0x95
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/* This structure describes the state of this driver */
+
+struct sam3u_dev_s
+{
+ /* Publically visible device structure */
+
+ struct lcd_dev_s dev;
+
+ /* Private device state */
+
+ uint8_t power; /* The current power setting */
+};
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+
+/* Low-level HX834x Register access */
+
+static void sam3u_putreg(uint16_t reg, uint16_t data);
+static uint16_t sam3u_getreg(uint16_t reg);
+
+/* Misc. LCD Helper Functions */
+
+static void sam3u_setcursor(fb_coord_t row, fb_coord_t col);
+static inline void sam3u_wrsetup(void);
+static inline void sam3u_wrram(uint16_t color);
+static inline uint16_t sam3u_rdram(void);
+static void sam3u_lcdon(void);
+static void sam3u_lcdoff(void);
+
+#ifdef CONFIG_DEBUG_GRAPHICS
+static void sam3u_dumpreg(uint8_t startreg, uint8_t endreg);
+#else
+# define sam3u_dumpreg(startreg,endreg)
+#endif
+
+/* LCD Data Transfer Methods */
+
+static int sam3u_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels);
+static int sam3u_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels);
+
+/* LCD Configuration */
+
+static int sam3u_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo);
+static int sam3u_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo);
+
+/* LCD RGB Mapping */
+
+#ifdef CONFIG_FB_CMAP
+# error "RGB color mapping not supported by this driver"
+#endif
+
+/* Cursor Controls */
+
+#ifdef CONFIG_FB_HWCURSOR
+# error "Cursor control not supported by this driver"
+#endif
+
+/* LCD Specific Controls */
+
+static int sam3u_getpower(struct lcd_dev_s *dev);
+static int sam3u_setpower(struct lcd_dev_s *dev, int power);
+static int sam3u_getcontrast(struct lcd_dev_s *dev);
+static int sam3u_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is working memory allocated by the LCD driver for each LCD device
+ * and for each color plane. This memory will hold one raster line of data.
+ * The size of the allocated run buffer must therefor be at least
+ * (bpp * xres / 8). Actual alignment of the buffer must conform to the
+ * bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
+ */
+
+static uint16_t g_runbuffer[SAM3UEK_XRES];
+
+/* This structure describes the overall LCD video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{
+ .fmt = SAM3UEK_RGBFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */
+ .xres = SAM3UEK_XRES, /* Horizontal resolution in pixel columns */
+ .yres = SAM3UEK_YRES, /* Vertical resolution in pixel rows */
+ .nplanes = 1, /* Number of color planes supported */
+};
+
+/* This is the standard, NuttX Plane information object */
+
+static const struct lcd_planeinfo_s g_planeinfo =
+{
+ .putrun = sam3u_putrun, /* Put a run into LCD memory */
+ .getrun = sam3u_getrun, /* Get a run from LCD memory */
+ .buffer = (uint8_t*)g_runbuffer, /* Run scratch buffer */
+ .bpp = SAM3UEK_BPP, /* Bits-per-pixel */
+};
+
+/* This is the standard, NuttX LCD driver object */
+
+static struct sam3u_dev_s g_lcddev_s =
+{
+ .dev =
+ {
+ /* LCD Configuration */
+
+ .getvideoinfo = sam3u_getvideoinfo,
+ .getplaneinfo = sam3u_getplaneinfo,
+
+ /* LCD RGB Mapping -- Not supported */
+ /* Cursor Controls -- Not supported */
+
+ /* LCD Specific Controls */
+
+ .getpower = sam3u_getpower,
+ .setpower = sam3u_setpower,
+ .getcontrast = sam3u_getcontrast,
+ .setcontrast = sam3u_setcontrast,
+ },
+};
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: sam3u_putreg
+ *
+ * Description:
+ * Write to a HX834x register
+ *
+ **************************************************************************************/
+
+static void sam3u_putreg(uint16_t reg, uint16_t data)
+{
+ regdbg("base: %08x RS: %04x data: %04x\n", LCD_BASE, LCD_BASE + HX843X_LCD_RS, data);
+ putreg16(reg, LCD_BASE);
+ putreg16(data, LCD_BASE + HX843X_LCD_RS);
+}
+
+/**************************************************************************************
+ * Name: sam3u_getreg
+ *
+ * Description:
+ * Read from a HX834x register
+ *
+ **************************************************************************************/
+
+static uint16_t sam3u_getreg(uint16_t reg)
+{
+ uint16_t data;
+ putreg16(reg, LCD_BASE);
+ data = getreg16(LCD_BASE + HX843X_LCD_RS);
+ regdbg("base: %08x RS: %04x data: %04x\n", LCD_BASE, LCD_BASE + HX843X_LCD_RS, data);
+ return data;
+}
+
+/**************************************************************************************
+ * Name: sam3u_setcursor
+ *
+ * Description:
+ * Set the LCD cursor position.
+ *
+ **************************************************************************************/
+
+static void sam3u_setcursor(fb_coord_t row, fb_coord_t col)
+{
+ uint8_t x1;
+ uint8_t x2;
+ uint8_t y1;
+ uint8_t y2;
+
+ /* Get the upper and lower x and y positions */
+
+ x1 = (uint8_t)col;
+ x2 = (uint8_t)((uint16_t)col >> 8);
+
+ y1 = (uint8_t)row;
+ y2 = (uint8_t)((uint16_t)row >> 8);
+
+ /* Then set the cursor position */
+
+ sam3u_putreg(HX8347_R02H, x2); /* column high */
+ sam3u_putreg(HX8347_R03H, x1); /* column low */
+ sam3u_putreg(HX8347_R06H, y2); /* row high */
+ sam3u_putreg(HX8347_R07H, y1); /* row low */
+}
+
+/**************************************************************************************
+ * Name: sam3u_wrsetup
+ *
+ * Description:
+ * Set up for a GRAM write operation.
+ *
+ **************************************************************************************/
+
+static inline void sam3u_wrsetup(void)
+{
+ putreg16(HX8347_R22H, LCD_BASE);
+}
+
+/**************************************************************************************
+ * Name: sam3u_wrram
+ *
+ * Description:
+ * Write to the 16-bit GRAM register
+ *
+ **************************************************************************************/
+
+static inline void sam3u_wrram(uint16_t color)
+{
+ putreg16(color, LCD_BASE + HX843X_LCD_RS);
+}
+
+/**************************************************************************************
+ * Name: sam3u_rdram
+ *
+ * Description:
+ * Read from the 16-bit GRAM register
+ *
+ **************************************************************************************/
+
+static inline uint16_t sam3u_rdram(void)
+{
+ return getreg16(LCD_BASE + HX843X_LCD_RS);
+}
+
+/**************************************************************************************
+ * Name: sam3u_lcdon
+ *
+ * Description:
+ * Turn the LCD on
+ *
+ **************************************************************************************/
+
+static void sam3u_lcdon(void)
+{
+ /* Display ON Setting */
+
+ gvdbg("ON\n");
+ sam3u_putreg(HX8347_R90H, 0x7f); /* SAP=0111 1111 */
+ sam3u_putreg(HX8347_R26H, 0x04); /* GON=0 DTE=0 D=01 */
+ up_mdelay(100);
+ sam3u_putreg(HX8347_R26H, 0x24); /* GON=1 DTE=0 D=01 */
+ sam3u_putreg(HX8347_R26H, 0x2c); /* GON=1 DTE=0 D=11 */
+ up_mdelay(100);
+ sam3u_putreg(HX8347_R26H, 0x3c); /* GON=1 DTE=1 D=11 */
+}
+
+/**************************************************************************************
+ * Name: sam3u_lcdoff
+ *
+ * Description:
+ * Turn the LCD off
+ *
+ **************************************************************************************/
+
+static void sam3u_lcdoff(void)
+{
+ gvdbg("OFF\n");
+ sam3u_putreg(HX8347_R90H, 0x00); /* SAP=0000 0000 */
+ sam3u_putreg(HX8347_R26H, 0x00); /* GON=0 DTE=0 D=00 */
+}
+
+/**************************************************************************************
+ * Name: sam3u_dumpreg
+ *
+ * Description:
+ * Dump a range of LCD registers.
+ *
+ **************************************************************************************/
+
+#ifdef CONFIG_DEBUG_GRAPHICS
+static void sam3u_dumpreg(uint8_t startreg, uint8_t endreg)
+{
+ uint16_t value;
+ uint8_t addr;
+
+ for (addr = startreg; addr <= endreg; addr++)
+ {
+ value = sam3u_getreg(addr);
+ gdbg(" %02x: %04x\n", addr, value);
+ }
+}
+#endif
+
+/**************************************************************************************
+ * Name: sam3u_putrun
+ *
+ * Description:
+ * This method can be used to write a partial raster line to the LCD:
+ *
+ * row - Starting row to write to (range: 0 <= row < yres)
+ * col - Starting column to write to (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer containing the run to be written to the LCD
+ * npixels - The number of pixels to write to the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int sam3u_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels)
+{
+ uint16_t *run = (uint16_t*)buffer;
+ unsigned int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ gvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+#ifdef CONFIG_LCD_PORTRAIT
+ /* Set up to write the run. */
+
+ sam3u_setcursor(row, col);
+ sam3u_wrsetup();
+
+ /* Write the run to GRAM. */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the pixel pixel to GRAM */
+
+ sam3u_wrram(*run++);
+ }
+#else
+ /* Write the run to GRAM. Because rows and colums are swapped, we need to reset
+ * the cursor position for every pixel. We could do this much faster if we
+ * adapted to the strange device aspect ratio.
+ */
+
+ col = 319-col;
+ for (i = 0; i < npixels; i++)
+ {
+ /* Set up to write the next pixel. Swapping x and y orientations so that the image
+ * comes out with the 320x240 aspect ratio (not the native 240x320). That is:
+ *
+ * row: 0-239 maps to x: 0-239
+ * col: 0-319 maps to y: 319-0
+ */
+
+ sam3u_setcursor(col--, row);
+ sam3u_wrsetup();
+
+ /* Write the pixel pixel to GRAM */
+
+ sam3u_wrram(*run++);
+ }
+#endif
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: sam3u_getrun
+ *
+ * Description:
+ * This method can be used to read a partial raster line from the LCD:
+ *
+ * row - Starting row to read from (range: 0 <= row < yres)
+ * col - Starting column to read read (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer in which to return the run read from the LCD
+ * npixels - The number of pixels to read from the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int sam3u_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels)
+{
+ uint16_t *run = (uint16_t*)buffer;
+ unsigned int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ gvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+#ifdef CONFIG_LCD_PORTRAIT
+ /* Set up to read the run */
+
+ sam3u_setcursor(row, col);
+
+ /* Read the run from GRAM. */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel */
+
+ *run++ = sam3u_rdram();
+ }
+#else
+ /* Read the run from GRAM Because rows and colums are swapped, we need to reset
+ * the cursor position for every pixel. We could do this much faster if we
+ * adapted to the strange device aspect ratio.
+ */
+
+ col = 319 - col;
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel.. Swapping x and y orientations so that the image
+ * comes out with the 320x240 aspect ratio (not the native 240x320). That is:
+ *
+ * row: 0-239 maps to x: 0-239
+ * col: 0-319 maps to y: 319-0
+ */
+
+ sam3u_setcursor(col--, row);
+ *run++ = sam3u_rdram();
+ }
+#endif
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: sam3u_getvideoinfo
+ *
+ * Description:
+ * Get information about the LCD video controller configuration.
+ *
+ **************************************************************************************/
+
+static int sam3u_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ DEBUGASSERT(dev && vinfo);
+ gvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
+ g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: sam3u_getplaneinfo
+ *
+ * Description:
+ * Get information about the configuration of each LCD color plane.
+ *
+ **************************************************************************************/
+
+static int sam3u_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo)
+{
+ DEBUGASSERT(dev && pinfo && planeno == 0);
+ gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
+ memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: sam3u_getpower
+ *
+ * Description:
+ * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on. On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int sam3u_getpower(struct lcd_dev_s *dev)
+{
+ struct sam3u_dev_s *priv = (struct sam3u_dev_s *)dev;
+ DEBUGASSERT(dev);
+ gvdbg("power: %d\n", priv->power);
+ return priv->power;
+}
+
+/**************************************************************************************
+ * Name: sam3u_setpower
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWERL: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3194 charge
+ * pump, MN4. The AAT3194 is controlled by the SAM3U4E through a single line. Simple
+ * Serial Control (S2Cwire) interface, which permits to enable, disable, and set the
+ * LED drive current (LED brightness control) from a 32-level logarithmic scale. Four
+ * resistors R93/R94/R95/R96 are implemented for optional current limitation.
+ *
+ **************************************************************************************/
+
+static int sam3u_setpower(struct lcd_dev_s *dev, int power)
+{
+ struct sam3u_dev_s *priv = (struct sam3u_dev_s *)dev;
+ unsigned int i;
+
+ gvdbg("power: %d\n", power);
+ DEBUGASSERT(power <= CONFIG_LCD_MAXPOWER);
+
+ /* Switch off backlight */
+
+ sam3u_gpiowrite(GPIO_LCD_BKL, false);
+
+ /* For for at least 500uS to drain the charge pump */
+
+ up_udelay(500);
+
+ /* Set new backlight level by pumping "level" times */
+
+ for (i = 0; i < power; i++)
+ {
+ sam3u_gpiowrite(GPIO_LCD_BKL, false);
+ sam3u_gpiowrite(GPIO_LCD_BKL, false);
+ sam3u_gpiowrite(GPIO_LCD_BKL, false);
+ sam3u_gpiowrite(GPIO_LCD_BKL, true);
+ sam3u_gpiowrite(GPIO_LCD_BKL, true);
+ sam3u_gpiowrite(GPIO_LCD_BKL, true);
+ }
+
+ /* This delay seems to be required... perhaps because of the big current jump? */
+
+ if (power != LCD_FULL_OFF)
+ {
+ up_mdelay(100);
+ }
+
+ priv->power = power;
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: sam3u_getcontrast
+ *
+ * Description:
+ * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int sam3u_getcontrast(struct lcd_dev_s *dev)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: sam3u_getcontrast
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int sam3u_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
+{
+ gvdbg("contrast: %d\n", contrast);
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+#ifdef CONFIG_DEBUG_GRAPHICS
+ uint16_t hxregval;
+#endif
+ uint32_t regval;
+ unsigned int i;
+
+ gvdbg("Initializing\n");
+
+ /* Enable LCD EXTCS2 pins */
+
+ sam3u_configgpio(GPIO_LCD_NCS2);
+ sam3u_configgpio(GPIO_LCD_RS);
+ sam3u_configgpio(GPIO_LCD_NWE);
+ sam3u_configgpio(GPIO_LCD_NRD);
+
+ sam3u_configgpio(GPIO_LCD_D0);
+ sam3u_configgpio(GPIO_LCD_D1);
+ sam3u_configgpio(GPIO_LCD_D2);
+ sam3u_configgpio(GPIO_LCD_D3);
+ sam3u_configgpio(GPIO_LCD_D4);
+ sam3u_configgpio(GPIO_LCD_D5);
+ sam3u_configgpio(GPIO_LCD_D6);
+ sam3u_configgpio(GPIO_LCD_D7);
+ sam3u_configgpio(GPIO_LCD_D8);
+ sam3u_configgpio(GPIO_LCD_D9);
+ sam3u_configgpio(GPIO_LCD_D10);
+ sam3u_configgpio(GPIO_LCD_D11);
+ sam3u_configgpio(GPIO_LCD_D12);
+ sam3u_configgpio(GPIO_LCD_D13);
+ sam3u_configgpio(GPIO_LCD_D14);
+ sam3u_configgpio(GPIO_LCD_D15);
+
+#ifdef CONFIG_LCD_REGDEBUG
+ sam3u_dumpgpio(GPIO_PORT_PIOB, "PORTB");
+ sam3u_dumpgpio(GPIO_PORT_PIOC, "PORTC");
+#endif
+
+ /* Configure LCD Backlight Pin */
+
+ sam3u_configgpio(GPIO_LCD_D15);
+
+ /* Enable SMC peripheral clock */
+
+ putreg32((1 << SAM3U_PID_SMC), SAM3U_PMC_PCER);
+ regdbg("PMC PCSR: %08x SMC: %08x\n", getreg32(SAM3U_PMC_PCSR), (1 << SAM3U_PID_SMC));
+
+ /* Configure SMC CS2 */
+
+ regval = (4 << SMCCS_SETUP_NWESETUP_SHIFT) | (2 << SMCCS_SETUP_NCSWRSETUP_SHIFT) |
+ (4 << SMCCS_SETUP_NRDSETUP_SHIFT) | (2 << SMCCS_SETUP_NCSRDSETUP_SHIFT);
+ putreg32(regval, SAM3U_SMCCS_SETUP(2));
+
+ regval = (5 << SMCCS_PULSE_NWEPULSE_SHIFT) | (18 << SMCCS_PULSE_NCSWRPULSE_SHIFT) |
+ (5 << SMCCS_PULSE_RDPULSE_SHIFT) | (18 << SMCCS_PULSE_NCSRDPULSE_SHIFT);
+ putreg32(regval, SAM3U_SMCCS_PULSE(2));
+
+ regval = (22 << SMCCS_CYCLE_NWECYCLE_SHIFT) | (22 << SMCCS_CYCLE_NRDCYCLE_SHIFT);
+ putreg32(regval, SAM3U_SMCCS_CYCLE(2));
+
+ regval = getreg32(SAM3U_SMCCS_MODE(2));
+ regval &= ~(SMCCS_MODE_DBW_MASK | SMCCS_MODE_PMEN);
+ regval |= (SMCCS_MODE_READMODE) | (SMCCS_MODE_WRITEMODE) | (SMCCS_MODE_DBW_16BITS);
+ putreg32(regval, SAM3U_SMCCS_MODE(2));
+
+ regdbg("SMC SETUP[%08x]: %08x PULSE[%08x]: %08x\n",
+ SAM3U_SMCCS_SETUP(2), getreg32(SAM3U_SMCCS_SETUP(2)),
+ SAM3U_SMCCS_PULSE(2), getreg32(SAM3U_SMCCS_PULSE(2)));
+ regdbg(" CYCLE[%08x]: %08x MODE[%08x]: %08x\n",
+ SAM3U_SMCCS_CYCLE(2), getreg32(SAM3U_SMCCS_CYCLE(2)),
+ SAM3U_SMCCS_MODE(2), getreg32(SAM3U_SMCCS_MODE(2)));
+
+ /* Check HX8347 Chip ID */
+
+#ifdef CONFIG_DEBUG_GRAPHICS
+ hxregval = sam3u_getreg(HX8347_R67H);
+ gvdbg("Chip ID: %04x\n", hxregval);
+ if (hxregval != HX8347_CHIPID)
+ {
+ gdbg("Bad chip ID: %04x Expected: %04x\n", hxregval, HX8347_CHIPID);
+ return -ENODEV;
+ }
+#endif
+
+ /* Initialize LCD controller (HX8347) -- Magic code from Atmel LCD example */
+
+ /* Start internal OSC */
+
+ sam3u_putreg(HX8347_R19H, 0x49); /* OSCADJ=10 0000 OSD_EN=1 60Hz */
+ sam3u_putreg(HX8347_R93H, 0x0C); /* RADJ=1100 */
+
+ /* Power on flow */
+
+ sam3u_putreg(HX8347_R44H, 0x4D); /* VCM=100 1101 */
+ sam3u_putreg(HX8347_R45H, 0x11); /* VDV=1 0001 */
+ sam3u_putreg(HX8347_R20H, 0x40); /* BT=0100 */
+ sam3u_putreg(HX8347_R1DH, 0x07); /* VC1=111 */
+ sam3u_putreg(HX8347_R1EH, 0x00); /* VC3=000 */
+ sam3u_putreg(HX8347_R1FH, 0x04); /* VRH=0100 */
+ sam3u_putreg(HX8347_R1CH, 0x04); /* AP=100 */
+ sam3u_putreg(HX8347_R1BH, 0x10); /* GASENB=0 PON=1 DK=0 XDK=0 DDVDH_TRI=0 STB=0 */
+ up_mdelay(50);
+ sam3u_putreg(HX8347_R43H, 0x80); /* Set VCOMG=1 */
+ up_mdelay(50);
+
+ /* Gamma for CMO 2.8 */
+
+ sam3u_putreg(HX8347_R46H, 0x95);
+ sam3u_putreg(HX8347_R47H, 0x51);
+ sam3u_putreg(HX8347_R48H, 0x00);
+ sam3u_putreg(HX8347_R49H, 0x36);
+ sam3u_putreg(HX8347_R4AH, 0x11);
+ sam3u_putreg(HX8347_R4BH, 0x66);
+ sam3u_putreg(HX8347_R4CH, 0x14);
+ sam3u_putreg(HX8347_R4DH, 0x77);
+ sam3u_putreg(HX8347_R4EH, 0x13);
+ sam3u_putreg(HX8347_R4FH, 0x4c);
+ sam3u_putreg(HX8347_R50H, 0x46);
+ sam3u_putreg(HX8347_R51H, 0x46);
+
+ /* 240x320 window setting */
+
+ sam3u_putreg(HX8347_R02H, 0x00); /* Column address start2 */
+ sam3u_putreg(HX8347_R03H, 0x00); /* Column address start1 */
+ sam3u_putreg(HX8347_R04H, 0x00); /* Column address end2 */
+ sam3u_putreg(HX8347_R05H, 0xef); /* Column address end1 */
+ sam3u_putreg(HX8347_R06H, 0x00); /* Row address start2 */
+ sam3u_putreg(HX8347_R07H, 0x00); /* Row address start1 */
+ sam3u_putreg(HX8347_R08H, 0x01); /* Row address end2 */
+ sam3u_putreg(HX8347_R09H, 0x3f); /* Row address end1 */
+
+ /* Display Setting */
+
+ sam3u_putreg(HX8347_R01H, 0x06); /* IDMON=0 INVON=1 NORON=1 PTLON=0 */
+ sam3u_putreg(HX8347_R16H, 0xc8); /* MY=1 MX=1 MV=0 BGR=1 */
+ sam3u_putreg(HX8347_R23H, 0x95); /* N_DC=1001 0101 */
+ sam3u_putreg(HX8347_R24H, 0x95); /* P_DC=1001 0101 */
+ sam3u_putreg(HX8347_R25H, 0xff); /* I_DC=1111 1111 */
+ sam3u_putreg(HX8347_R27H, 0x06); /* N_BP=0000 0110 */
+ sam3u_putreg(HX8347_R28H, 0x06); /* N_FP=0000 0110 */
+ sam3u_putreg(HX8347_R29H, 0x06); /* P_BP=0000 0110 */
+ sam3u_putreg(HX8347_R2AH, 0x06); /* P_FP=0000 0110 */
+ sam3u_putreg(HX8347_R2CH, 0x06); /* I_BP=0000 0110 */
+ sam3u_putreg(HX8347_R2DH, 0x06); /* I_FP=0000 0110 */
+ sam3u_putreg(HX8347_R3AH, 0x01); /* N_RTN=0000 N_NW=001 */
+ sam3u_putreg(HX8347_R3BH, 0x01); /* P_RTN=0000 P_NW=001 */
+ sam3u_putreg(HX8347_R3CH, 0xf0); /* I_RTN=1111 I_NW=000 */
+ sam3u_putreg(HX8347_R3DH, 0x00); /* DIV=00 */
+ sam3u_putreg(HX8347_R3EH, 0x38); /* SON=38h */
+ sam3u_putreg(HX8347_R40H, 0x0f); /* GDON=0Fh */
+ sam3u_putreg(HX8347_R41H, 0xf0); /* GDOF=F0h */
+
+ /* Set LCD backlight to FULL off */
+
+ sam3u_setpower(&g_lcddev_s.dev, LCD_FULL_OFF);
+
+ /* Fill the display memory with the color BLACK */
+
+ sam3u_setcursor(0, 0);
+ sam3u_wrsetup();
+ for (i = 0; i < (SAM3UEK_XRES * SAM3UEK_YRES); i++)
+ {
+ sam3u_wrram(RGB16_BLACK);
+ }
+
+ /* Turn the LCD on (but with the backlight off) */
+
+ sam3u_lcdon();
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows
+ * support for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ gvdbg("lcddev: %d\n", lcddev);
+ return lcddev == 0 ? &g_lcddev_s.dev : NULL;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the framebuffer support.
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ /* Turn the LCD off */
+
+ sam3u_lcdoff();
+
+ /* Set LCD backlight to FULL off */
+
+ sam3u_setpower(&g_lcddev_s.dev, LCD_FULL_OFF);
+
+ /* Disable SMC peripheral clock */
+
+ putreg32((1 << SAM3U_PID_SMC), SAM3U_PMC_PCDR);
+}
+
+
diff --git a/nuttx/configs/sam3u-ek/src/up_leds.c b/nuttx/configs/sam3u-ek/src/up_leds.c
new file mode 100644
index 000000000..28a2cead5
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_leds.c
@@ -0,0 +1,197 @@
+/****************************************************************************
+ * configs/sam3u-ek/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+#define LED_OFF 0
+#define LED_ON 1
+#define LED_NOCHANGE 2
+#define LED_MASK 3
+
+#define LED0_SHIFT 0
+#define LED0_OFF (LED_OFF << LED0_SHIFT)
+#define LED0_ON (LED_ON << LED0_SHIFT)
+#define LED0_NOCHANGE (LED_NOCHANGE << LED0_SHIFT)
+#define LED1_SHIFT 2
+#define LED1_OFF (LED_OFF << LED1_SHIFT)
+#define LED1_ON (LED_ON << LED1_SHIFT)
+#define LED1_NOCHANGE (LED_NOCHANGE << LED1_SHIFT)
+#define LED2_SHIFT 4
+#define LED2_OFF (LED_OFF << LED2_SHIFT)
+#define LED2_ON (LED_ON << LED2_SHIFT)
+#define LED2_NOCHANGE (LED_NOCHANGE << LED2_SHIFT)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint8_t g_ledon[8] =
+{
+
+ (LED0_OFF |LED1_OFF |LED2_OFF), /* LED_STARTED */
+ (LED0_ON |LED1_OFF |LED2_ON), /* LED_HEAPALLOCATE */
+ (LED0_OFF |LED1_ON |LED2_OFF), /* LED_IRQSENABLED */
+ (LED0_ON |LED1_ON |LED2_ON), /* LED_STACKCREATED */
+
+ (LED0_NOCHANGE|LED1_OFF |LED2_NOCHANGE), /* LED_INIRQ */
+ (LED0_NOCHANGE|LED1_NOCHANGE|LED2_OFF), /* LED_SIGNAL */
+ (LED0_ON |LED1_NOCHANGE|LED2_NOCHANGE), /* LED_ASSERTION */
+ (LED0_ON |LED1_NOCHANGE|LED2_NOCHANGE) /* LED_PANIC */
+};
+
+static const uint8_t g_ledoff[8] =
+{
+
+ (LED0_OFF |LED1_OFF |LED2_OFF), /* LED_STARTED (does not happen) */
+ (LED0_ON |LED1_OFF |LED2_ON), /* LED_HEAPALLOCATE (does not happen) */
+ (LED0_OFF |LED1_ON |LED2_OFF), /* LED_IRQSENABLED (does not happen) */
+ (LED0_ON |LED1_ON |LED2_ON), /* LED_STACKCREATED (does not happen) */
+
+ (LED0_NOCHANGE|LED1_ON |LED2_NOCHANGE), /* LED_INIRQ */
+ (LED0_NOCHANGE|LED1_NOCHANGE|LED2_ON), /* LED_SIGNAL */
+ (LED0_OFF |LED1_NOCHANGE|LED2_NOCHANGE), /* LED_ASSERTION */
+ (LED0_OFF |LED1_NOCHANGE|LED2_NOCHANGE) /* LED_PANIC */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setled
+ ****************************************************************************/
+
+static void up_setled(uint16_t pinset, uint8_t state)
+{
+ /* Assume active high. Initial state == 0 means active high */
+
+ bool polarity = ((pinset & GPIO_OUTPUT_SET) == 0);
+ switch (state)
+ {
+ case LED_OFF:
+ polarity = !polarity;
+
+ case LED_ON:
+ break;
+
+ case LED_NOCHANGE:
+ default:
+ return;
+ }
+ sam3u_gpiowrite(pinset, polarity);
+}
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+static void up_setleds(uint8_t state)
+{
+ up_setled(GPIO_LED0, (state >> LED0_SHIFT) & LED_MASK);
+ up_setled(GPIO_LED1, (state >> LED1_SHIFT) & LED_MASK);
+ up_setled(GPIO_LED2, (state >> LED2_SHIFT) & LED_MASK);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ (void)sam3u_configgpio(GPIO_LED0);
+ (void)sam3u_configgpio(GPIO_LED1);
+ (void)sam3u_configgpio(GPIO_LED2);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ up_setleds(g_ledon[led & 7]);
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ up_setleds(g_ledoff[led & 7]);
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/sam3u-ek/src/up_mmcsd.c b/nuttx/configs/sam3u-ek/src/up_mmcsd.c
new file mode 100644
index 000000000..bfa4ce4a7
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_mmcsd.c
@@ -0,0 +1,139 @@
+/************************************************************************************
+ * configs/sam3u-ek/src/up_mmcsd.c
+ * arch/arm/src/board/up_mmcsd.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+#ifdef CONFIG_SAM3U_HSMCI
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* This needs to be extended. The card detect GPIO must be configured as an interrupt.
+ * when the interrupt indicating that a card has been inserted or removed is received,
+ * this function must call sio_mediachange() to handle that event. See
+ * arch/arm/src/sam3u/sam3u_internal.h for more information.
+ */
+
+#ifdef GPIO_MCI_CD
+# warning "Card detect interrupt handling needed"
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam3u_hsmciinit
+ *
+ * Description:
+ * Initialize HSMCI support. This function is called very early in board
+ * initialization.
+ *
+ ************************************************************************************/
+
+int sam3u_hsmciinit(void)
+{
+#ifdef GPIO_MCI_CD
+ sam3u_configgpio(GPIO_MCI_CD);
+#endif
+#ifdef GPIO_MCI_WP
+ sam3u_configgpio(GPIO_MCI_WP);
+#endif
+ return OK;
+}
+
+/************************************************************************************
+ * Name: sam3u_cardinserted
+ *
+ * Description:
+ * Check if a card is inserted into the selected HSMCI slot
+ *
+ ************************************************************************************/
+
+bool sam3u_cardinserted(unsigned char slot)
+{
+ if (slot == 0)
+ {
+#ifdef GPIO_MCI_CD
+ bool inserted = sam3u_gpioread(GPIO_MCI_CD);
+ fvdbg("inserted: %s\n", inserted ? "NO" : "YES");
+ return !inserted;
+#else
+ return true;
+#endif
+ }
+ return false;
+}
+
+/************************************************************************************
+ * Name: sam3u_writeprotected
+ *
+ * Description:
+ * Check if a card is inserted into the selected HSMCI slot
+ *
+ ************************************************************************************/
+
+bool sam3u_writeprotected(unsigned char slot)
+{
+ if (slot == 0)
+ {
+#ifdef GPIO_MCI_WP
+ bool protected = sam3u_gpioread(GPIO_MCI_WP);
+ fvdbg("protected: %s\n", inserted ? "YES" : "NO");
+ return protected;
+#else
+ return false;
+#endif
+ }
+ return false;
+}
+
+#endif /* CONFIG_SAM3U_HSMCI */
diff --git a/nuttx/configs/sam3u-ek/src/up_nsh.c b/nuttx/configs/sam3u-ek/src/up_nsh.c
new file mode 100644
index 000000000..e8c0df87b
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_nsh.c
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * config/sam3u-ek/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+#ifdef CONFIG_SAM3U_HSMCI
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_SAM3UEK
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new SAM3U boards here */
+# error "Unrecognized SAM3U board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM3U_HSMCI)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_rawprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_rawprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* Mount the SDIO-based MMC/SD block driver */
+ /* First, get an instance of the SDIO interface */
+
+ message("nsh_archinitialize: Initializing SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then inform the HSMCI driver if there is or is not a card in the slot. */
+
+ sdio_mediachange(sdio, sam3u_cardinserted(0));
+#endif
+ return OK;
+}
+#endif
diff --git a/nuttx/configs/sam3u-ek/src/up_spi.c b/nuttx/configs/sam3u-ek/src/up_spi.c
new file mode 100644
index 000000000..8dafc293e
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_spi.c
@@ -0,0 +1,243 @@
+/************************************************************************************
+ * configs/sam3u-ek/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+#ifdef CONFIG_SAM3U_SPI
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam3u_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the SAM3U10E-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function sam3u_spiinitialize(void)
+{
+ /* The ZigBee module connects used NPCS0. However, there is not yet any
+ * ZigBee support.
+ */
+
+ /* The touchscreen connects using NPCS2 (PC14). */
+
+#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
+ sam3u_configgpio(GPIO_TSC_NPCS2);
+#endif
+}
+
+/****************************************************************************
+ * Name: sam3u_spicsnumber, sam3u_spiselect, sam3u_spistatus, and
+ * sam3u_spicmddata
+ *
+ * Description:
+ * These external functions must be provided by board-specific logic. They
+ * include:
+ *
+ * o sam3u_spicsnumbe and sam3u_spiselect which are helper functions to
+ * manage the board-specific aspects of the unique SAM3U chip select
+ * architecture.
+ * o sam3u_spistatus and sam3u_spicmddata: Implementations of the status
+ * and cmddata methods of the SPI interface defined by struct spi_ops_
+ * (see include/nuttx/spi.h). All other methods including
+ * up_spiinitialize()) are provided by common SAM3U logic.
+ *
+ * To use this common SPI logic on your board:
+ *
+ * 1. Provide logic in sam3u_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide sam3u_spicsnumber(), sam3u_spiselect() and sam3u_spistatus()
+ * functions in your board-specific logic. These functions will perform
+ * chip selection and status operations using GPIOs in the way your board
+ * is configured.
+ * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
+ * sam3u_spicmddata() functions in your board-specific logic. This
+ * function will perform cmd/data selection operations using GPIOs in
+ * the way your board is configured.
+ * 3. Add a call to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sam3u_spicsnumber
+ *
+ * Description:
+ * The SAM3U has 4 CS registers for controlling device features. This
+ * function must be provided by board-specific code. Given a logical device
+ * ID, this function returns a number from 0 to 3 that identifies one of
+ * these SAM3U CS resources.
+ *
+ * Input Parameters:
+ * devid - Identifies the (logical) device
+ *
+ * Returned Values:
+ * On success, a CS number from 0 to 3 is returned; A negated errno may
+ * be returned on a failure.
+ *
+ ****************************************************************************/
+
+int sam3u_spicsnumber(enum spi_dev_e devid)
+{
+ int cs = -EINVAL;
+
+#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
+ if (devid == SPIDEV_TOUCHSCREEN)
+ {
+ /* Assert the CS pin to the OLED display */
+
+ cs = 2;
+ }
+#endif
+
+ spidbg("devid: %d CS: %d\n", (int)devid, cs);
+ return cs;
+}
+
+/****************************************************************************
+ * Name: sam3u_spiselect
+ *
+ * Description:
+ * PIO chip select pins may be programmed by the board specific logic in
+ * one of two different ways. First, the pins may be programmed as SPI
+ * peripherals. In that case, the pins are completely controlled by the
+ * SPI driver. This method still needs to be provided, but it may be only
+ * a stub.
+ *
+ * An alternative way to program the PIO chip select pins is as a normal
+ * GPIO output. In that case, the automatic control of the CS pins is
+ * bypassed and this function must provide control of the chip select.
+ * NOTE: In this case, the GPIO output pin does *not* have to be the
+ * same as the NPCS pin normal associated with the chip select number.
+ *
+ * Input Parameters:
+ * devid - Identifies the (logical) device
+ * selected - TRUE:Select the device, FALSE:De-select the device
+ *
+ * Returned Values:
+ * None
+ *
+ ****************************************************************************/
+
+void sam3u_spiselect(enum spi_dev_e devid, bool selected)
+{
+ /* The touchscreen chip select is implemented as a GPIO OUTPUT that must
+ * be controlled by this function. This is because the ADS7843E driver
+ * must be able to sample the device BUSY GPIO input between SPI transfers.
+ * However, the AD7843E will tri-state the BUSY input whenever the chip
+ * select is de-asserted. So the only option is to control the chip select
+ * manually and hold it low throughout the SPI transfer.
+ */
+
+#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
+ if (devid == SPIDEV_TOUCHSCREEN)
+ {
+ sam3u_gpiowrite(GPIO_TSC_NPCS2, !selected);
+ }
+#endif
+}
+
+/****************************************************************************
+ * Name: sam3u_spistatus
+ *
+ * Description:
+ * Return status information associated with the SPI device.
+ *
+ * Input Parameters:
+ * devid - Identifies the (logical) device
+ *
+ * Returned Values:
+ * Bit-encoded SPI status (see include/nuttx/spi.h.
+ *
+ ****************************************************************************/
+
+uint8_t sam3u_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return 0;
+}
+
+#endif /* CONFIG_SAM3U_SPI */
diff --git a/nuttx/configs/sam3u-ek/src/up_touchscreen.c b/nuttx/configs/sam3u-ek/src/up_touchscreen.c
new file mode 100644
index 000000000..35ab43859
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_touchscreen.c
@@ -0,0 +1,292 @@
+/************************************************************************************
+ * configs/sam3u-ek/src/up_touchscreen.c
+ * arch/arm/src/board/up_touchscreen.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/input/touchscreen.h>
+#include <nuttx/input/ads7843e.h>
+
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifdef CONFIG_INPUT_ADS7843E
+#ifndef CONFIG_INPUT
+# error "Touchscreen support requires CONFIG_INPUT"
+#endif
+
+#ifndef CONFIG_SAM3U_SPI
+# error "Touchscreen support requires CONFIG_SAM3U_SPI"
+#endif
+
+#ifndef CONFIG_GPIOA_IRQ
+# error "Touchscreen support requires CONFIG_GPIOA_IRQ"
+#endif
+
+#ifndef CONFIG_ADS7843E_FREQUENCY
+# define CONFIG_ADS7843E_FREQUENCY 500000
+#endif
+
+#ifndef CONFIG_ADS7843E_SPIDEV
+# define CONFIG_ADS7843E_SPIDEV 0
+#endif
+
+#if CONFIG_ADS7843E_SPIDEV != 0
+# error "CONFIG_ADS7843E_SPIDEV must be zero"
+#endif
+
+#ifndef CONFIG_ADS7843E_DEVMINOR
+# define CONFIG_ADS7843E_DEVMINOR 0
+#endif
+
+/****************************************************************************
+ * Static Function Prototypes
+ ****************************************************************************/
+
+/* IRQ/GPIO access callbacks. These operations all hidden behind
+ * callbacks to isolate the ADS7843E driver from differences in GPIO
+ * interrupt handling by varying boards and MCUs. If possible,
+ * interrupts should be configured on both rising and falling edges
+ * so that contact and loss-of-contact events can be detected.
+ *
+ * attach - Attach the ADS7843E interrupt handler to the GPIO interrupt
+ * enable - Enable or disable the GPIO interrupt
+ * clear - Acknowledge/clear any pending GPIO interrupt
+ * pendown - Return the state of the pen down GPIO input
+ */
+
+static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr);
+static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable);
+static void tsc_clear(FAR struct ads7843e_config_s *state);
+static bool tsc_busy(FAR struct ads7843e_config_s *state);
+static bool tsc_pendown(FAR struct ads7843e_config_s *state);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* A reference to a structure of this type must be passed to the ADS7843E
+ * driver. This structure provides information about the configuration
+ * of the ADS7843E and provides some board-specific hooks.
+ *
+ * Memory for this structure is provided by the caller. It is not copied
+ * by the driver and is presumed to persist while the driver is active. The
+ * memory must be writable because, under certain circumstances, the driver
+ * may modify frequency or X plate resistance values.
+ */
+
+static struct ads7843e_config_s g_tscinfo =
+{
+ .frequency = CONFIG_ADS7843E_FREQUENCY,
+
+ .attach = tsc_attach,
+ .enable = tsc_enable,
+ .clear = tsc_clear,
+ .busy = tsc_busy,
+ .pendown = tsc_pendown,
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* IRQ/GPIO access callbacks. These operations all hidden behind
+ * callbacks to isolate the ADS7843E driver from differences in GPIO
+ * interrupt handling by varying boards and MCUs. If possible,
+ * interrupts should be configured on both rising and falling edges
+ * so that contact and loss-of-contact events can be detected.
+ *
+ * attach - Attach the ADS7843E interrupt handler to the GPIO interrupt
+ * enable - Enable or disable the GPIO interrupt
+ * clear - Acknowledge/clear any pending GPIO interrupt
+ * pendown - Return the state of the pen down GPIO input
+ */
+
+static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr)
+{
+ /* Attach the ADS7843E interrupt */
+
+ ivdbg("Attaching %p to IRQ %d\n", isr, SAM3U_TCS_IRQ);
+ return irq_attach(SAM3U_TCS_IRQ, isr);
+}
+
+static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
+{
+ /* Attach and enable, or detach and disable */
+
+ ivdbg("IRQ:%d enable:%d\n", SAM3U_TCS_IRQ, enable);
+ if (enable)
+ {
+ sam3u_gpioirqenable(SAM3U_TCS_IRQ);
+ }
+ else
+ {
+ sam3u_gpioirqdisable(SAM3U_TCS_IRQ);
+ }
+}
+
+static void tsc_clear(FAR struct ads7843e_config_s *state)
+{
+ /* Does nothing */
+}
+
+static bool tsc_busy(FAR struct ads7843e_config_s *state)
+{
+#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE)
+ static bool last = (bool)-1;
+#endif
+
+ /* REVISIT: This might need to be inverted */
+
+ bool busy = sam3u_gpioread(GPIO_TCS_BUSY);
+#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE)
+ if (busy != last)
+ {
+ ivdbg("busy:%d\n", busy);
+ last = busy;
+ }
+#endif
+ return busy;
+}
+
+static bool tsc_pendown(FAR struct ads7843e_config_s *state)
+{
+ /* REVISIT: This might need to be inverted */
+
+ bool pendown = sam3u_gpioread(GPIO_TCS_IRQ);
+ ivdbg("pendown:%d\n", pendown);
+ return pendown;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: arch_tcinitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * configure the touchscreen device. This function will register the driver
+ * as /dev/inputN where N is the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int arch_tcinitialize(int minor)
+{
+ FAR struct spi_dev_s *dev;
+ int ret;
+
+ idbg("minor %d\n", minor);
+ DEBUGASSERT(minor == 0);
+
+ /* Configure and enable the ADS7843E interrupt pin as an input */
+
+ (void)sam3u_configgpio(GPIO_TCS_BUSY);
+ (void)sam3u_configgpio(GPIO_TCS_IRQ);
+
+ /* Configure the PIO interrupt */
+
+ sam3u_gpioirq(GPIO_TCS_IRQ);
+
+ /* Get an instance of the SPI interface */
+
+ dev = up_spiinitialize(CONFIG_ADS7843E_SPIDEV);
+ if (!dev)
+ {
+ idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
+ return -ENODEV;
+ }
+
+ /* Initialize and register the SPI touschscreen device */
+
+ ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
+ if (ret < 0)
+ {
+ idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
+ /* up_spiuninitialize(dev); */
+ return -ENODEV;
+ }
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: arch_tcuninitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * uninitialize the touchscreen device.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None.
+ *
+ ****************************************************************************/
+
+void arch_tcuninitialize(void)
+{
+ /* No support for un-initializing the touchscreen ADS7843E device yet */
+}
+
+#endif /* CONFIG_INPUT_ADS7843E */
+
diff --git a/nuttx/configs/sam3u-ek/src/up_usbdev.c b/nuttx/configs/sam3u-ek/src/up_usbdev.c
new file mode 100644
index 000000000..0fc4a61ec
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_usbdev.c
@@ -0,0 +1,111 @@
+/************************************************************************************
+ * configs/sam3u-ek/src/up_usbdev.c
+ * arch/arm/src/board/up_usbdev.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "sam3u_internal.h"
+#include "sam3uek_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: sam3u_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the SAM3U-EK board.
+ *
+ ************************************************************************************/
+
+void sam3u_usbinitialize(void)
+{
+}
+
+/************************************************************************************
+ * Name: sam3u_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide sam3u_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int sam3u_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ return 0;
+}
+
+/************************************************************************************
+ * Name: sam3u_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the sam3u_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void sam3u_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+
diff --git a/nuttx/configs/sam3u-ek/src/up_usbmsc.c b/nuttx/configs/sam3u-ek/src/up_usbmsc.c
new file mode 100644
index 000000000..7e04ee04a
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/src/up_usbmsc.c
@@ -0,0 +1,152 @@
+/****************************************************************************
+ * configs/sam3u-ek/src/up_usbmsc.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the SAM3U MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "sam3u_internal.h"
+
+#ifdef CONFIG_SAM3U_SDIO
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_SAM3U10E_EVAL
+# undef SAM3U_MMCSDSLOTNO
+# define SAM3U_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new SAM3U boards here */
+# error "Unrecognized SAM3U board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("usbmsc_archinitialize: "
+ "Initializing SDIO slot %d\n",
+ SAM3U_MMCSDSLOTNO);
+
+ sdio = sdio_initialize(SAM3U_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SDIO slot %d\n",
+ SAM3U_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the MMC/SD driver */
+
+ message("usbmsc_archinitialize: "
+ "Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_EXAMPLES_USBMSC_DEVMINOR1);
+
+ ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, sdio);
+ if (ret != OK)
+ {
+ message("usbmsc_archinitialize: "
+ "Failed to bind SDIO to the MMC/SD driver: %d\n",
+ ret);
+ return ret;
+ }
+ message("usbmsc_archinitialize: "
+ "Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the SAM3U10E-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+ return OK;
+}
+
+#endif /* CONFIG_SAM3U_SDIO */
diff --git a/nuttx/configs/sam3u-ek/touchscreen/Make.defs b/nuttx/configs/sam3u-ek/touchscreen/Make.defs
new file mode 100644
index 000000000..aa1277da4
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/touchscreen/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/sam3u-ek/touchscreen/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_SAM3U_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_SAM3U_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_SAM3U_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/touchscreen/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/touchscreen/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sam3u-ek/touchscreen/appconfig b/nuttx/configs/sam3u-ek/touchscreen/appconfig
new file mode 100644
index 000000000..ccbdaeb28
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/touchscreen/appconfig
@@ -0,0 +1,49 @@
+############################################################################
+# configs/sam3u-ek/touchscreen/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# The NX and NXHELLO examples configured as an NX built-in commands
+
+CONFIGURED_APPS += examples/nx
+CONFIGURED_APPS += examples/nxhello
+CONFIGURED_APPS += examples/touchscreen
diff --git a/nuttx/configs/sam3u-ek/touchscreen/defconfig b/nuttx/configs/sam3u-ek/touchscreen/defconfig
new file mode 100755
index 000000000..e70b710ac
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/touchscreen/defconfig
@@ -0,0 +1,565 @@
+############################################################################
+# configs/sam3u-ek/touchscreen/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSPIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="sam3u"
+CONFIG_ARCH_CHIP_AT91SAM3U4E=y
+CONFIG_ARCH_BOARD="sam3u-ek"
+CONFIG_ARCH_BOARD_SAM3UEK=y
+CONFIG_BOARD_LOOPSPERMSEC=4768
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_SAM3U_CODESOURCERYW=n
+CONFIG_SAM3U_CODESOURCERYL=n
+CONFIG_SAM3U_DEVKITARM=n
+CONFIG_SAM3U_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_SAM3U_DMA=n
+CONFIG_SAM3U_HSMCI=n
+CONFIG_SAM3U_NAND=n
+CONFIG_SAM3U_SPI=y
+CONFIG_SAM3U_UART=y
+CONFIG_SAM3U_USART0=n
+CONFIG_SAM3U_USART1=n
+CONFIG_SAM3U_USART2=n
+CONFIG_SAM3U_USART3=n
+
+#
+# Some subsystems can be configured to operate in different ways..
+# The drivers need to know how to configure the subsystem.
+#
+
+CONFIG_GPIOA_IRQ=y
+CONFIG_GPIOB_IRQ=n
+CONFIG_GPIOC_IRQ=n
+CONFIG_USART0_ISUART=y
+CONFIG_USART1_ISUART=y
+CONFIG_USART2_ISUART=y
+CONFIG_USART3_ISUART=y
+
+#
+# SAM3U specific serial device driver settings
+#
+CONFIG_UART_SERIAL_CONSOLE=Y
+CONFIG_USART0_SERIAL_CONSOLE=n
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+
+CONFIG_UART_TXBUFSIZE=256
+CONFIG_USART0_TXBUFSIZE=256
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_USART0_RXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+
+CONFIG_UART_BAUD=115200
+CONFIG_USART0_BAUD=115200
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+
+CONFIG_UART_BITS=8
+CONFIG_USART0_BITS=8
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+
+CONFIG_UART_PARITY=0
+CONFIG_USART0_PARITY=0
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+
+CONFIG_UART_2STOP=0
+CONFIG_USART0_2STOP=0
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_ADS7843E=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_INPUT=n
+CONFIG_MM_REGIONS=3
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=30
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_SDIO_BLOCKSETUP=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=31
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# SAM3U-EK LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x7b5d
+CONFIG_EXAMPLES_NX_COLOR1=0xe73f
+CONFIG_EXAMPLES_NX_COLOR2=0xdefb
+CONFIG_EXAMPLES_NX_TBCOLOR=0xad55
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sam3u-ek/touchscreen/ld.script b/nuttx/configs/sam3u-ek/touchscreen/ld.script
new file mode 100755
index 000000000..dd30648a2
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/touchscreen/ld.script
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/sam3u-ek/touchscreen/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
+ * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
+ * at address 0x2008:000 (used only for heap). When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x00080000, LENGTH = 256K
+ sram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram1 AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram1
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram1
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram1
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/sam3u-ek/touchscreen/setenv.sh b/nuttx/configs/sam3u-ek/touchscreen/setenv.sh
new file mode 100755
index 000000000..d5af12280
--- /dev/null
+++ b/nuttx/configs/sam3u-ek/touchscreen/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/sam3u-ek/toolchain/setenv.sh
+#
+# Copyright (C) 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
+
diff --git a/nuttx/configs/shenzhou/Kconfig b/nuttx/configs/shenzhou/Kconfig
new file mode 100644
index 000000000..92d294099
--- /dev/null
+++ b/nuttx/configs/shenzhou/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_SHENZHOU
+endif
diff --git a/nuttx/configs/shenzhou/README.txt b/nuttx/configs/shenzhou/README.txt
new file mode 100644
index 000000000..ca9fdafdb
--- /dev/null
+++ b/nuttx/configs/shenzhou/README.txt
@@ -0,0 +1,689 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the Shenzhou
+development board from www.armjishu.com featuring the STMicro STM32F107VCT
+MCU. On-board features:
+
+ - STM32F107VCT
+ - 10/100M PHY (DM9161AEP)
+ - TFT LCD Connector
+ - USB OTG
+ - CAN (CAN1=2)
+ - USART connectos (USART1-2)
+ - RS-485
+ - SD card slot
+ - Audio DAC (PCM1770)
+ - SPI Flash (W25X16)
+ - (4) LEDs (LED1-4)
+ - 2.4G Wireless (NRF24L01 SPI module)
+ - 315MHz Wireless (module)
+ - (4) Buttons (KEY1-4, USERKEY2, USERKEY, TEMPER, WAKEUP)
+ - VBUS/external +4V select
+ - 5V/3.3V power conversion
+ - Extension connector
+ - JTAG
+
+Contents
+========
+
+ - STM32F107VCT Pin Usage
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - Shenzhou-specific Configuration Options
+ - LEDs
+ - Shenzhou-specific Configuration Options
+ - Configurations
+
+STM32F107VCT Pin Usage
+======================
+
+-- ---- -------------- -------------------------------------------------------------------
+PN NAME SIGNAL NOTES
+-- ---- -------------- -------------------------------------------------------------------
+23 PA0 WAKEUP Connected to KEY4. Active low: Closing KEY4 pulls WAKEUP to ground.
+24 PA1 MII_RX_CLK
+ RMII_REF_CLK
+25 PA2 MII_MDIO
+26 PA3 315M_VT
+29 PA4 DAC_OUT1 To CON5(CN14)
+30 PA5 DAC_OUT2 To CON5(CN14). JP10
+ SPI1_SCK To the SD card, SPI FLASH
+31 PA6 SPI1_MISO To the SD card, SPI FLASH
+32 PA7 SPI1_MOSI To the SD card, SPI FLASH
+67 PA8 MCO To DM9161AEP PHY
+68 PA9 USB_VBUS MINI-USB-AB. JP3
+ USART1_TX MAX3232 to CN5
+69 PA10 USB_ID MINI-USB-AB. JP5
+ USART1_RX MAX3232 to CN5
+70 PA11 USB_DM MINI-USB-AB
+71 PA12 USB_DP MINI-USB-AB
+72 PA13 TMS/SWDIO
+76 PA14 TCK/SWCLK
+77 PA15 TDI
+
+-- ---- -------------- -------------------------------------------------------------------
+PN NAME SIGNAL NOTES
+-- ---- -------------- -------------------------------------------------------------------
+35 PB0 ADC_IN1 To CON5(CN14)
+36 PB1 ADC_IN2 To CON5(CN14)
+37 PB2 DATA_LE To TFT LCD (CN13)
+ BOOT1 JP13
+89 PB3 TDO/SWO
+90 PB4 TRST
+91 PB5 CAN2_RX
+92 PB6 CAN2_TX JP11
+ I2C1_SCL
+93 PB7 I2C1_SDA
+95 PB8 USB_PWR Drives USB VBUS
+96 PB9 F_CS To both the TFT LCD (CN13) and to the W25X16 SPI FLASH
+47 PB10 USERKEY Connected to KEY2
+48 PB11 MII_TX_EN Ethernet PHY
+51 PB12 I2S_WS Audio DAC
+ MII_TXD0 Ethernet PHY
+52 PB13 I2S_CK Audio DAC
+ MII_TXD1 Ethernet PHY
+53 PB14 SD_CD
+54 PB15 I2S_DIN Audio DAC
+
+-- ---- -------------- -------------------------------------------------------------------
+PN NAME SIGNAL NOTES
+-- ---- -------------- -------------------------------------------------------------------
+15 PC0 POTENTIO_METER
+16 PC1 MII_MDC Ethernet PHY
+17 PC2 WIRELESS_INT
+18 PC3 WIRELESS_CE To the NRF24L01 2.4G wireless module
+33 PC4 USERKEY2 Connected to KEY1
+34 PC5 TP_INT JP6. To TFT LCD (CN13) module
+ MII_INT Ethernet PHY
+63 PC6 I2S_MCK Audio DAC. Active low: Pulled high
+64 PC7 PCM1770_CS Audio DAC. Active low: Pulled high
+65 PC8 LCD_CS TFT LCD (CN13). Active low: Pulled high
+66 PC9 TP_CS TFT LCD (CN13). Active low: Pulled high
+78 PC10 SPI3_SCK To TFT LCD (CN13), the NRF24L01 2.4G wireless module
+79 PC11 SPI3_MISO To TFT LCD (CN13), the NRF24L01 2.4G wireless module
+80 PC12 SPI3_MOSI To TFT LCD (CN13), the NRF24L01 2.4G wireless module
+7 PC13 TAMPER Connected to KEY3
+8 PC14 OSC32_IN Y1 32.768Khz XTAL
+9 PC15 OSC32_OUT Y1 32.768Khz XTAL
+
+-- ---- -------------- -------------------------------------------------------------------
+PN NAME SIGNAL NOTES
+-- ---- -------------- -------------------------------------------------------------------
+81 PD0 CAN1_RX
+82 PD1 CAN1_TX
+83 PD2 LED1 Active low: Pulled high
+84 PD3 LED2 Active low: Pulled high
+85 PD4 LED3 Active low: Pulled high
+86 PD5 485_TX Same as USART2_TX but goes to SP3485
+ USART2_TX MAX3232 to CN6
+87 PD6 485_RX Save as USART2_RX but goes to SP3485 (see JP4)
+ USART2_RX MAX3232 to CN6
+88 PD7 LED4 Active low: Pulled high
+ 485_DIR SP3485 read enable (not)
+55 PD8 MII_RX_DV Ethernet PHY
+ RMII_CRSDV Ethernet PHY
+56 PD9 MII_RXD0 Ethernet PHY
+57 PD10 MII_RXD1 Ethernet PHY
+58 PD11 SD_CS Active low: Pulled high
+59 PD12 WIRELESS_CS To the NRF24L01 2.4G wireless module
+60 PD13 LCD_RS To TFT LCD (CN13)
+61 PD14 LCD_WR To TFT LCD (CN13)
+62 PD15 LCD_RD To TFT LCD (CN13)
+
+-- ---- -------------- -------------------------------------------------------------------
+PN NAME SIGNAL NOTES
+-- ---- -------------- -------------------------------------------------------------------
+97 PE0 DB00 To TFT LCD (CN13)
+98 PE1 DB01 To TFT LCD (CN13)
+1 PE2 DB02 To TFT LCD (CN13)
+2 PE3 DB03 To TFT LCD (CN13)
+3 PE4 DB04 To TFT LCD (CN13)
+4 PE5 DB05 To TFT LCD (CN13)
+5 PE6 DB06 To TFT LCD (CN13)
+38 PE7 DB07 To TFT LCD (CN13)
+39 PE8 DB08 To TFT LCD (CN13)
+40 PE9 DB09 To TFT LCD (CN13)
+41 PE10 DB10 To TFT LCD (CN13)
+42 PE11 DB11 To TFT LCD (CN13)
+43 PE12 DB12 To TFT LCD (CN13)
+44 PE13 DB13 To TFT LCD (CN13)
+45 PE14 DB14 To TFT LCD (CN13)
+46 PE15 DB15 To TFT LCD (CN13)
+
+-- ---- -------------- -------------------------------------------------------------------
+PN NAME SIGNAL NOTES
+-- ---- -------------- -------------------------------------------------------------------
+73 N/C
+
+12 OSC_IN Y2 25Mhz XTAL
+13 OSC_OUT Y2 25Mhz XTAL
+
+94 BOOT0 JP15 (3.3V or GND)
+14 RESET S5
+6 VBAT JP14 (3.3V or battery)
+
+49 VSS_1 GND
+74 VSS_2 GND
+99 VSS_3 GND
+27 VSS_4 GND
+10 VSS_5 GND
+19 VSSA VSSA
+20 VREF- VREF-
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the development tools that I used only work under Windows.
+
+GNU Toolchain Options
+=====================
+
+ Toolchain Configurations
+ ------------------------
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The Atollic Toolchain,
+ 3. The devkitARM GNU toolchain,
+ 4. Raisonance GNU toolchain, or
+ 5. The NuttX buildroot Toolchain (see below).
+
+ Most testing has been conducted using the CodeSourcery toolchain for Windows and
+ that is the default toolchain in most configurations. To use the Atollic,
+ devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_ATOLLIC_LITE=y : The free, "Lite" version of Atollic toolchain under Windows
+ CONFIG_STM32_ATOLLIC_PRO=y : The paid, "Pro" version of Atollic toolchain under Windows
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you change the default toolchain, then you may also have to modify the PATH in
+ the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), Atollic, devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcery (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ The CodeSourcery Toolchain (2009q1)
+ -----------------------------------
+ The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ The Atollic "Pro" and "Lite" Toolchain
+ --------------------------------------
+ One problem that I had with the Atollic toolchains is that the provide a gcc.exe
+ and g++.exe in the same bin/ file as their ARM binaries. If the Atollic bin/ path
+ appears in your PATH variable before /usr/bin, then you will get the wrong gcc
+ when you try to build host executables. This will cause to strange, uninterpretable
+ errors build some host binaries in tools/ when you first make.
+
+ The Atollic "Lite" Toolchain
+ ----------------------------
+ The free, "Lite" version of the Atollic toolchain does not support C++ nor
+ does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
+ toolchain, you will have to set:
+
+ CONFIG_HAVE_CXX=n
+
+ In order to compile successfully. Otherwise, you will get errors like:
+
+ "C++ Compiler only available in TrueSTUDIO Professional"
+
+ The make may then fail in some of the post link processing because of some of
+ the other missing tools. The Make.defs file replaces the ar and nm with
+ the default system x86 tool versions and these seem to work okay. Disable all
+ of the following to avoid using objcopy:
+
+ CONFIG_RRLOAD_BINARY=n
+ CONFIG_INTELHEX_BINARY=n
+ CONFIG_MOTOROLA_SREC=n
+ CONFIG_RAW_BINARY=n
+
+ devkitARM
+ ---------
+ The devkitARM toolchain includes a version of MSYS make. Make sure that the
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh shenzhou/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+LEDs
+====
+
+The Shenzhou board has four LEDs labeled LED1, LED2, LED3 and LED4 on the
+board. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
+defined. In that case, the usage by the board port is defined in
+include/board.h and src/up_leds.c. The LEDs are used to encode OS-related
+events as follows:
+
+ SYMBOL Meaning LED1* LED2 LED3 LED4****
+ ------------------- ----------------------- ------- ------- ------- ------
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
+ is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+ *** LED2 may also flicker normally if signals are processed.
+**** LED4 may not be available if RS-485 is also used it will then indicate
+ the RS-485 direction.
+
+Shenzhou-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F107VC=y
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=shenzhou (for the Shenzhou development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_SHENZHOU=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_STM32_CCMEXCLUDE - Exclude CCM SRAM from the HEAP
+
+ CONFIG_ARCH_IRQPRIO - The STM32107xxx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ AHB
+ ---
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_CRC
+ CONFIG_STM32_ETHMAC
+ CONFIG_STM32_OTGFS
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_PWR -- Required for RTC
+
+ APB1 (low speed)
+ ----------------
+ CONFIG_STM32_BKP
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI3
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_CAN2
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_WWDG
+
+ APB2 (high speed)
+ -----------------
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_USART1
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,14
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,14
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,14, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,14
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,14, m=1,..,2
+
+ For each timer that is enabled for PWM usage, we need the following additional
+ configuration settings:
+
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+
+ NOTE: The STM32 timers are each capable of generating different signals on
+ each of the four channels with different duty cycles. That capability is
+ not supported by this driver: Only one output channel per timer.
+
+ JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+
+ STM32107xxx specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_STM32_PHYADDR - The 5-bit address of the PHY on the board
+ CONFIG_STM32_MII - Support Ethernet MII interface
+ CONFIG_STM32_MII_MCO1 - Use MCO1 to clock the MII interface
+ CONFIG_STM32_MII_MCO2 - Use MCO2 to clock the MII interface
+ CONFIG_STM32_RMII - Support Ethernet RMII interface
+ CONFIG_STM32_AUTONEG - Use PHY autonegotion to determine speed and mode
+ CONFIG_STM32_ETHFD - If CONFIG_STM32_AUTONEG is not defined, then this
+ may be defined to select full duplex mode. Default: half-duplex
+ CONFIG_STM32_ETH100MBPS - If CONFIG_STM32_AUTONEG is not defined, then this
+ may be defined to select 100 MBps speed. Default: 10 Mbps
+ CONFIG_STM32_PHYSR - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. The PHY status register address may diff from PHY to PHY. This
+ configuration sets the address of the PHY status register.
+ CONFIG_STM32_PHYSR_SPEED - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides bit mask indicating 10 or 100MBps speed.
+ CONFIG_STM32_PHYSR_100MBPS - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides the value of the speed bit(s) indicating 100MBps speed.
+ CONFIG_STM32_PHYSR_MODE - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provide bit mask indicating full or half duplex modes.
+ CONFIG_STM32_PHYSR_FULLDUPLEX - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides the value of the mode bits indicating full duplex mode.
+ CONFIG_STM32_ETH_PTP - Precision Time Protocol (PTP). Not supported
+ but some hooks are indicated with this condition.
+
+ Shenzhou CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ Shenzhou LCD Hardware Configuration
+
+ The LCD driver supports the following LCDs on the STM324xG_EVAL board:
+
+ AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) OR
+ AM-240320D5TOQW01H (LCD_ILI9325)
+
+ Configuration options.
+
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. Default is this 320x240 "landscape" orientation
+ For the Shenzhou board, the edge opposite from the row of buttons
+ is used as the top of the display in this orientation.
+ CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
+ landscape" support. Default is this 320x240 "landscape"
+ orientation
+ For the Shenzhou board, the edge next to the row of buttons
+ is used as the top of the display in this orientation.
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support.
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support.
+ CONFIG_LCD_RDSHIFT - When reading 16-bit gram data, there appears
+ to be a shift in the returned data. This value fixes the offset.
+ Default 5.
+
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using:
+
+ CONFIG_STM32_ILI9320_DISABLE (includes ILI9321)
+ CONFIG_STM32_ILI9325_DISABLE
+
+ STM32 USB OTG FS Host Driver Support
+
+ Pre-requisites
+
+ CONFIG_USBHOST - Enable USB host support
+ CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG - Needed
+ CONFIG_SCHED_WORKQUEUE - Worker thread support is required
+
+ Options:
+
+ CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
+ Default 128 (512 bytes)
+ CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
+ in 32-bit words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
+ words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_DESCSIZE - Maximum size of a descriptor. Default: 128
+ CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
+ want to do that?
+ CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
+ debug. Depends on CONFIG_DEBUG.
+ CONFIG_STM32_USBHOST_PKTDUMP - Dump all incoming and outgoing USB
+ packets. Depends on CONFIG_DEBUG.
+
+Configurations
+==============
+
+Each Shenzhou configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh shenzhou/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ ---
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_NSH_DHCPC=n : DHCP is disabled
+ CONFIG_NSH_IPADDR=0x0a000002 : Target IP address 10.0.0.2
+ CONFIG_NSH_DRIPADDR=0x0a000001 : Host IP address 10.0.0.1
+
+ NOTES:
+ 1. This example assumes that a network is connected. During its
+ initialization, it will try to negotiate the link speed. If you have
+ no network connected when you reset the board, there will be a long
+ delay (maybe 30 seconds?) before anything happens. That is the timeout
+ before the networking finally gives up and decides that no network is
+ available.
diff --git a/nuttx/configs/shenzhou/include/board.h b/nuttx/configs/shenzhou/include/board.h
new file mode 100644
index 000000000..2e82742ec
--- /dev/null
+++ b/nuttx/configs/shenzhou/include/board.h
@@ -0,0 +1,377 @@
+/************************************************************************************
+ * configs/shenzhou/include/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#define BOARD_CFGR_MCO_SOURCE RCC_CFGR_PLL3CLK
+
+/* Clocking *************************************************************************/
+
+/* On-board crystal frequency is 25MHz (HSE) */
+
+#define STM32_BOARD_XTAL 25000000ul
+#define STM32_PLL_FREQUENCY (72000000)
+#define STM32_SYSCLK_FREQUENCY STM32_PLL_FREQUENCY
+
+#define STM32_HCLK_FREQUENCY STM32_PLL_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB2 clock (PCLK2) is HCLK (72MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
+#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_APB2_CLKIN (STM32_PCLK2_FREQUENCY) /* Timers 2-7, 12-14 */
+
+/* APB2 timers 1 and 8 will receive PCLK2. */
+
+#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
+
+/* APB1 clock (PCLK1) is HCLK/2 (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd2
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB1 timers 2-4 will be twice PCLK1 (I presume the remaining will receive PCLK1) */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
+
+/* LED definitions ******************************************************************/
+/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
+ * way. The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with stm32_setled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_LED3 2
+#define BOARD_LED4 3
+#define BOARD_NLEDS 4
+
+/* LED bits for use with stm32_setleds() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+#define BOARD_LED3_BIT (1 << BOARD_LED3)
+#define BOARD_LED4_BIT (1 << BOARD_LED4)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on board the
+ * STM3240G-EVAL. The following definitions describe how NuttX controls the LEDs:
+ */
+
+#define LED_STARTED 0 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED2 */
+#define LED_IRQSENABLED 2 /* LED1 + LED2 */
+#define LED_STACKCREATED 3 /* LED3 */
+#define LED_INIRQ 4 /* LED1 + LED3 */
+#define LED_SIGNAL 5 /* LED2 + LED3 */
+#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
+#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+
+/* Button definitions ***************************************************************/
+/* The STM3240G-EVAL supports three buttons: */
+
+#define BUTTON_KEY1 0 /* Name printed on board */
+#define BUTTON_KEY2 1
+#define BUTTON_KEY3 2
+#define BUTTON_KEY4 3
+#define NUM_BUTTONS 4
+
+#define BUTTON_USERKEY2 BUTTON_KEY1 /* Names in schematic */
+#define BUTTON_USERKEY BUTTON_KEY2
+#define BUTTON_TAMPER BUTTON_KEY3
+#define BUTTON_WAKEUP BUTTON_KEY4
+
+#define BUTTON_KEY1_BIT (1 << BUTTON_KEY1)
+#define BUTTON_KEY2_BIT (1 << BUTTON_KEY2)
+#define BUTTON_KEY3_BIT (1 << BUTTON_KEY3)
+#define BUTTON_KEY4_BIT (1 << BUTTON_KEY4)
+
+#define BUTTON_USERKEY2_BIT BUTTON_KEY1_BIT
+#define BUTTON_USERKEY_BIT BUTTON_KEY2_BIT
+#define BUTTON_TAMPER_BIT BUTTON_KEY3_BIT
+#define BUTTON_WAKEUP_BIT BUTTON_KEY4_BIT
+
+/* Pin selections ******************************************************************/
+/* Ethernet
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 24 PA1 MII_RX_CLK Ethernet PHY
+ * RMII_REF_CLK Ethernet PHY
+ * 25 PA2 MII_MDIO Ethernet PHY
+ * 48 PB11 MII_TX_EN Ethernet PHY
+ * 51 PB12 MII_TXD0 Ethernet PHY
+ * 52 PB13 MII_TXD1 Ethernet PHY
+ * 16 PC1 MII_MDC Ethernet PHY
+ * 34 PC5 MII_INT Ethernet PHY
+ * 55 PD8 MII_RX_DV Ethernet PHY. Requires CONFIG_STM32_ETH_REMAP
+ * 55 PD8 RMII_CRSDV Ethernet PHY. Requires CONFIG_STM32_ETH_REMAP
+ * 56 PD9 MII_RXD0 Ethernet PHY. Requires CONFIG_STM32_ETH_REMAP
+ * 57 PD10 MII_RXD1 Ethernet PHY. Requires CONFIG_STM32_ETH_REMAP
+ *
+ * 67 PA8 MCO DM9161AEP
+ */
+
+#ifdef CONFIG_STM32_ETHMAC
+# ifndef CONFIG_STM32_ETH_REMAP
+# error "STM32 Ethernet requires CONFIG_STM32_ETH_REMAP"
+# endif
+# ifndef CONFIG_STM32_MII
+# error "STM32 Ethernet requires CONFIG_STM32_MII"
+# endif
+# ifndef CONFIG_STM32_MII_MCO
+# error "STM32 Ethernet requires CONFIG_STM32_MII_MCO"
+# endif
+#endif
+
+/* USB
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 68 PA9 USB_VBUS MINI-USB-AB. JP3
+ * 69 PA10 USB_ID MINI-USB-AB. JP5
+ * 70 PA11 USB_DM MINI-USB-AB
+ * 71 PA12 USB_DP MINI-USB-AB
+ * 95 PB8 USB_PWR Drives USB VBUS
+ */
+
+/* UARTS/USARTS
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 68 PA9 USART1_TX MAX3232 to CN5. Requires CONFIG_STM32_USART1_REMAP
+ * 69 PA10 USART1_RX MAX3232 to CN5. Requires CONFIG_STM32_USART1_REMAP
+ * 86 PD5 USART2_TX MAX3232 to CN6. Requires CONFIG_STM32_USART2_REMAP
+ * 87 PD6 USART2_RX MAX3232 to CN6. Requires CONFIG_STM32_USART2_REMAP
+ * 86 PD5 485_TX Same as USART2_TX but goes to SP3485
+ * 87 PD6 485_RX Save as USART2_RX but goes to SP3485 (see JP4)
+ */
+
+#if defined(CONFIG_STM32_USART1) && !defined(CONFIG_STM32_USART1_REMAP)
+# error "CONFIG_STM32_USART1 requires CONFIG_STM32_USART1_REMAP"
+#endif
+
+#if defined(CONFIG_STM32_USART2) && !defined(CONFIG_STM32_USART2_REMAP)
+# error "CONFIG_STM32_USART2 requires CONFIG_STM32_USART2_REMAP"
+#endif
+
+/* SPI
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 30 PA5 SPI1_SCK To the SD card, SPI FLASH.
+ * Requires !CONFIG_STM32_SPI1_REMAP
+ * 31 PA6 SPI1_MISO To the SD card, SPI FLASH.
+ * Requires !CONFIG_STM32_SPI1_REMAP
+ * 32 PA7 SPI1_MOSI To the SD card, SPI FLASH.
+ * Requires !CONFIG_STM32_SPI1_REMAP
+ * 78 PC10 SPI3_SCK To TFT LCD (CN13), the NRF24L01 2.4G wireless module.
+ * Requires CONFIG_STM32_SPI3_REMAP.
+ * 79 PC11 SPI3_MISO To TFT LCD (CN13), the NRF24L01 2.4G wireless module.
+ * Requires CONFIG_STM32_SPI3_REMAP.
+ * 80 PC12 SPI3_MOSI To TFT LCD (CN13), the NRF24L01 2.4G wireless module.
+ * Requires CONFIG_STM32_SPI3_REMAP.
+ */
+
+#if defined(CONFIG_STM32_SPI1) && defined(CONFIG_STM32_SPI1_REMAP)
+# error "CONFIG_STM32_SPI1 must not have CONFIG_STM32_SPI1_REMAP"
+#endif
+
+#if defined(CONFIG_STM32_SPI3) && !defined(CONFIG_STM32_SPI3_REMAP)
+# error "CONFIG_STM32_SPI3 requires CONFIG_STM32_SPI3_REMAP"
+#endif
+
+/* DAC
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 29 PA4 DAC_OUT1 To CON5(CN14)
+ * 30 PA5 DAC_OUT2 To CON5(CN14). JP10
+ */
+
+/* ADC
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 35 PB0 ADC_IN1 GPIO_ADC12_IN8. To CON5(CN14)
+ * 36 PB1 ADC_IN2 GPIO_ADC12_IN9. To CON5(CN14)
+ * 15 PC0 POTENTIO_METER GPIO_ADC12_IN10
+ */
+
+/* CAN
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 91 PB5 CAN2_RX Requires CONFIG_STM32_CAN2_REMAP.
+ * 92 PB6 CAN2_TX Requires CONFIG_STM32_CAN2_REMAP. See also JP11
+ * 81 PD0 CAN1_RX Requires CONFIG_STM32_CAN1_REMAP2.
+ * 82 PD1 CAN1_TX Requires CONFIG_STM32_CAN1_REMAP2.
+ */
+
+#if defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN1_REMAP2)
+# error "CONFIG_STM32_CAN1 requires CONFIG_STM32_CAN1_REMAP2"
+#endif
+
+#if defined(CONFIG_STM32_CAN2) && !defined(CONFIG_STM32_CAN2_REMAP)
+# error "CONFIG_STM32_CAN2 requires CONFIG_STM32_CAN2_REMAP"
+#endif
+
+/* I2C
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 92 PB6 I2C1_SCL Requires !CONFIG_STM32_I2C1_REMAP
+ * 93 PB7 I2C1_SDA
+ */
+
+#if defined(CONFIG_STM32_I2C1) && defined(CONFIG_STM32_I2C1_REMAP)
+# error "CONFIG_STM32_I2C1 must not have CONFIG_STM32_I2C1_REMAP"
+#endif
+
+/* I2S
+ *
+ * -- ---- -------------- ----------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- ----------------------------------------------------------
+ * 51 PB12 I2S_WS GPIO_I2S2_WS. Audio DAC
+ * 52 PB13 I2S_CK GPIO_I2S2_CK. Audio DAC
+ * 54 PB15 I2S_DIN ??? Audio DAC data in.
+ * 63 PC6 I2S_MCK GPIO_I2S2_MCK. Audio DAC. Active low: Pulled high
+ */
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_board_clockconfig
+ *
+ * Description:
+ * Any STM32 board may replace the "standard" board clock configuration logic with
+ * its own, custom clock cofiguration logic.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
+void stm32_board_clockconfig(void);
+#endif
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+/************************************************************************************
+ * Name: stm32_ledinit, stm32_setled, and stm32_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
+ * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * control the LEDs from user applications.
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void stm32_ledinit(void);
+EXTERN void stm32_setled(int led, bool ledon);
+EXTERN void stm32_setleds(uint8_t ledset);
+#endif
diff --git a/nuttx/configs/shenzhou/nsh/Make.defs b/nuttx/configs/shenzhou/nsh/Make.defs
new file mode 100644
index 000000000..130c73f6d
--- /dev/null
+++ b/nuttx/configs/shenzhou/nsh/Make.defs
@@ -0,0 +1,196 @@
+############################################################################
+# configs/shenzhou/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+# Pick the linker script
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/shenzhou/nsh/defconfig b/nuttx/configs/shenzhou/nsh/defconfig
new file mode 100644
index 000000000..0c18b129f
--- /dev/null
+++ b/nuttx/configs/shenzhou/nsh/defconfig
@@ -0,0 +1,903 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+CONFIG_INTELHEX_BINARY=y
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+CONFIG_ARCH_ARM=y
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="arm"
+# CONFIG_ARCH_CHIP_C5471 is not set
+# CONFIG_ARCH_CHIP_CALYPSO is not set
+# CONFIG_ARCH_CHIP_DM320 is not set
+# CONFIG_ARCH_CHIP_IMX is not set
+# CONFIG_ARCH_CHIP_KINETIS is not set
+# CONFIG_ARCH_CHIP_LM3S is not set
+# CONFIG_ARCH_CHIP_LPC17XX is not set
+# CONFIG_ARCH_CHIP_LPC214X is not set
+# CONFIG_ARCH_CHIP_LPC2378 is not set
+# CONFIG_ARCH_CHIP_LPC31XX is not set
+# CONFIG_ARCH_CHIP_LPC43XX is not set
+# CONFIG_ARCH_CHIP_SAM3U is not set
+CONFIG_ARCH_CHIP_STM32=y
+# CONFIG_ARCH_CHIP_STR71X is not set
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_FAMILY="armv7-m"
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_HAVE_MPU=y
+# CONFIG_ARMV7M_MPU is not set
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+# CONFIG_ARCH_CALIBRATION is not set
+# CONFIG_SERIAL_TERMIOS is not set
+# CONFIG_NET_MULTICAST is not set
+
+#
+# STM32 Configuration Options
+#
+# CONFIG_ARCH_CHIP_STM32F100C8 is not set
+# CONFIG_ARCH_CHIP_STM32F100CB is not set
+# CONFIG_ARCH_CHIP_STM32F100R8 is not set
+# CONFIG_ARCH_CHIP_STM32F100RB is not set
+# CONFIG_ARCH_CHIP_STM32F100V8 is not set
+# CONFIG_ARCH_CHIP_STM32F100VB is not set
+# CONFIG_ARCH_CHIP_STM32F103RET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103ZET6 is not set
+# CONFIG_ARCH_CHIP_STM32F105VBT7 is not set
+CONFIG_ARCH_CHIP_STM32F107VC=y
+# CONFIG_ARCH_CHIP_STM32F207IG is not set
+# CONFIG_ARCH_CHIP_STM32F405RG is not set
+# CONFIG_ARCH_CHIP_STM32F405VG is not set
+# CONFIG_ARCH_CHIP_STM32F405ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407VE is not set
+# CONFIG_ARCH_CHIP_STM32F407VG is not set
+# CONFIG_ARCH_CHIP_STM32F407ZE is not set
+# CONFIG_ARCH_CHIP_STM32F407ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407IE is not set
+# CONFIG_ARCH_CHIP_STM32F407IG is not set
+CONFIG_STM32_STM32F10XX=y
+CONFIG_STM32_CONNECTIVITYLINE=y
+CONFIG_STM32_CODESOURCERYW=y
+# CONFIG_STM32_CODESOURCERYL is not set
+# CONFIG_STM32_ATOLLIC_LITE is not set
+# CONFIG_STM32_ATOLLIC_PRO is not set
+# CONFIG_STM32_DEVKITARM is not set
+# CONFIG_STM32_RAISONANCE is not set
+# CONFIG_STM32_BUILDROOT is not set
+# CONFIG_STM32_DFU is not set
+
+#
+# STM32 Peripheral Support
+#
+# CONFIG_STM32_ADC1 is not set
+# CONFIG_STM32_ADC2 is not set
+# CONFIG_STM32_ADC3 is not set
+# CONFIG_STM32_CRC is not set
+# CONFIG_STM32_DMA1 is not set
+# CONFIG_STM32_DMA2 is not set
+CONFIG_STM32_BKP=y
+# CONFIG_STM32_CAN1 is not set
+# CONFIG_STM32_DAC1 is not set
+# CONFIG_STM32_DAC2 is not set
+CONFIG_STM32_ETHMAC=y
+# CONFIG_STM32_I2C1 is not set
+# CONFIG_STM32_I2C2 is not set
+# CONFIG_STM32_IWDG is not set
+CONFIG_STM32_PWR=y
+CONFIG_STM32_SPI1=y
+# CONFIG_STM32_SPI2 is not set
+# CONFIG_STM32_SPI4 is not set
+# CONFIG_STM32_TIM1 is not set
+# CONFIG_STM32_TIM2 is not set
+# CONFIG_STM32_TIM3 is not set
+# CONFIG_STM32_TIM4 is not set
+# CONFIG_STM32_TIM5 is not set
+# CONFIG_STM32_TIM6 is not set
+# CONFIG_STM32_TIM7 is not set
+# CONFIG_STM32_TIM8 is not set
+# CONFIG_STM32_USART1 is not set
+CONFIG_STM32_USART2=y
+# CONFIG_STM32_USART3 is not set
+# CONFIG_STM32_UART4 is not set
+# CONFIG_STM32_UART5 is not set
+# CONFIG_STM32_USB is not set
+# CONFIG_STM32_WWDG is not set
+CONFIG_STM32_SPI=y
+
+#
+# Alternate Pin Mapping
+#
+CONFIG_STM32_USART2_REMAP=y
+# CONFIG_STM32_SPI1_REMAP is not set
+CONFIG_STM32_ETH_REMAP=y
+# CONFIG_STM32_JTAG_DISABLE is not set
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set
+# CONFIG_STM32_JTAG_SW_ENABLE is not set
+# CONFIG_STM32_FORCEPOWER is not set
+CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=y
+
+#
+# SPI Configuration
+#
+# CONFIG_STM32_SPI_INTERRUPTS is not set
+# CONFIG_STM32_SPI_DMA is not set
+
+#
+# Ethernet MAC configuration
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO=y
+CONFIG_STM32_AUTONEG=y
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+# CONFIG_STM32_ETH_PTP is not set
+
+#
+# USB Host Configuration
+#
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_DMA is not set
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# Board Settings
+#
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+# CONFIG_ARCH_INTERRUPTSTACK is not set
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
+#
+# CONFIG_ARCH_BOARD_OLIMEX_STM32P107 is not set
+CONFIG_ARCH_BOARD_SHENZHOU=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="shenzhou"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_HAVE_BUTTONS=y
+# CONFIG_ARCH_BUTTONS is not set
+CONFIG_ARCH_HAVE_IRQBUTTONS=y
+CONFIG_NSH_MMCSDMINOR=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDSPIPORTNO=0
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=200
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=8
+CONFIG_DEV_CONSOLE=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+# CONFIG_SCHED_LPWORK is not set
+CONFIG_SCHED_WAITPID=y
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_CLOCK is not set
+# CONFIG_DISABLE_POSIX_TIMERS is not set
+# CONFIG_DISABLE_PTHREAD is not set
+# CONFIG_DISABLE_SIGNALS is not set
+# CONFIG_DISABLE_MQUEUE is not set
+# CONFIG_DISABLE_MOUNTPOINT is not set
+# CONFIG_DISABLE_ENVIRON is not set
+CONFIG_DISABLE_POLL=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Stack and heap information
+#
+# CONFIG_CUSTOM_STACK is not set
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+
+#
+# Device Drivers
+#
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+# CONFIG_I2C is not set
+CONFIG_SPI=y
+# CONFIG_SPI_OWNBUS is not set
+CONFIG_SPI_EXCHANGE=y
+CONFIG_SPI_CMDDATA=y
+CONFIG_RTC=y
+# CONFIG_RTC_DATETIME is not set
+# CONFIG_RTC_HIRES is not set
+# CONFIG_RTC_ALARM is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+CONFIG_MMCSD=y
+CONFIG_MMCSD_NSLOTS=1
+# CONFIG_MMCSD_READONLY is not set
+# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set
+CONFIG_MMCSD_MMCSUPPORT=y
+CONFIG_MMCSD_HAVECARDDETECT=y
+CONFIG_MMCSD_SPI=y
+CONFIG_MMCSD_SPICLOCK=12500000
+# CONFIG_MMCSD_SDIO is not set
+# CONFIG_MTD is not set
+# CONFIG_NETDEVICES is not set
+# CONFIG_NET_SLIP is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_LOWLEVEL_CONSOLE is not set
+# CONFIG_16550_UART is not set
+CONFIG_ARCH_HAVE_USART2=y
+CONFIG_MCU_SERIAL=y
+CONFIG_STANDARD_SERIAL=y
+CONFIG_USART2_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART2 Configuration
+#
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART2_BAUD=115200
+CONFIG_USART2_BITS=8
+CONFIG_USART2_PARITY=0
+CONFIG_USART2_2STOP=0
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+CONFIG_NET=y
+# CONFIG_NET_NOINTS is not set
+CONFIG_NET_MULTIBUFFER=y
+# CONFIG_NET_IPv6 is not set
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_NACTIVESOCKETS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+# CONFIG_NET_TCPURGDATA is not set
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_TCP_READAHEAD_BUFSIZE=562
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCP_RECVDELAY=0
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NET_UDP_CONNS=8
+# CONFIG_NET_BROADCAST is not set
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+# CONFIG_NET_PINGADDRCONF is not set
+# CONFIG_NET_IGMP is not set
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_RECEIVE_WINDOW=562
+CONFIG_NET_ARPTAB_SIZE=16
+# CONFIG_NET_ARP_IPIN is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_NFS is not set
+# CONFIG_FS_NXFFS is not set
+# CONFIG_FS_ROMFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=1
+# CONFIG_GRAN is not set
+
+#
+# Library Routines
+#
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_HAVE_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+CONFIG_HAVE_CXX=y
+# CONFIG_HAVE_CXXINITIALIZE is not set
+# CONFIG_CXX_NEWLONG is not set
+
+#
+# Application Configuration
+#
+
+#
+# Named Applications
+#
+CONFIG_NAMEDAPP=y
+
+#
+# Examples
+#
+
+#
+# ADC example
+#
+# CONFIG_EXAMPLES_ADC is not set
+
+#
+# Buttons example
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+
+#
+# CAN example
+#
+# CONFIG_EXAMPLES_CAN is not set
+
+#
+# USB CDC/ACM class driver example
+#
+# CONFIG_EXAMPLES_CDCACM is not set
+
+#
+# USB composite class driver example
+#
+# CONFIG_EXAMPLES_COMPOSITE is not set
+
+#
+# DHCP server example
+#
+# CONFIG_EXAMPLES_DHCPD is not set
+
+#
+# FTP client example
+#
+# CONFIG_EXAMPLES_FTPC is not set
+
+#
+# FTP server example
+#
+# CONFIG_EXAMPLES_FTPD is not set
+
+#
+# "Hello, World!" example
+#
+# CONFIG_EXAMPLES_HELLO is not set
+
+#
+# "Hello, World!" C++ example
+#
+# CONFIG_EXAMPLES_HELLOXX is not set
+
+#
+# USB HID keyboard example
+#
+# CONFIG_EXAMPLES_HIDKBD is not set
+
+#
+# IGMP example
+#
+# CONFIG_EXAMPLES_IGMP is not set
+
+#
+# LCD read/write example
+#
+# CONFIG_EXAMPLES_LCDRW is not set
+
+#
+# Memory management example
+#
+# CONFIG_EXAMPLES_MM is not set
+
+#
+# File system mount example
+#
+# CONFIG_EXAMPLES_MOUNT is not set
+
+#
+# FreeModBus example
+#
+# CONFIG_EXAMPLES_MODBUS is not set
+
+#
+# Network test example
+#
+# CONFIG_EXAMPLES_NETTEST is not set
+
+#
+# NuttShell (NSH) example
+#
+CONFIG_EXAMPLES_NSH=y
+
+#
+# NULL example
+#
+# CONFIG_EXAMPLES_NULL is not set
+
+#
+# NX graphics example
+#
+# CONFIG_EXAMPLES_NX is not set
+
+#
+# NxConsole example
+#
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+
+#
+# NXFFS file system example
+#
+# CONFIG_EXAMPLES_NXFFS is not set
+
+#
+# NXFLAT example
+#
+# CONFIG_EXAMPLES_NXFLAT is not set
+
+#
+# NX graphics "Hello, World!" example
+#
+# CONFIG_EXAMPLES_NXHELLO is not set
+
+#
+# NX graphics image example
+#
+# CONFIG_EXAMPLES_NXIMAGE is not set
+
+#
+# NX graphics lines example
+#
+# CONFIG_EXAMPLES_NXLINES is not set
+
+#
+# NX graphics text example
+#
+# CONFIG_EXAMPLES_NXTEXT is not set
+
+#
+# OS test example
+#
+# CONFIG_EXAMPLES_OSTEST is not set
+
+#
+# Pascal "Hello, World!"example
+#
+# CONFIG_EXAMPLES_PASHELLO is not set
+
+#
+# Pipe example
+#
+# CONFIG_EXAMPLES_PIPE is not set
+
+#
+# Poll example
+#
+# CONFIG_EXAMPLES_POLL is not set
+
+#
+# Pulse width modulation (PWM) example
+#
+
+#
+# Quadrature encoder example
+#
+# CONFIG_EXAMPLES_QENCODER is not set
+
+#
+# RGMP example
+#
+# CONFIG_EXAMPLES_RGMP is not set
+
+#
+# ROMFS example
+#
+# CONFIG_EXAMPLES_ROMFS is not set
+
+#
+# sendmail example
+#
+# CONFIG_EXAMPLES_SENDMAIL is not set
+
+#
+# Serial loopback example
+#
+# CONFIG_EXAMPLES_SERLOOP is not set
+
+#
+# Telnet daemon example
+#
+# CONFIG_EXAMPLES_TELNETD is not set
+
+#
+# THTTPD web server example
+#
+# CONFIG_EXAMPLES_THTTPD is not set
+
+#
+# TIFF generation example
+#
+# CONFIG_EXAMPLES_TIFF is not set
+
+#
+# Touchscreen example
+#
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+
+#
+# UDP example
+#
+# CONFIG_EXAMPLES_UDP is not set
+
+#
+# uIP web server example
+#
+# CONFIG_EXAMPLES_UIP is not set
+
+#
+# USB serial test example
+#
+# CONFIG_EXAMPLES_USBSERIAL is not set
+
+#
+# USB mass storage class example
+#
+# CONFIG_EXAMPLES_USBMSC is not set
+
+#
+# USB serial terminal example
+#
+# CONFIG_EXAMPLES_USBTERM is not set
+
+#
+# Watchdog timer example
+#
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# wget example
+#
+# CONFIG_EXAMPLES_WGET is not set
+
+#
+# WLAN example
+#
+# CONFIG_EXAMPLES_WLAN is not set
+
+#
+# Interpreters
+#
+
+#
+# Interpreters
+#
+# CONFIG_FICL is not set
+# CONFIG_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+
+#
+# DHCP client
+#
+# CONFIG_NETUTILS_DHCPC is not set
+
+#
+# DHCP server
+#
+# CONFIG_NETUTILS_DHCPD is not set
+
+#
+# FTP client
+#
+# CONFIG_NETUTILS_FTPC is not set
+
+#
+# FTP server
+#
+# CONFIG_NETUTILS_FTPD is not set
+
+#
+# Name resolution
+#
+CONFIG_NETUTILS_RESOLV=y
+CONFIG_NET_RESOLV_ENTRIES=8
+
+#
+# SMTP
+#
+# CONFIG_NETUTILS_SMTP is not set
+
+#
+# TFTP client
+#
+CONFIG_NETUTILS_TELNETD=y
+
+#
+# TFTP client
+#
+CONFIG_NETUTILS_TFTPC=y
+
+#
+# THTTPD web server
+#
+# CONFIG_NETUTILS_THTTPD is not set
+
+#
+# uIP support library
+#
+CONFIG_NETUTILS_UIPLIB=y
+
+#
+# uIP web client
+#
+CONFIG_NETUTILS_WEBCLIENT=y
+
+#
+# uIP web server
+#
+# CONFIG_NETUTILS_WEBSERVER is not set
+
+#
+# ModBus
+#
+
+#
+# FreeModbus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+CONFIG_NSH_LIBRARY=y
+CONFIG_NSH_BUILTIN_APPS=y
+
+#
+# Disable Individual commands
+#
+# CONFIG_NSH_DISABLE_CAT is not set
+# CONFIG_NSH_DISABLE_CD is not set
+# CONFIG_NSH_DISABLE_CP is not set
+# CONFIG_NSH_DISABLE_DD is not set
+# CONFIG_NSH_DISABLE_ECHO is not set
+# CONFIG_NSH_DISABLE_EXEC is not set
+# CONFIG_NSH_DISABLE_EXIT is not set
+# CONFIG_NSH_DISABLE_FREE is not set
+# CONFIG_NSH_DISABLE_GET is not set
+# CONFIG_NSH_DISABLE_HELP is not set
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_KILL is not set
+# CONFIG_NSH_DISABLE_LOSETUP is not set
+# CONFIG_NSH_DISABLE_LS is not set
+# CONFIG_NSH_DISABLE_MB is not set
+# CONFIG_NSH_DISABLE_MKDIR is not set
+# CONFIG_NSH_DISABLE_MKFATFS is not set
+# CONFIG_NSH_DISABLE_MKFIFO is not set
+# CONFIG_NSH_DISABLE_MKRD is not set
+# CONFIG_NSH_DISABLE_MH is not set
+# CONFIG_NSH_DISABLE_MOUNT is not set
+# CONFIG_NSH_DISABLE_MW is not set
+# CONFIG_NSH_DISABLE_NSFMOUNT is not set
+# CONFIG_NSH_DISABLE_PS is not set
+# CONFIG_NSH_DISABLE_PING is not set
+# CONFIG_NSH_DISABLE_PUT is not set
+# CONFIG_NSH_DISABLE_PWD is not set
+# CONFIG_NSH_DISABLE_RM is not set
+# CONFIG_NSH_DISABLE_RMDIR is not set
+# CONFIG_NSH_DISABLE_SET is not set
+# CONFIG_NSH_DISABLE_SH is not set
+# CONFIG_NSH_DISABLE_SLEEP is not set
+# CONFIG_NSH_DISABLE_TEST is not set
+# CONFIG_NSH_DISABLE_UMOUNT is not set
+# CONFIG_NSH_DISABLE_UNSET is not set
+# CONFIG_NSH_DISABLE_USLEEP is not set
+# CONFIG_NSH_DISABLE_WGET is not set
+# CONFIG_NSH_DISABLE_XD is not set
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+# CONFIG_NSH_DISABLESCRIPT is not set
+# CONFIG_NSH_DISABLEBG is not set
+CONFIG_NSH_CONSOLE=y
+# CONFIG_NSH_CONDEV is not set
+# CONFIG_NSH_ARCHINIT is not set
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_TELNETD_PORT=23
+CONFIG_NSH_TELNETD_DAEMONPRIO=100
+CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048
+CONFIG_NSH_TELNETD_CLIENTPRIO=100
+CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_NOMAC=y
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom free memory command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# readline() support
+#
+CONFIG_SYSTEM_READLINE=y
+CONFIG_READLINE_ECHO=y
+
+#
+# VSN board Add-Ons
+#
+
+#
+# VSN board add-ons
+#
+# CONFIG_VSN_POWEROFF is not set
+# CONFIG_VSN_RAMTRON is not set
+# CONFIG_VSN_SDCARD is not set
+# CONFIG_VSN_SYSINFO is not set
diff --git a/nuttx/configs/shenzhou/nsh/setenv.sh b/nuttx/configs/shenzhou/nsh/setenv.sh
new file mode 100755
index 000000000..d57d6f003
--- /dev/null
+++ b/nuttx/configs/shenzhou/nsh/setenv.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+# configs/shenzhou/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# This is the path to the tools/ subdirectory
+export TOOLS_DIR="${WD}/configs/shenzhou/tools"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:${TOOLS_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/shenzhou/scripts/ld.script b/nuttx/configs/shenzhou/scripts/ld.script
new file mode 100644
index 000000000..14f924bae
--- /dev/null
+++ b/nuttx/configs/shenzhou/scripts/ld.script
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * configs/shenzhou/scripts/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F107VC has 256K of FLASH beginning at address 0x0800:0000 and
+ * 64K of SRAM beginning at address 0x2000:0000.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F107VC has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/shenzhou/scripts/ld.script.dfu b/nuttx/configs/shenzhou/scripts/ld.script.dfu
new file mode 100644
index 000000000..53e3ee4fc
--- /dev/null
+++ b/nuttx/configs/shenzhou/scripts/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/shenzhou/scripts/ld.script.dfu
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F107VC has 256K of FLASH beginning at address 0x0800:0000 and
+ * 64K of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * STMicro DFU bootloader is being used. In that case, the corrct load .text
+ * load address is 0x08003000 (leaving 208K).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 208K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F107VC has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/shenzhou/src/Makefile b/nuttx/configs/shenzhou/src/Makefile
new file mode 100644
index 000000000..11e36f136
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/Makefile
@@ -0,0 +1,127 @@
+############################################################################
+# configs/shenzhou/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_spi.c up_mmcsd.c
+
+ifeq ($(CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG),y)
+CSRCS += up_clockconfig.c
+endif
+
+ifeq ($(CONFIG_HAVE_CXX),y)
+CSRCS += up_cxxinitialize.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_autoleds.c
+else
+CSRCS += up_userleds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_STM32_OTGFS),y)
+CSRCS += up_usb.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
+CSRCS += up_composite.c
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CSRCS += up_can.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/shenzhou/src/shenzhou-internal.h b/nuttx/configs/shenzhou/src/shenzhou-internal.h
new file mode 100644
index 000000000..6f9683a56
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/shenzhou-internal.h
@@ -0,0 +1,274 @@
+/****************************************************************************************************
+ * configs/shenzhou/src/shenzhou-internal.h
+ * arch/arm/src/board/shenzhou-internal.n
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************************************/
+
+#ifndef __CONFIGS_SHENZHOUL_SRC_SHENZHOU_INTERNAL_H
+#define __CONFIGS_SHENZHOUL_SRC_SHENZHOU_INTERNAL_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************************************
+ * Definitions
+ ****************************************************************************************************/
+/* Configuration ************************************************************************************/
+/* How many SPI modules does this chip support? */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 3
+# undef CONFIG_STM32_SPI3
+#endif
+
+/* Shenzhou GPIO Configuration **********************************************************************/
+
+/* STM3240G-EVAL GPIOs ******************************************************************************/
+/* Wireless
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 26 PA3 315M_VT
+ * 17 PC2 WIRELESS_INT
+ * 18 PC3 WIRELESS_CE To the NRF24L01 2.4G wireless module
+ * 59 PD12 WIRELESS_CS To the NRF24L01 2.4G wireless module
+ */
+
+#define GPIO_WIRELESS_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN12)
+
+/* Buttons
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 23 PA0 WAKEUP Connected to KEY4. Active low: Closing KEY4 pulls WAKEUP to ground.
+ * 47 PB10 USERKEY Connected to KEY2
+ * 33 PC4 USERKEY2 Connected to KEY1
+ * 7 PC13 TAMPER Connected to KEY3
+ */
+
+/* BUTTONS -- NOTE that all have EXTI interrupts configured */
+
+#define MIN_IRQBUTTON BUTTON_KEY1
+#define MAX_IRQBUTTON BUTTON_KEY4
+#define NUM_IRQBUTTONS (BUTTON_KEY4 - BUTTON_KEY1 + 1)
+
+#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN0)
+#define GPIO_BTN_USERKEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTB|GPIO_PIN10)
+#define GPIO_BTN_USERKEY2 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTC|GPIO_PIN4)
+#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTC|GPIO_PIN13)
+
+/* LEDs
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 83 PD2 LED1 Active low: Pulled high
+ * 84 PD3 LED2 Active low: Pulled high
+ * 85 PD4 LED3 Active low: Pulled high
+ * 88 PD7 LED4 Active low: Pulled high
+ */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN2)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN3)
+#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN4)
+#define GPIO_LED4 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN5)
+
+/* TFT LCD
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 37 PB2 DATA_LE To TFT LCD (CN13)
+ * 96 PB9 F_CS To both the TFT LCD (CN13) and to the W25X16 SPI FLASH
+ * 34 PC5 TP_INT JP6. To TFT LCD (CN13) module
+ * 65 PC8 LCD_CS Active low: Pulled high
+ * 66 PC9 TP_CS Active low: Pulled high
+ * 60 PD13 LCD_RS To TFT LCD (CN13)
+ * 61 PD14 LCD_WR To TFT LCD (CN13)
+ * 62 PD15 LCD_RD To TFT LCD (CN13)
+ * 97 PE0 DB00 To TFT LCD (CN13)
+ * 98 PE1 DB01 To TFT LCD (CN13)
+ * 1 PE2 DB02 To TFT LCD (CN13)
+ * 2 PE3 DB03 To TFT LCD (CN13)
+ * 3 PE4 DB04 To TFT LCD (CN13)
+ * 4 PE5 DB05 To TFT LCD (CN13)
+ * 5 PE6 DB06 To TFT LCD (CN13)
+ * 38 PE7 DB07 To TFT LCD (CN13)
+ * 39 PE8 DB08 To TFT LCD (CN13)
+ * 40 PE9 DB09 To TFT LCD (CN13)
+ * 41 PE10 DB10 To TFT LCD (CN13)
+ * 42 PE11 DB11 To TFT LCD (CN13)
+ * 43 PE12 DB12 To TFT LCD (CN13)
+ * 44 PE13 DB13 To TFT LCD (CN13)
+ * 45 PE14 DB14 To TFT LCD (CN13)
+ * 46 PE15 DB15 To TFT LCD (CN13)
+ */
+
+#define GPIO_LCD_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN9)
+
+/* RS-485
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 88 PD7 485_DIR SP3485 read enable (not)
+ */
+
+/* To be provided */
+
+/* USB
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 95 PB8 USB_PWR Drives USB VBUS
+ */
+
+#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_SPEED_100MHz|\
+ GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN8)
+
+/* Audio DAC
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ */
+
+/* To be provided */
+
+/* SPI FLASH
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 96 PB9 F_CS To both the TFT LCD (CN13) and to the W25X16 SPI FLASH
+ */
+
+#define GPIO_FLASH_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN9)
+
+/* SD Card
+ *
+ * -- ---- -------------- -------------------------------------------------------------------
+ * PN NAME SIGNAL NOTES
+ * -- ---- -------------- -------------------------------------------------------------------
+ * 53 PB14 SD_CD Active low: Pulled high
+ * 58 PD11 SD_CS
+ */
+
+#define GPIO_SD_CD (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_EXTI|GPIO_PORTB|GPIO_PIN14)
+#define GPIO_SD_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN11)
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public data
+ ****************************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3240G-EVAL board.
+ *
+ ****************************************************************************************************/
+
+void weak_function stm32_spiinitialize(void);
+
+/****************************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related GPIO pins for
+ * the STM3240G-EVAL board.
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_OTGFS
+void weak_function stm32_usbinitialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality. This function will
+ * start a thread that will monitor for device connection/disconnection events.
+ *
+ ****************************************************************************************************/
+
+#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
+int stm32_usbhost_initialize(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_sdinitialize
+ *
+ * Description:
+ * Initialize the SPI-based SD card. Requires CONFIG_DISABLE_MOUNTPOINT=n
+ * and CONFIG_STM32_SPI1=y
+ *
+ ****************************************************************************/
+
+int stm32_sdinitialize(int minor);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SHENZHOUL_SRC_SHENZHOU_INTERNAL_H */
diff --git a/nuttx/configs/shenzhou/src/up_autoleds.c b/nuttx/configs/shenzhou/src/up_autoleds.c
new file mode 100644
index 000000000..996836c79
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_autoleds.c
@@ -0,0 +1,401 @@
+/****************************************************************************
+ * configs/shenzhou/src/up_autoleds.c
+ * arch/arm/src/board/up_autoleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+#include <nuttx/power/pm.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "shenzhou-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define SHENZHOU_LED1 (1 << 0)
+#define SHENZHOU_LED2 (1 << 1)
+#define SHENZHOU_LED3 (1 << 2)
+#define SHENZHOU_LED4 (1 << 3)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+#define LED_STARTED_ON_SETBITS ((SHENZHOU_LED1) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((SHENZHOU_LED2|SHENZHOU_LED3|SHENZHOU_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS ((SHENZHOU_LED1|SHENZHOU_LED2|SHENZHOU_LED3|SHENZHOU_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((SHENZHOU_LED2) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((SHENZHOU_LED1|SHENZHOU_LED3|SHENZHOU_LED4) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS ((SHENZHOU_LED1) << OFF_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_CLRBITS ((SHENZHOU_LED2|SHENZHOU_LED3|SHENZHOU_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_IRQSENABLED_ON_SETBITS ((SHENZHOU_LED1|SHENZHOU_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((SHENZHOU_LED3|SHENZHOU_LED4) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS ((SHENZHOU_LED2) << OFF_SETBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_CLRBITS ((SHENZHOU_LED1|SHENZHOU_LED3|SHENZHOU_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_STACKCREATED_ON_SETBITS ((SHENZHOU_LED3) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((SHENZHOU_LED1|SHENZHOU_LED2|SHENZHOU_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS ((SHENZHOU_LED1|SHENZHOU_LED2) << OFF_SETBITS_SHIFT)
+#define LED_STACKCREATED_OFF_CLRBITS ((SHENZHOU_LED3|SHENZHOU_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_INIRQ_ON_SETBITS ((SHENZHOU_LED1) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((SHENZHOU_LED1) << OFF_CLRBITS_SHIFT)
+
+#define LED_SIGNAL_ON_SETBITS ((SHENZHOU_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((SHENZHOU_LED2) << OFF_CLRBITS_SHIFT)
+
+#define LED_ASSERTION_ON_SETBITS ((SHENZHOU_LED4) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((SHENZHOU_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_PANIC_ON_SETBITS ((SHENZHOU_LED4) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((SHENZHOU_LED4) << OFF_CLRBITS_SHIFT)
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+
+/* LED State Controls */
+
+static inline void led_clrbits(unsigned int clrbits);
+static inline void led_setbits(unsigned int setbits);
+static void led_setonoff(unsigned int bits);
+
+/* LED Power Management */
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
+static int led_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
+ LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
+
+ (LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
+ LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
+
+ (LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
+ LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
+
+ (LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
+ LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
+};
+
+#ifdef CONFIG_PM
+static struct pm_callback_s g_ledscb =
+{
+ .notify = led_pm_notify,
+ .prepare = led_pm_prepare,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: led_clrbits
+ *
+ * Description:
+ * Clear all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & SHENZHOU_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & SHENZHOU_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((clrbits & SHENZHOU_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, false);
+ }
+
+ if ((clrbits & SHENZHOU_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, false);
+ }
+}
+
+/****************************************************************************
+ * Name: led_setbits
+ *
+ * Description:
+ * Set all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & SHENZHOU_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & SHENZHOU_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((setbits & SHENZHOU_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, true);
+ }
+
+ if ((setbits & SHENZHOU_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, true);
+ }
+}
+
+/****************************************************************************
+ * Name: led_setonoff
+ *
+ * Description:
+ * Set/clear all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Name: led_pm_notify
+ *
+ * Description:
+ * Notify the driver of new power state. This callback is called after
+ * all drivers have had the opportunity to prepare for the new power state.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ switch (pmstate)
+ {
+ case(PM_NORMAL):
+ {
+ /* Restore normal LEDs operation */
+
+ }
+ break;
+
+ case(PM_IDLE):
+ {
+ /* Entering IDLE mode - Turn leds off */
+
+ }
+ break;
+
+ case(PM_STANDBY):
+ {
+ /* Entering STANDBY mode - Logic for PM_STANDBY goes here */
+
+ }
+ break;
+
+ case(PM_SLEEP):
+ {
+ /* Entering SLEEP mode - Logic for PM_SLEEP goes here */
+
+ }
+ break;
+
+ default:
+ {
+ /* Should not get here */
+
+ }
+ break;
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: led_pm_prepare
+ *
+ * Description:
+ * Request the driver to prepare for a new power state. This is a warning
+ * that the system is about to enter into a new power state. The driver
+ * should begin whatever operations that may be required to enter power
+ * state. The driver may abort the state change mode by returning a
+ * non-zero value from the callback function.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static int led_pm_prepare(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ /* No preparation to change power modes is required by the LEDs driver.
+ * We always accept the state change by returning OK.
+ */
+
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledpminitialize
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+void up_ledpminitialize(void)
+{
+ /* Register to receive power management callbacks */
+
+ int ret = pm_register(&g_ledscb);
+ if (ret != OK)
+ {
+ up_ledon(LED_ASSERTION);
+ }
+}
+#endif /* CONFIG_PM */
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/shenzhou/src/up_boot.c b/nuttx/configs/shenzhou/src/up_boot.c
new file mode 100644
index 000000000..efc4f26bd
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_boot.c
@@ -0,0 +1,102 @@
+/************************************************************************************
+ * configs/shenzhou/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "shenzhou-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI3)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/shenzhou/src/up_buttons.c b/nuttx/configs/shenzhou/src/up_buttons.c
new file mode 100644
index 000000000..5a8515ca5
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_buttons.c
@@ -0,0 +1,169 @@
+/****************************************************************************
+ * configs/shenzhou/src/up_buttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "shenzhou-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pin configuration for each Shenzhou button. This array is indexed by
+ * the BUTTON_* definitions in board.h
+ */
+
+static const uint16_t g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_USERKEY2, GPIO_BTN_USERKEY, GPIO_BTN_TAMPER, GPIO_BTN_WAKEUP
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for some pins but NOT used in this file
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed for most keys. The exception
+ * is the WAKEUP button.
+ */
+
+ bool released = stm32_gpioread(g_buttons[i]);
+ if (i == BUTTON_WAKEUP)
+ {
+ released = !released;
+ }
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ /* The following should be atomic */
+
+ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
+ {
+ oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/shenzhou/src/up_can.c b/nuttx/configs/shenzhou/src/up_can.c
new file mode 100644
index 000000000..6b09be7ca
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_can.c
@@ -0,0 +1,133 @@
+/************************************************************************************
+ * configs/shenzhou/src/up_can.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/can.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm32_can.h"
+#include "shenzhou-internal.h"
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+/* The STM32F107VC supports CAN1 and CAN2 */
+
+#define CAN_PORT 1
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: can_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/can.
+ *
+ ************************************************************************************/
+
+int can_devinit(void)
+{
+ static bool initialized = false;
+ struct can_dev_s *can;
+ int ret;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Call stm32_caninitialize() to get an instance of the CAN interface */
+
+ can = stm32_caninitialize(CAN_PORT);
+ if (can == NULL)
+ {
+ candbg("ERROR: Failed to get CAN interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the CAN driver at "/dev/can0" */
+
+ ret = can_register("/dev/can0", can);
+ if (ret < 0)
+ {
+ candbg("ERROR: can_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_CAN && CONFIG_STM32_CAN1 */
diff --git a/nuttx/configs/shenzhou/src/up_clockconfig.c b/nuttx/configs/shenzhou/src/up_clockconfig.c
new file mode 100644
index 000000000..6c3bd56e1
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_clockconfig.c
@@ -0,0 +1,167 @@
+/************************************************************************************
+ * configs/olimex-stm32-p107/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_board_clockconfig
+ *
+ * Description:
+ * Any STM32 board may replace the "standard" board clock configuration logic with
+ * its own, custom clock cofiguration logic.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
+void stm32_board_clockconfig(void)
+{
+ uint32_t regval;
+
+ regval = getreg32(STM32_RCC_CR);
+ regval &= ~RCC_CR_HSEBYP; /* Disable HSE clock bypass */
+ regval |= RCC_CR_HSEON; /* Enable HSE */
+ putreg32(regval, STM32_RCC_CR);
+
+ /* Set flash wait states
+ * Sysclk runs with 72MHz -> 2 waitstates.
+ * 0WS from 0-24MHz
+ * 1WS from 24-48MHz
+ * 2WS from 48-72MHz
+ */
+
+ regval = getreg32(STM32_FLASH_ACR);
+ regval &= ~FLASH_ACR_LATENCY_MASK;
+ regval |= (FLASH_ACR_LATENCY_2|FLASH_ACR_PRTFBE);
+ putreg32(regval, STM32_FLASH_ACR);
+
+ regval = getreg32(STM32_RCC_CFGR2);
+ regval &= ~(RCC_CFGR2_PREDIV2_MASK
+ | RCC_CFGR2_PLL2MUL_MASK
+ | RCC_CFGR2_PREDIV1SRC_MASK
+ | RCC_CFGR2_PREDIV1_MASK);
+ regval |= RCC_CFGR2_PREDIV2d5; /* 25MHz / 5 */
+ regval |= RCC_CFGR2_PLL2MULx8; /* 5MHz * 8 => 40MHz */
+ regval |= RCC_CFGR2_PREDIV1SRC_PLL2; /* Use PLL2 as input for PREDIV1 */
+ regval |= RCC_CFGR2_PREDIV1d5; /* 40MHz / 5 => 8MHz */
+ putreg32(regval, STM32_RCC_CFGR2);
+
+ /* Set the PCLK2 divider */
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~(RCC_CFGR_PPRE2_MASK | RCC_CFGR_HPRE_MASK);
+ regval |= STM32_RCC_CFGR_PPRE2;
+ regval |= RCC_CFGR_HPRE_SYSCLK;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ /* Set the PCLK1 divider */
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_PPRE1_MASK;
+ regval |= STM32_RCC_CFGR_PPRE1;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLL2ON;
+ putreg32(regval, STM32_RCC_CR);
+
+ /* Wait for PLL2 ready */
+
+ while((getreg32(STM32_RCC_CR) & RCC_CR_PLL2RDY) == 0);
+
+ /* Setup PLL3 for RMII clock on MCO */
+
+ regval = getreg32(STM32_RCC_CFGR2);
+ regval &= ~(RCC_CFGR2_PLL3MUL_MASK);
+ regval |= RCC_CFGR2_PLL3MULx10;
+ putreg32(regval, STM32_RCC_CFGR2);
+
+ /* Switch PLL3 on */
+
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLL3ON;
+ putreg32(regval, STM32_RCC_CR);
+
+ while ((getreg32(STM32_RCC_CR) & RCC_CR_PLL3RDY) == 0);
+
+ /* Set main PLL source 8MHz * 9 => 72MHz*/
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL_MASK);
+ regval |= (RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL_CLKx9);
+ putreg32(regval, STM32_RCC_CFGR);
+
+ /* Switch main PLL on */
+
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLLON;
+ putreg32(regval, STM32_RCC_CR);
+
+ while ((getreg32(STM32_RCC_CR) & RCC_CR_PLLRDY) == 0);
+
+ /* Select PLL as system clock source */
+
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_SW_MASK;
+ regval |= RCC_CFGR_SW_PLL;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ /* Wait until PLL is used as the system clock source */
+
+ while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_PLL) == 0);
+}
+#endif
diff --git a/nuttx/configs/shenzhou/src/up_composite.c b/nuttx/configs/shenzhou/src/up_composite.c
new file mode 100644
index 000000000..81c33dcc8
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_composite.c
@@ -0,0 +1,106 @@
+/****************************************************************************
+ * configs/shenzhou/src/up_composite.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 SPI-based MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+
+#include "shenzhou-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Device minor number */
+
+#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1
+# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: composite_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int composite_archinitialize(void)
+{
+ /* If examples/composite is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ *
+ * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH
+ * was built.
+ */
+
+#ifndef CONFIG_NSH_BUILTIN_APPS
+ return sd_mount(CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1);
+#else
+ return OK;
+#endif /* CONFIG_NSH_BUILTIN_APPS */
+}
diff --git a/nuttx/configs/shenzhou/src/up_cxxinitialize.c b/nuttx/configs/shenzhou/src/up_cxxinitialize.c
new file mode 100644
index 000000000..406827dbf
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_cxxinitialize.c
@@ -0,0 +1,155 @@
+/************************************************************************************
+ * configs/shenzhou/src/up_cxxinitialize.c
+ * arch/arm/src/board/up_cxxinitialize.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include <arch/stm32/chip.h>
+#include "chip.h"
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Debug ****************************************************************************/
+/* Non-standard debug that may be enabled just for testing the static constructors */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_CXX
+#endif
+
+#ifdef CONFIG_DEBUG_CXX
+# define cxxdbg dbg
+# define cxxlldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define cxxvdbg vdbg
+# define cxxllvdbg llvdbg
+# else
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+# endif
+#else
+# define cxxdbg(x...)
+# define cxxlldbg(x...)
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This type defines one entry in initialization array */
+
+typedef void (*initializer_t)(void);
+
+/************************************************************************************
+ * External references
+ ************************************************************************************/
+/* _sinit and _einit are symbols exported by the linker script that mark the
+ * beginning and the end of the C++ initialization section.
+ */
+
+extern initializer_t _sinit;
+extern initializer_t _einit;
+
+/* _stext and _etext are symbols exported by the linker script that mark the
+ * beginning and the end of text.
+ */
+
+extern uint32_t _stext;
+extern uint32_t _etext;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_cxxinitialize
+ *
+ * Description:
+ * If C++ and C++ static constructors are supported, then this function
+ * must be provided by board-specific logic in order to perform
+ * initialization of the static C++ class instances.
+ *
+ * This function should then be called in the application-specific
+ * user_start logic in order to perform the C++ initialization. NOTE
+ * that no component of the core NuttX RTOS logic is involved; This
+ * function defintion only provides the 'contract' between application
+ * specific C++ code and platform-specific toolchain support
+ *
+ ***************************************************************************/
+
+void up_cxxinitialize(void)
+{
+ initializer_t *initp;
+
+ cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
+ &_sinit, &_einit, &_stext, &_etext);
+
+ /* Visit each entry in the initialzation table */
+
+ for (initp = &_sinit; initp != &_einit; initp++)
+ {
+ initializer_t initializer = *initp;
+ cxxdbg("initp: %p initializer: %p\n", initp, initializer);
+
+ /* Make sure that the address is non-NULL and lies in the text region
+ * defined by the linker script. Some toolchains may put NULL values
+ * or counts in the initialization table
+ */
+
+ if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
+ {
+ cxxdbg("Calling %p\n", initializer);
+ initializer();
+ }
+ }
+}
+
+#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
+
diff --git a/nuttx/configs/shenzhou/src/up_mmcsd.c b/nuttx/configs/shenzhou/src/up_mmcsd.c
new file mode 100644
index 000000000..daa149817
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_mmcsd.c
@@ -0,0 +1,124 @@
+/****************************************************************************
+ * config/shenzhou/src/up_mmcsd.c
+ * arch/arm/src/board/up_mmcsd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* SPI1 connects to the SD CARD (and to the SPI FLASH) */
+
+#define HAVE_MMCSD 1 /* Assume that we have SD support */
+#define STM32_MMCSDSPIPORTNO 1 /* Port is SPI1 */
+#define STM32_MMCSDSLOTNO 0 /* There is only one slot */
+
+#ifndef CONFIG_STM32_SPI1
+# undef HAVE_MMCSD
+#else
+# ifdef CONFIG_SPI_OWNBUS
+# warning "SPI1 is shared with SD and FLASH but CONFIG_SPI_OWNBUS is defined"
+# endif
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#ifndef CONFIG_DISABLE_MOUNTPOINT
+# undef HAVE_MMCSD
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_sdinitialize
+ *
+ * Description:
+ * Initialize the SPI-based SD card. Requires CONFIG_DISABLE_MOUNTPOINT=n
+ * and CONFIG_STM32_SPI1=y
+ *
+ ****************************************************************************/
+
+int stm32_sdinitialize(int minor)
+{
+#ifdef HAVE_MMCSD
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ fvdbg("Initializing SPI port %d\n", STM32_MMCSDSPIPORTNO);
+
+ spi = up_spiinitialize(STM32_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ fdbg("Failed to initialize SPI port %d\n", STM32_MMCSDSPIPORTNO);
+ return -ENODEV;
+ }
+
+ fvdbg("Successfully initialized SPI port %d\n", STM32_MMCSDSPIPORTNO);
+
+ /* Bind the SPI port to the slot */
+
+ fvdbg("Binding SPI port %d to MMC/SD slot %d\n",
+ STM32_MMCSDSPIPORTNO, STM32_MMCSDSLOTNO);
+
+ ret = mmcsd_spislotinitialize(minor, STM32_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ fdbg("Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ STM32_MMCSDSPIPORTNO, STM32_MMCSDSLOTNO, ret);
+ return ret;
+ }
+
+ fvdbg("Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ STM32_MMCSDSPIPORTNO, STM32_MMCSDSLOTNO);
+#endif
+ return OK;
+}
+
diff --git a/nuttx/configs/shenzhou/src/up_nsh.c b/nuttx/configs/shenzhou/src/up_nsh.c
new file mode 100644
index 000000000..1324ae0b9
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_nsh.c
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * config/shenzhou/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "stm32_internal.h"
+#include "shenzhou-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Assume that we support everything until convinced otherwise */
+
+#define HAVE_MMCSD 1
+#define HAVE_USBDEV 1
+#define HAVE_USBHOST 1
+
+/* Configuration ************************************************************/
+/* SPI1 connects to the SD CARD (and to the SPI FLASH) */
+
+#define STM32_MMCSDSPIPORTNO 1 /* SPI1 */
+#define STM32_MMCSDSLOTNO 0 /* Only one slot */
+
+#ifndef CONFIG_STM32_SPI1
+# undef HAVE_MMCSD
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#ifdef CONFIG_DISABLE_MOUNTPOINT
+# undef HAVE_MMCSD
+#endif
+
+/* Default MMC/SD minor number */
+
+#ifdef HAVE_MMCSD
+# ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+# endif
+
+/* Default MMC/SD SLOT number */
+
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != STM32_MMCSDSLOTNO
+# error "Only one MMC/SD slot: Slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO
+# endif
+
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO
+# endif
+
+/* Verify configured SPI port number */
+
+# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != STM32_MMCSDSPIPORTNO
+# error "Only one MMC/SD port: SPI1"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO STM32_MMCSDSPIPORTNO
+# endif
+
+# ifndef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO STM32_MMCSDSPIPORTNO
+# endif
+#endif
+
+/* Can't support USB host or device features if USB OTG FS is not enabled */
+
+#ifndef CONFIG_STM32_OTGFS
+# undef HAVE_USBDEV
+# undef HAVE_USBHOST
+#endif
+
+/* Can't support USB device is USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef HAVE_USBDEV
+#endif
+
+/* Can't support USB host is USB host is not enabled */
+
+#ifndef CONFIG_USBHOST
+# undef HAVE_USBHOST
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST)
+ int ret;
+#endif
+
+ /* Initialize the SPI-based MMC/SD slot */
+
+#ifdef HAVE_MMCSD
+ ret = stm32_sdinitialze(CONFIG_NSH_MMCSDMINOR);
+ if (ret < 0)
+ {
+ message("nsh_archinitialize: Failed to initialize MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSLOTNO, ret);
+ return ret;
+ }
+#endif
+
+ /* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
+ * will monitor for USB connection and disconnection events.
+ */
+
+#ifdef HAVE_USBHOST
+ ret = stm32_usbhost_initialize();
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret);
+ return ret;
+ }
+#endif
+
+ return OK;
+}
diff --git a/nuttx/configs/shenzhou/src/up_spi.c b/nuttx/configs/shenzhou/src/up_spi.c
new file mode 100644
index 000000000..ce6a1f75e
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_spi.c
@@ -0,0 +1,206 @@
+/************************************************************************************
+ * configs/shenzhou/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "shenzhou-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI3)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Shenzhou board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI1 and/or SPI3 was already provided in stm32_rcc.c.
+ * Configurations of SPI pins is performed in stm32_spi.c.
+ * Here, we only initialize chip select pins unique to the board
+ * architecture.
+ */
+
+ /* SPI1 connects to the SD CARD and to the SPI FLASH */
+
+#ifdef CONFIG_STM32_SPI1
+ stm32_configgpio(GPIO_SD_CS);
+ stm32_configgpio(GPIO_FLASH_CS);
+#endif
+
+ /* SPI3 connects to TFT LCD and the RF24L01 2.4G wireless module */
+
+#ifdef CONFIG_STM32_SPI3
+ stm32_configgpio(GPIO_LCD_CS);
+ stm32_configgpio(GPIO_WIRELESS_CS);
+#endif
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ /* SPI1 connects to the SD CARD and to the SPI FLASH */
+
+ if (devid == SPIDEV_MMCSD)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_SD_CS, !selected);
+ }
+ else if (devid == SPIDEV_FLASH)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_FLASH_CS, !selected);
+ }
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ /* The card detect pin is pulled up so that we detect the presence of a card
+ * by see a low value on the input pin.
+ */
+
+ if (stm32_gpioread(GPIO_SD_CD))
+ {
+ return 0;
+ }
+
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ /* SPI3 connects to TFT LCD and the RF24L01 2.4G wireless module */
+
+ if (devid == SPIDEV_TOUCHSCREEN)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_LCD_CS, !selected);
+ }
+ else if (devid == SPIDEV_WIRELESS)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_WIRELESS_CS, !selected);
+ }
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return 0;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI3 */
diff --git a/nuttx/configs/shenzhou/src/up_usb.c b/nuttx/configs/shenzhou/src/up_usb.c
new file mode 100644
index 000000000..1cf8a39a7
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_usb.c
@@ -0,0 +1,294 @@
+/************************************************************************************
+ * configs/shenzhou/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sched.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbhost.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "shenshou-internal.h"
+
+#ifdef CONFIG_STM32_OTGFS
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
+# define HAVE_USB 1
+#else
+# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
+# undef HAVE_USB
+#endif
+
+#ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+#endif
+
+#ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: usbhost_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static int usbhost_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ uvdbg("Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ uvdbg("%s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related
+ * GPIO pins for the STM3240G-EVAL board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
+
+ /* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
+
+#ifdef CONFIG_STM32_OTGFS
+ stm32_configgpio(GPIO_OTGFS_VBUS);
+ stm32_configgpio(GPIO_OTGFS_PWRON);
+ stm32_configgpio(GPIO_OTGFS_OVER);
+#endif
+}
+
+/***********************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality.
+ * This function will start a thread that will monitor for device
+ * connection/disconnection events.
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_usbhost_initialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ uvdbg("Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ udbg("Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ uvdbg("Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ uvdbg("Start usbhost_waiter\n");
+
+ pid = TASK_CREATE("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)usbhost_waiter, (const char **)NULL);
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+
+ return -ENODEV;
+}
+#endif
+
+/***********************************************************************************
+ * Name: stm32_usbhost_vbusdrive
+ *
+ * Description:
+ * Enable/disable driving of VBUS 5V output. This function must be provided be
+ * each platform that implements the STM32 OTG FS host interface
+ *
+ * "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
+ * or, if 5 V are available on the application board, a basic power switch, must
+ * be added externally to drive the 5 V VBUS line. The external charge pump can
+ * be driven by any GPIO output. When the application decides to power on VBUS
+ * using the chosen GPIO, it must also set the port power bit in the host port
+ * control and status register (PPWR bit in OTG_FS_HPRT).
+ *
+ * "The application uses this field to control power to this port, and the core
+ * clears this bit on an overcurrent condition."
+ *
+ * Input Parameters:
+ * iface - For future growth to handle multiple USB host interface. Should be zero.
+ * enable - true: enable VBUS power; false: disable VBUS power
+ *
+ * Returned Value:
+ * None
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+void stm32_usbhost_vbusdrive(int iface, bool enable)
+{
+ DEBUGASSERT(iface == 0);
+
+ if (enable)
+ {
+ /* Enable the Power Switch by driving the enable pin low */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, false);
+ }
+ else
+ {
+ /* Disable the Power Switch by driving the enable pin high */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, true);
+ }
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_setup_overcurrent
+ *
+ * Description:
+ * Setup to receive an interrupt-level callback if an overcurrent condition is
+ * detected.
+ *
+ * Input paramter:
+ * handler - New overcurrent interrupt handler
+ *
+ * Returned value:
+ * Old overcurrent interrupt handler
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+xcpt_t stm32_setup_overcurrent(xcpt_t handler)
+{
+ return NULL;
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBDEV
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+#endif
+
+#endif /* CONFIG_STM32_OTGFS */
+
+
+
diff --git a/nuttx/configs/shenzhou/src/up_usbmsc.c b/nuttx/configs/shenzhou/src/up_usbmsc.c
new file mode 100644
index 000000000..8566aedfd
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_usbmsc.c
@@ -0,0 +1,103 @@
+/****************************************************************************
+ * configs/shenzhou/src/up_usbmsc.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 SPI-based MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include "stm32_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+ return stm32_sdinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1);
+#else
+ return OK;
+#endif
+}
diff --git a/nuttx/configs/shenzhou/src/up_userleds.c b/nuttx/configs/shenzhou/src/up_userleds.c
new file mode 100644
index 000000000..0ba029228
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_userleds.c
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * configs/shenzhou/src/up_userleds.c
+ * arch/arm/src/board/up_userleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "shenzhou-internal.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* This array maps an LED number to GPIO pin configuration */
+
+static uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ledinit
+ ****************************************************************************/
+
+void stm32_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: stm32_setled
+ ****************************************************************************/
+
+void stm32_setled(int led, bool ledon)
+{
+ if ((unsigned)led < BOARD_NLEDS)
+ {
+ stm32_gpiowrite(g_ledcfg[led], ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: stm32_setleds
+ ****************************************************************************/
+
+void stm32_setleds(uint8_t ledset)
+{
+ stm32_gpiowrite(BOARD_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED2, (ledset & BOARD_LED2_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED3, (ledset & BOARD_LED3_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED4, (ledset & BOARD_LED4_BIT) == 0);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/shenzhou/src/up_watchdog.c b/nuttx/configs/shenzhou/src/up_watchdog.c
new file mode 100644
index 000000000..a4be02371
--- /dev/null
+++ b/nuttx/configs/shenzhou/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/shenzhou/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/shenzhou/tools/olimex-arm-usb-ocd.cfg b/nuttx/configs/shenzhou/tools/olimex-arm-usb-ocd.cfg
new file mode 100644
index 000000000..d9ff2e515
--- /dev/null
+++ b/nuttx/configs/shenzhou/tools/olimex-arm-usb-ocd.cfg
@@ -0,0 +1,11 @@
+#
+# Olimex ARM-USB-OCD
+#
+# http://www.olimex.com/dev/arm-usb-ocd.html
+#
+
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG"
+ft2232_layout "olimex-jtag"
+ft2232_vid_pid 0x15BA 0x0003
+
diff --git a/nuttx/configs/shenzhou/tools/oocd.sh b/nuttx/configs/shenzhou/tools/oocd.sh
new file mode 100755
index 000000000..259156e31
--- /dev/null
+++ b/nuttx/configs/shenzhou/tools/oocd.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Get command line parameters
+
+USAGE="USAGE: $0 [-dh] <TOPDIR>"
+ADVICE="Try '$0 -h' for more information"
+
+unset DEBUG
+
+while [ ! -z "$1" ]; do
+ case $1 in
+ -d )
+ set -x
+ DEBUG=-d3
+ ;;
+ -h )
+ echo "$0 is a tool for generation of proper version files for the NuttX build"
+ echo ""
+ echo $USAGE
+ echo ""
+ echo "Where:"
+ echo " -d"
+ echo " Enable script debug"
+ echo " -h"
+ echo " show this help message and exit"
+ echo " Use the OpenOCD 0.4.0"
+ echo " <TOPDIR>"
+ echo " The full path to the top-level NuttX directory"
+ exit 0
+ ;;
+ * )
+ break;
+ ;;
+ esac
+ shift
+done
+
+TOPDIR=$1
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ echo $ADVICE
+ exit 1
+fi
+
+# This script *probably* only works with the following versions of OpenOCD:
+
+# Local search directory and configurations
+
+OPENOCD_SEARCHDIR="${TOPDIR}/configs/shenzhou/tools"
+OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`"
+
+OPENOCD_PATH="/cygdrive/c/Program Files (x86)/OpenOCD/0.4.0/bin"
+OPENOCD_EXE=openocd.exe
+OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg"
+
+
+OPENOCD_TARGET="stm32.cfg"
+OPENOCD_ARGS="${DEBUG} -s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}"
+
+echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+
+# Verify that everything is what it claims it is and is located where it claims it is.
+
+if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then
+ echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+fi
+if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}" ]; then
+ echo "OpenOCD target config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}"
+ exit 1
+fi
+if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}" ]; then
+ echo "OpenOCD interface config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}"
+ exit 1
+fi
+
+# Enable debug if so requested
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+# Okay... do it!
+
+echo "Starting OpenOCD"
+"${OPENOCD_PATH}/${OPENOCD_EXE}" ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
+
diff --git a/nuttx/configs/shenzhou/tools/stm32.cfg b/nuttx/configs/shenzhou/tools/stm32.cfg
new file mode 100644
index 000000000..463a85cfd
--- /dev/null
+++ b/nuttx/configs/shenzhou/tools/stm32.cfg
@@ -0,0 +1,69 @@
+# script for stm32
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME stm32
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+# Work-area is a space in RAM used for flash programming
+# By default use 16kB
+if { [info exists WORKAREASIZE] } {
+ set _WORKAREASIZE $WORKAREASIZE
+} else {
+ set _WORKAREASIZE 0x4000
+}
+
+# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
+jtag_khz 1000
+
+jtag_nsrst_delay 100
+jtag_ntrst_delay 100
+
+#jtag scan chain
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ # See STM Document RM0008
+ # Section 26.6.3
+ set _CPUTAPID 0x3ba00477
+}
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+if { [info exists BSTAPID ] } {
+ # FIXME this never gets used to override defaults...
+ set _BSTAPID $BSTAPID
+} else {
+ # See STM Document RM0008
+ # Section 29.6.2
+ # Low density devices, Rev A
+ set _BSTAPID1 0x06412041
+ # Medium density devices, Rev A
+ set _BSTAPID2 0x06410041
+ # Medium density devices, Rev B and Rev Z
+ set _BSTAPID3 0x16410041
+ # High density devices, Rev A
+ set _BSTAPID4 0x06414041
+ # Connectivity line devices, Rev A and Rev Z
+ set _BSTAPID5 0x06418041
+}
+jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
+ -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
+ -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
+
+$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME stm32x 0 0 0 0 $_TARGETNAME
+
+# For more information about the configuration files, take a look at:
+# openocd.texi
diff --git a/nuttx/configs/shenzhou/tools/usb-driver.txt b/nuttx/configs/shenzhou/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/shenzhou/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/sim/Kconfig b/nuttx/configs/sim/Kconfig
new file mode 100644
index 000000000..8a0c25f70
--- /dev/null
+++ b/nuttx/configs/sim/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_SIM
+endif
diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt
new file mode 100644
index 000000000..833ec58dc
--- /dev/null
+++ b/nuttx/configs/sim/README.txt
@@ -0,0 +1,501 @@
+README
+^^^^^^
+
+Contents
+^^^^^^^^
+ o Overview
+ - Description
+ - Fake Interrupts
+ - Timing Fidelity
+ o Debugging
+ o Issues
+ - 64-bit Issues
+ - Compiler differences
+ - Stack Size Issues
+ - Buffered I/O Issues
+ - Networking Issues
+ - X11 Issues
+ o Configurations
+
+Overview
+^^^^^^^^
+
+Description
+-----------
+This README file describes the contents of the build configurations available
+for the NuttX "sim" target. The sim target is a NuttX port that runs as a
+user-space program under Linux or Cygwin. It is a very "low fidelity" embedded
+system simulation: This environment does not support any kind of asynchonous
+events -- there are nothing like interrupts in this context. Therefore, there
+can be no pre-empting events.
+
+Fake Interrupts
+---------------
+In order to get timed behavior, the system timer "interrupt handler" is called
+from the sim target's IDLE loop. The IDLE runs whenever there is no other task
+running. So, for example, if a task calls sleep(), then that task will suspend
+wanting for the time to elapse. If nothing else is available to run, then the
+IDLE loop runs and the timer increments, eventually re-awakening the sleeping task.
+
+Context switching is based on logic similar to setjmp() and longjmp().
+
+The sim target is used primarily as a development and test platform for new
+RTOS features. It is also of academic interest. But it has no real-world
+application that I know of.
+
+Timing Fidelity
+---------------
+NOTE: In order to facility fast testing, the sim target's IDLE loop, by default,
+calls the system "interrupt handler" as fast as possible. As a result, there
+really are no noticeable delays when a task sleeps. However, the task really does
+sleep -- but the time scale is wrong. If you want behavior that is closer to
+normal timing, then you can define CONFIG_SIM_WALLTIME=y in your configuration
+file. This configuration setting will cause the sim target's IDLE loop to delay
+on each call so that the system "timer interrupt" is called at a rate approximately
+correct for the system timer tick rate. With this definition in the configuration,
+sleep() behavior is more or less normal.
+
+Debugging
+^^^^^^^^^
+One of the best reasons to use the simulation is that is supports great, Linux-
+based debugging. Here are the steps that I following to use the Linux ddd
+graphical front-end to GDB:
+
+1. Modify the top-level configuration file. Enable debug symbols by defining
+ the following.
+
+ cd <NuttX-Directory>
+ CONFIG_DEBUG_SYMBOLS=y
+
+2. Re-build:
+
+ cd <NuttX-Directory>
+ make clean
+ make
+
+3. Then start the debugging:
+
+ ddd nuttx &
+ gdb> b user_start
+ gdb> r
+
+NOTE: This above steps work fine on both Linux and Cygwin. On Cygwin, you
+will need to start the Cywin-X server before running ddd.
+
+Issues
+^^^^^^
+
+64-Bit Issues
+-------------
+As mentioned above, context switching is based on logic like setjmp and longjmp.
+This context switching is only available for 32-bit targets. On 64-bit machines,
+this context switching will fail.
+
+There are other 64-bit issues as well. For example, addresses are retained in
+32-bit unsigned integer types in a few places. On a 64-bit machine, the 32-bit
+address storage may correcupt 64-bit addressing. NOTE: This is really a bug --
+addresses should not be retained in uint32_t types but rather in uintptr_t types
+to avoid issues just like this.
+
+The workaround on 64-bit machines for now is to build for a 32-bit target on the
+64-bit machine. The workaround for this issue has been included in NuttX 6.15 and
+beyond. For thoses versions, you must add CONFIG_SIM_M32=y to the .config file in
+order to enable building a 32-bit image on a 64-bit platform.
+
+For older versions of NuttX, a patch also exists. The patch the Make.defs file in the
+appropriate places so that -m32 is included in the CFLAGS and -m32 and -melf_386
+are included in the LDFLAGS. See the patch
+0001-Quick-hacks-to-build-sim-nsh-ostest-on-x86_64-as-32-.patch that can be found at
+http://tech.groups.yahoo.com/group/nuttx/files.
+
+Compiler differences
+--------------------
+
+operator new:
+
+ Problem: "'operator new' takes size_t ('...') as first parameter"
+ Workaround: Add -fpermissive to the compilation flags
+
+Continue up_setjmp() issues:
+
+ With some newer compilers, I am now getting segmentation faults in
+ up_setjmp.S (even when built with the -m32 option). I have not looked into
+ this yet.
+
+Stack Size Issues
+-----------------
+When you run the NuttX simulation, it uses stacks allocated by NuttX from the
+NuttX heap. The memory management model is exactly the same in the simulation
+as it is real, target system. This is good because this produces a higher
+fidelity simulation.
+
+However, when the simulation calls into Linux/Cygwin libraries, it will still
+use these small simulation stacks. This happens, for example, when you call
+into the system to get and put characters to the console window or when you
+make x11 calls into the system. The programming model within those libraries
+will assume a Linux/Cygwin environment where the stack size grows dynamically
+and not the small, limited stacks of a deeply embedded system.
+
+As a consequence, those system libraries may allocate large data structures
+on the stack and overflow the small NuttX stacks. X11, in particular,
+requires large stacks. If you are using X11 in the simulation, make sure
+that you set aside a "lot" of stack for the X11 system calls (maybe 8 or 16Kb).
+The stack size for the thread that begins with user start is controlled
+by the configuration setting CONFIG_USERMAIN_STACKSIZE; you may need to
+increase this value to larger number to survive the X11 system calls.
+
+If you are running X11 applications as NSH add-on programs, then the stack
+size of the add-on program is controlled in another way. Here are the
+steps for increasing the stack size in that case:
+
+ cd ../apps/namedapps # Go to the namedapps directory
+ vi namedapps_list.h # Edit this file and increase the stack size of the add-on
+ rm .built *.o # This will force the namedapps logic to rebuild
+
+Buffered I/O Issues
+-------------------
+The simulated serial driver has some odd behavior. It will stall for a long time
+on reads when the C stdio buffers are being refilled. This only effects the behavior
+of things like fgetc(). Workaround: Set CONFIG_STDIO_BUFFER_SIZE=0, suppressing
+all C buffered I/O.
+
+Networking Issues
+-----------------
+I never did get networking to work on the sim target. It tries to use the tap device
+(/dev/net/tun) to emulate an Ethernet NIC, but I never got it correctly integrated
+with the NuttX networking (I probably should try using raw sockets instead).
+
+X11 Issues
+----------
+There is an X11-based framebuffer driver that you can use exercise the NuttX graphics
+subsystem on the simulator (see the sim/nx11 configuration below). This may require a
+lot of tinkering to get working, depending upon where your X11 installation stores
+libraries and header files and how it names libraries.
+
+For example, on UBuntu 9.09, I had to do the following to get a clean build:
+
+ cd /usr/lib/
+ sudo ln -s libXext.so.6.4.0 libXext.so
+
+(I also get a segmentation fault at the conclusion of the NX test -- that will need
+to get looked into as well).
+
+The X11 examples builds on Cygwin, but does not run. The last time I tried it,
+XOpenDisplay() aborted the program. UPDATE: This was caused by the small stack
+size and can be fixed by increasing the size of the NuttX stack that calls into
+X11. See the discussion "Stack Size Issues" above.
+
+Configurations
+^^^^^^^^^^^^^^
+
+mount
+
+ Description
+ -----------
+ Configures to use examples/mount. This configuration may be
+ selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/mount
+
+nettest
+
+ Description
+ -----------
+ Configures to use examples/nettest. This configuration
+ enables networking using the network TAP device. It may
+ be selected via:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/nettest
+
+ NOTES:
+ - The NuttX network is not, however, functional on the Linux TAP
+ device yet.
+
+ - As of NuttX-5.18, when built on Windows, this test does not try
+ to use the TAP device (which is not available on Cygwin anyway),
+ but inside will try to use the Cygwin WPCAP library. Only the
+ most preliminary testing has been performed with the Cygwin WPCAP
+ library, however.
+
+ NOTE that the IP address is hard-coded in arch/sim/src/up_wpcap.c.
+ You will either need to edit your configuration files to use 10.0.0.1
+ on the "target" (CONFIG_EXAMPLE_NETTEST_*) or edit up_wpcap.c to
+ select the IP address that you want to use.
+
+nsh
+
+ Description
+ -----------
+ Configures to use the NuttShell at examples/nsh. This configuration
+ may be selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/nsh
+
+nsh2
+
+ Description
+ -----------
+ This is another example that configures to use the NuttShell at examples/nsh.
+ Unlike nsh, this version uses NSH built-in functions. The nx, nxhello, and
+ nxlines examples are included as built-in functions.
+
+ X11 Configuration
+ -----------------
+ This configuration uses an X11-based framebuffer driver. Of course, this
+ configuration can only be used in environments that support X11! (And it
+ may not even be usable in all of those environments without some "tweaking"
+ See discussion below under the nx11 configuration).
+
+ Configuring
+ -----------
+ This configuration may be selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/nsh2
+
+nx
+
+ Description
+ -----------
+ Configures to use examples/nx. This configuration may be
+ selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/nx
+
+ Special Framebuffer Configuration
+ ---------------------------------
+ Special simulated framebuffer configuration options:
+
+ CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
+ CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
+ CONFIG_SIM_FBBPP - Pixel depth in bits
+
+ No Display!
+ -----------
+ This version has NO DISPLAY and is only useful for debugging NX
+ internals in environments where X11 is not supported. There is
+ and additonal configuration that may be added to include an X11-
+ based simulated framebuffer driver:
+
+ CONFIG_SIM_X11FB - Use X11 window for framebuffer
+
+ See the "nx11" configuration below for more information.
+
+ Multi- and Single-User Modes
+ ----------------------------
+ The default is the single-user NX implementation. To select
+ the multi-user NX implementation:
+
+ CONFG_NX_MULTIUSER=y
+ CONFIG_DISABLE_MQUEUE=n
+
+nx11
+
+ Description
+ -----------
+ Configures to use examples/nx. This configuration is similar
+ to the nx configuration except that it adds support for an X11-
+ based framebuffer driver. Of course, this configuration can only
+ be used in environments that support X11! (And it may not even
+ be usable in all of those environments without some "tweaking").
+
+ This configuration may be selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/nx11
+
+ Special Framebuffer Configuration
+ ---------------------------------
+ This configuration uses the same special simulated framebuffer
+ configuration options as the nx configuration:
+
+ CONFIG_SIM_X11FB - Use X11 window for framebuffer
+ CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
+ CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
+ CONFIG_SIM_FBBPP - Pixel depth in bits
+
+ X11 Configuration
+ -----------------
+ But now, since CONFIG_SIM_X11FB is also selected the following
+ definitions are needed
+
+ CONFIG_SIM_FBBPP (must match the resolution of the display).
+ CONFIG_FB_CMAP=y
+
+ My system has 24-bit color, but packed into 32-bit words so
+ the correct seeting of CONFIG_SIM_FBBPP is 32.
+
+ For whatever value of CONFIG_SIM_FBBPP is selected, the
+ corresponidng CONFIG_NX_DISABLE_*BPP setting must not be
+ disabled.
+
+ Touchscreen Support
+ -------------------
+ A X11 mouse-based touchscreen simulation can also be enabled
+ by setting:
+
+ CONFIG_INPUT=y
+ CONFIG_SIM_TOUCHSCREEN=y
+
+ Then you must also have some application logic that will call
+ arch_tcinitialize(0) to register the touchscreen driver. See
+ also configuration "touchscreen"
+
+ NOTES:
+
+ 1. If you do not have the call to sim_tcinitializE(0), the build
+ will mysteriously fail claiming that is can't find up_tcenter()
+ and up_tcleave(). That is a consequence of the crazy way that
+ the simulation is built and can only be eliminated by calling
+ up_simtouchscreen(0) from your application.
+
+ 2. You must first up_fbinitialize() before calling up_simtouchscreen()
+ or you will get a crash.
+
+ 3. Call sim_tcuninintialize() when you are finished with the
+ simulated touchscreen.
+
+ 4. Enable CONFIG_DEBUG_INPUT=y for touchscreen debug output.
+
+ X11 Build Issues
+ ----------------
+ To get the system to compile under various X11 installations
+ you may have to modify a few things. For example, in order
+ to find libXext, I had to make the following change under
+ Ubuntu 9.09:
+
+ cd /usr/lib/
+ sudo ln -s libXext.so.6.4.0 libXext.so
+
+ Multi- and Single-User Modes
+ ----------------------------
+ The default is the single-user NX implementation. To select
+ the multi-user NX implementation:
+
+ CONFG_NX_MULTIUSER=y
+ CONFIG_DISABLE_MQUEUE=n
+
+ examples/nxconsole
+ ------------------
+ This configuration is also set up to use the examples/nxconsole
+ test instead of examples/nx. To enable this configuration,
+ First, select Multi-User mode as described above. Then add the
+ following definitions to the defconfig file:
+
+ -CONFIG_NXCONSOLE=n
+ +CONFIG_NXCONSOLE=y
+
+ -CONFIG_NX_MULTIUSER=n
+ +CONFIG_NX_MULTIUSER=y
+
+ Comment out the following in the appconfig file:
+
+ -CONFIGURED_APPS += examples/nx
+ +#CONFIGURED_APPS += examples/nx
+
+ And uncomment the following:
+
+ -#CONFIGURED_APPS += examples/nxconsole
+ +CONFIGURED_APPS += examples/nxconsole
+
+ See apps/examples/README.txt for further details.
+
+nxwm
+
+ This is a special configuration setup for the NxWM window manager
+ UnitTest. The NxWM window manager can be found here:
+
+ trunk/NxWidgets/nxwm
+
+ The NxWM unit test can be found at:
+
+ trunk/NxWidgets/UnitTests/nxwm
+
+ Documentation for installing the NxWM unit test can be found here:
+
+ trunk/NxWidgets/UnitTests/READEM.txt
+
+ NOTE: There is an issue with running this example under the
+ simulation. In the default configuration, this example will
+ run the NxConsole example which waits on readline() for console
+ intput. When it calls readline(), the whole system blocks
+ waiting from input from the host OS. So, in order to get
+ this example to run, you must comment out the readline call in
+ apps/nshlib/nsh_consolemain.c like:
+
+ Index: nsh_consolemain.c
+ ===================================================================
+ --- nsh_consolemain.c (revision 4681)
+ +++ nsh_consolemain.c (working copy)
+ @@ -117,7 +117,8 @@
+ /* Execute the startup script */
+
+ #ifdef CONFIG_NSH_ROMFSETC
+ - (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
+ +// REMOVE ME
+ +// (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
+ #endif
+
+ /* Then enter the command line parsing loop */
+ @@ -130,7 +131,8 @@
+ fflush(pstate->cn_outstream);
+
+ /* Get the next line of input */
+ -
+ +sleep(2); // REMOVE ME
+ +#if 0 // REMOVE ME
+ ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN,
+ INSTREAM(pstate), OUTSTREAM(pstate));
+ if (ret > 0)
+ @@ -153,6 +155,7 @@
+ "readline", NSH_ERRNO_OF(-ret));
+ nsh_exit(&pstate->cn_vtbl, 1);
+ }
+ +#endif // REMOVE ME
+ }
+
+ /* Clean up */
+
+ostest
+
+ Description
+ -----------
+ The "standard" NuttX examples/ostest configuration. This
+ configuration may be selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/ostest
+
+pashello
+
+ Description
+ -----------
+ Configures to use examples/pashello. This configuration may
+ by selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/pashello
+
+touchscreen
+
+ Description
+ -----------
+ This configuration uses the simple touchscreen test at
+ apps/examples/touchscreen. This test will create an empty X11 window
+ and will print the touchscreen output as it is received from the
+ simulated touchscreen driver. This configuration may
+ by selected as follows:
+
+ cd <nuttx-directory>/tools
+ ./configure.sh sim/touchscreen
+
+ Since this example uses the simulated frame buffer driver, the
+ most of the configuration settings discussed for the "nx11"
+ configuration also apply here. See that discussion above.
+
+ See apps/examples/README.txt for further information about build
+ requirements and configuration settings.
diff --git a/nuttx/configs/sim/doc/test-results.txt b/nuttx/configs/sim/doc/test-results.txt
new file mode 100644
index 000000000..ebde2fa60
--- /dev/null
+++ b/nuttx/configs/sim/doc/test-results.txt
@@ -0,0 +1,2914 @@
+This is the output from the sim target from April 28, 2007
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+os_start: Entry
+mm_addregion: Region 1: base=805d240 size=4194304
+malloc: Allocated 805e560
+malloc: Allocated 805e7f0
+malloc: Allocated 805ec00
+malloc: Allocated 805f010
+os_start: Starting init thread
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f6a0
+malloc: Allocated 805f930
+malloc: Allocated 805fd40
+malloc: Allocated 8060150
+malloc: Allocated 8060560
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+stdio_test: write fd=1
+stdio_test: write fd=2
+malloc: Allocated 8061570
+malloc: Allocated 8061660
+malloc: Allocated 80617f0
+malloc: Allocated 8061a80
+malloc: Allocated 8061e90
+malloc: Allocated 80622a0
+malloc: Allocated 80626b0
+malloc: Allocated 80646c0
+malloc: Allocated 80646d0
+malloc: Allocated 80646e0
+malloc: Allocated 80646f0
+up_unblock_task: Unblocking TCB=8061570
+stdio_test: Standard I/O Check: printf
+user_start: Started user_main at PID=2
+stdio_test: Standard I/O Check: fprintf to stderr
+_exit: TCB=805f420 exitting
+free: Freeing 8060560
+free: Freeing 805f510
+free: Freeing 805f930
+free: Freeing 805fd40
+free: Freeing 8060150
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 805f6a0
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+os_start: Beginning Idle Loop
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_mutex_init: mutex=0x845d6f0 attr=0x0
+pthread_mutex_init: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f530
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d6f0
+pthread_mutex_lock: Returning 0
+up_reprioritize_rtr: TCB=805f420 PRI=100
+up_reprioritize_rtr: New Active Task TCB=8061570
+malloc: Allocated 8064700
+malloc: Allocated 8061540
+malloc: Allocated 80647f0
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_reprioritize_rtr: TCB=805f420 PRI=100
+up_reprioritize_rtr: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+up_reprioritize_rtr: TCB=805f420 PRI=100
+up_reprioritize_rtr: New Active Task TCB=8061570
+pthread_join: thread=3
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=805f420
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6f0
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805f420
+pthread_mutex_lock: Returning 0
+pthread_mutex_unlock: mutex=0x845d6f0
+up_unblock_task: Unblocking TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=3 exit_value=0
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: Returning 0
+up_reprioritize_rtr: TCB=8064700 PRI=100
+up_reprioritize_rtr: New Active Task TCB=8061570
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_reprioritize_rtr: TCB=8064700 PRI=100
+up_reprioritize_rtr: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 805f530
+free: Freeing 805f420
+_exit: New Active Task TCB=8064700
+up_reprioritize_rtr: TCB=8064700 PRI=100
+up_reprioritize_rtr: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+pthread_join: thread=4
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: mutex=0x845d6f0
+pthread_mutex_unlock: Returning 0
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=4 exit_value=0
+pthread_notifywaiters: pjoin=0x8061540
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=8061570
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=8064700 exitting
+free: Freeing 80647f0
+free: Freeing 8064700
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x8061540
+free: Freeing 8061540
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="ostest"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 53pthread_mutex_init: mutex=0x845d6a0 attr=0x0
+pthread_mutex_init: Returning 0
+pthread_cond_init: cond=0x845d6a8 attr=0x0
+pthread_cond_init: Returning 0
+pthread_attr_init: attr=0x80645ec
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x80645ec stacksize=16384
+pthread_attr_setstacksize: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d6a0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6a8 mutex=0x845d6a0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_completejoin: process_id=5 exit_value=ffffffff
+pthread_notifywaiters: pjoin=0x805f510
+free: Freeing 8064700
+free: Freeing 805f420
+pthread_join: thread=5
+pthread_join: Thread has terminated
+pthread_join: exit_value=0xffffffff
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+pthread_cond_destroy: cond=0x845d6a8
+pthread_cond_destroy: Returning 0
+pthread_cond_destroy: cond=0x845d6a8
+pthread_cond_destroy: Returning 0
+pthread_mutex_init: mutex=0x845d6a0 attr=0x0
+pthread_mutex_init: Returning 0
+pthread_cond_init: cond=0x845d6a8 attr=0x0
+pthread_cond_init: Returning 0
+pthread_attr_init: attr=0x80645cc
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x80645cc stacksize=16384
+pthread_attr_setstacksize: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d6a0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6a8 mutex=0x845d6a0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_detach: Thread=6
+pthread_detach: Returning 0
+pthread_completejoin: process_id=6 exit_value=ffffffff
+pthread_notifywaiters: pjoin=0x805f510
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+free: Freeing 8064700
+free: Freeing 805f420
+pthread_join: thread=6
+pthread_join: Could not find thread data
+pthread_join: Returning 3
+70 5370
+fordblks 3fac90 3fac90
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-startipthread_cond_destroy: cond=0x845d6a8
+pthread_cond_destroy: Returning 0
+pthread_cond_destroy: cond=0x845d6a8
+pthread_cond_destroy: Returning 0
+pthread_mutex_init: mutex=0x845d6a0 attr=0x0
+pthread_mutex_init: Returning 0
+pthread_cond_init: cond=0x845d6a8 attr=0x0
+pthread_cond_init: Returning 0
+pthread_attr_init: attr=0x80645cc
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x80645cc stacksize=16384
+pthread_attr_setstacksize: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d6a0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6a8 mutex=0x845d6a0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_mutex_lock: mutex=0x845d6a0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6a8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6a0
+pthread_mutex_unlock: Returning 0
+pthread_join: thread=7
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6a0
+pthread_mutex_unlock: Returning 0
+pthread_exit: exit_value=ffffffff
+pthread_completejoin: process_id=7 exit_value=ffffffff
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0xffffffff
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 8064700
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645f0
+pthread_attr_init: Returning 0
+pthread_attr_setschedparam: attr=0x80645f0 param=0x80645f8
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f530
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+ng thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thup_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645f0
+pthread_attr_init: Returning 0
+pthread_attr_setschedparam: attr=0x80645f0 param=0x80645f8
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 8064700
+malloc: Allocated 8061540
+malloc: Allocated 80647f0
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645f0
+pthread_attr_init: Returning 0
+pthread_attr_setschedparam: attr=0x80645f0 param=0x80645f8
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 8066800
+malloc: Allocated 80668f0
+malloc: Allocated 8066910
+up_unblock_task: Unblocking TCB=8066800
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_join: thread=8
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=8 exit_value=0
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 805f530
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+pthread_join: thread=9
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+up_unblock_task: Unblocking TCB=8064700
+up_unblock_task: New Active Task TCB=8064700
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=9 exit_value=0
+pthread_notifywaiters: pjoin=0x8061540
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=8061570
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=8064700 exitting
+free: Freeing 80647f0
+free: Freeing 8064700
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x8061540
+free: Freeing 8061540
+pthread_join: Returning 0
+pthread_join: thread=10
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=10 exit_value=0
+pthread_notifywaiters: pjoin=0x80668f0
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x80668f0
+free: Freeing 80668f0
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+_exit: TCB=8066800 exitting
+free: Freeing 8066910
+free: Freeing 8066800
+_exit: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+read 1 aiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 aiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3facpthread_mutex_init: mutex=0x845d6d0 attr=0x0
+pthread_mutex_init: Returning 0
+pthread_cond_init: cond=0x845d6d8 attr=0x0
+pthread_cond_init: Returning 0
+pthread_attr_init: attr=0x80645f8
+pthread_attr_init: Returning 0
+pthread_attr_setschedparam: attr=0x80645f8 param=0x80645f4
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f530
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645f8
+pthread_attr_init: Returning 0
+pthread_attr_setschedparam: attr=0x80645f8 param=0x80645f4
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 8064700
+malloc: Allocated 8061540
+malloc: Allocated 80647f0
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_join: thread=12
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_signal: cond=0x845d6d8
+pthread_cond_signal: sval=-1
+pthread_cond_signal: Signalling...
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_cond_wait: Reacquire mutex...
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_cond_signal: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8064700
+up_release_pending: New Active Task TCB=805f420
+pthread_cond_wait: Returning 0
+pthread_mutex_unlock: mutex=0x845d6d0
+pthread_mutex_unlock: Returning 0
+pthread_mutex_lock: mutex=0x845d6d0
+pthread_mutex_lock: Returning 0
+pthread_cond_wait: cond=0x845d6d8 mutex=0x845d6d0
+pthread_cond_wait: Give up mutex / take cond
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+pthread_mutex_unlock: Returning 0
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=12 exit_value=0
+pthread_notifywaiters: pjoin=0x8061540
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x8061540
+free: Freeing 8061540
+pthread_join: Returning 0
+pthread_detach: Thread=11
+pthread_detach: Returning 0
+pthread_completejoin: process_id=11 exit_value=ffffffff
+pthread_notifywaiters: pjoin=0x805f510
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+free: Freeing 805f530
+free: Freeing 805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+_exit: TCB=8064700 exitting
+free: Freeing 80647f0
+free: Freeing 8064700
+_exit: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_mutex_init: mutex=0x845d708 attr=0x0
+pthread_mutex_init: Returning 0
+pthread_cond_init: cond=0x845d710 attr=0x0
+pthread_cond_init: Returning 0
+pthread_attr_init: attr=0x8064604
+pthread_attr_init: Returning 0
+pthread_attr_setschedparam: attr=0x8064604 param=0x8064600
+pthread_attr_setschedparam: Returning 0
+90 3fac90
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f530
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+pthread_mutex_lock: mutex=0x845d708
+pthread_mutex_lock: Returning 0
+clock_gettime: clock_id=0
+clock_gettime: msecs = 70 g_tickbias=0
+clock_gettime: secs = 70 + 1172534400 nsecs = 70000000 + 0
+clock_gettime: Returning tp=(1172534400,70000000)
+pthread_cond_timedwait: cond=0x845d710 mutex=0x845d708 abstime=0x80614fc
+pthread_cond_timedwait: Give up mutex...
+clock_gettime: clock_id=0
+clock_gettime: msecs = 70 g_tickbias=0
+clock_gettime: secs = 70 + 1172534400 nsecs = 70000000 + 0
+clock_gettime: Returning tp=(1172534400,70000000)
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+pthread_join: thread=13
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+sigqueue: TCB=0x0805f420 signo=3 value=0
+sig_received: sig_received: TCB=0x0805f420 signo=3 code=1 value=0 mask=00000000
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805d140
+up_release_pending: New Active Task TCB=805f420
+up_release_pending: Delivering signals TCB=805f420
+pthread_cond_timedwait: Timedout!
+pthread_cond_timedwait: Re-locking...
+pthread_cond_timedwait: Returning 110
+pthread_mutex_unlock: mutex=0x845d708
+pthread_mutex_unlock: Returning 0
+pthread_exit: exit_value=12345678
+pthread_completejoin: process_id=13 exit_value=12345678
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x12345678
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 805f530
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645f4
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x80645f4 stacksize=16384
+pthread_attr_setstacksize: Returning 0
+pthread_attr_setschedparam: attr=0x80645f4 param=0x80645f0
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+malloc: Allocated 805f530
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645f4
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x80645f4 stacksize=16384
+pthread_attr_setstacksize: Returning 0
+pthread_attr_setschedparam: attr=0x80645f4 param=0x80645f0
+pthread_attr_setschedparam: Returning 0
+malloc: Allocated 805f570
+malloc: Allocated 805f660
+malloc: Allocated 8068710
+up_unblock_task: Unblocking TCB=805f570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_join: thread=15
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiverup_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=805f570
+up_release_pending: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805f570
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=15 exit_value=0
+pthread_notifywaiters: pjoin=0x805f660
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f570
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f660
+free: Freeing 805f660
+pthread_join: Returning 0
+kill: TCB=0x0805f420 signo=9
+sig_received: sig_received: TCB=0x0805f420 signo=9 code=0 value=0 mask=00000000
+up_unblock_task: Unblocking TCB=805f420
+up_release_pending: From TCB=8061570
+up_release_pending: New Active Task TCB=805f420
+up_release_pending: Delivering signals TCB=805f420
+free: Freeing 805f530
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=14 exit_value=0
+pthread_notifywaiters: pjoin=0x805f510
+_exit: TCB=805f420 exitting
+free: Freeing 8064700
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f570
+_exit: TCB=805f570 exitting
+free: Freeing 8068710
+free: Freeing 805f570
+_exit: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_join: thread=14
+pthread_join: Thread has terminated
+pthread_join: exit_value=0x0
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning nerrors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: timed message queue test
+timedmqueue_test: Starting pthread_attr_init: attr=0x8064600
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x8064600 stacksize=16384
+pthread_attr_setstacksize: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+malloc: Allocated 805f530
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 5110 g_tickbias=0
+clock_gettime: secs = 5110 + 1172534400 nsecs = 110000000 + 0
+clock_gettime: Returning tp=(1172534405,110000000)
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: thread=16
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=16 exit_value=0
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 8064700
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+pthread_attr_init: attr=0x8064600
+pthread_attr_init: Returning 0
+pthread_attr_setstacksize: attr=0x8064600 stacksize=16384
+pthread_attr_setstacksize: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+clock_gettime: clock_id=0
+clock_gettime: msecs = 10120 g_tickbias=0
+clock_gettime: secs = 10120 + 1172534400 nsecs = 120000000 + 0
+clock_gettime: Returning tp=(1172534410,120000000)
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: thread=17
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+free: Freeing 805f530
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+timedmqueue_test: Waiting for sender to complete
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=17 exit_value=0
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 8064700
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f6a0
+malloc: Allocated 805f930
+malloc: Allocated 805fd40
+malloc: Allocated 8060150
+malloc: Allocated 8064700
+up_unblock_task: Unblocking TCB=805f420
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=18
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+sigqueue: TCB=0x0805f420 signo=17 value=42
+sig_received: sig_received: TCB=0x0805f420 signo=17 code=1 value=42 mask=00000000
+up_unblock_task: Unblocking TCB=805f420
+sighand_test: Signaling pid=18 with signo=17 sigvalue=42
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_block_task: Delivering signals TCB=805f420
+sig_deliver: sig_deliver: Sending signal sigq=0x805d660
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+_exit: TCB=805f420 exitting
+free: Freeing 8064700
+free: Freeing 805f510
+free: Freeing 805f930
+free: Freeing 805fd40
+free: Freeing 8060150
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 805f6a0
+free: Freeing 805f420
+_exit: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+sighand_test: done
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+sig_received: sig_received: TCB=0x08061570 signo=17 code=2 value=42 mask=00000000
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_unblock_task: Delivering signals TCB=8061570
+sig_deliver: sig_deliver: Sending signal sigq=0x805d678
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+sig_received: sig_received: TCB=0x08061570 signo=17 code=2 value=42 mask=00000000
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_unblock_task: Delivering signals TCB=8061570
+sig_deliver: sig_deliver: Sending signal sigq=0x805d690
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+sig_received: sig_received: TCB=0x08061570 signo=17 code=2 value=42 mask=00000000
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_unblock_task: Delivering signals TCB=8061570
+sig_deliver: sig_deliver: Sending signal sigq=0x805d6a8
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+sig_received: sig_received: TCB=0x08061570 signo=17 code=2 value=42 mask=00000000
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_unblock_task: Delivering signals TCB=8061570
+sig_deliver: sig_deliver: Sending signal sigq=0x805d6c0
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+sig_received: sig_received: TCB=0x08061570 signo=17 code=2 value=42 mask=00000000
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_unblock_task: Delivering signals TCB=8061570
+sig_deliver: sig_deliver: Sending signal sigq=0x805d6d8
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+pthread_attr_init: attr=0x80645e4
+pthread_attr_init: Returning 0
+malloc: Allocated 805f420
+malloc: Allocated 805f510
+malloc: Allocated 805f530
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 8064700
+malloc: Allocated 8061540
+malloc: Allocated 80647f0
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 8066800
+malloc: Allocated 80668f0
+malloc: Allocated 8066910
+up_unblock_task: Unblocking TCB=8066800
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8066800
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 8068920
+malloc: Allocated 8068a10
+malloc: Allocated 8068a30
+up_unblock_task: Unblocking TCB=8068920
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8068920
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8068920
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 806aa40
+malloc: Allocated 806ab30
+malloc: Allocated 806ab50
+up_unblock_task: Unblocking TCB=806aa40
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=806aa40
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=806aa40
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 806cb60
+malloc: Allocated 806cc50
+malloc: Allocated 806cc70
+up_unblock_task: Unblocking TCB=806cb60
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=806cb60
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=806cb60
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 806ec80
+malloc: Allocated 806ed70
+malloc: Allocated 806ed90
+up_unblock_task: Unblocking TCB=806ec80
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=806ec80
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=806ec80
+up_block_task: New Active Task TCB=8061570
+malloc: Allocated 8070da0
+malloc: Allocated 8070e90
+malloc: Allocated 8070eb0
+up_unblock_task: Unblocking TCB=8070da0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8070da0
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8070da0
+up_block_task: New Active Task TCB=8061570
+pthread_join: thread=19
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8064700
+up_unblock_task: New Active Task TCB=8064700
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8066800
+up_unblock_task: New Active Task TCB=8066800
+up_block_task: Blocking TCB=8066800
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8068920
+up_unblock_task: New Active Task TCB=8068920
+up_block_task: Blocking TCB=8068920
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=806aa40
+up_unblock_task: New Active Task TCB=806aa40
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 3 started
+barrier_test: Thread 3 created
+barrier_func: Thread 4 started
+barrier_test: Thread 4 created
+barrier_func: Thread 5 started
+barrier_test: Thread 5 created
+barrier_func: Thread 6 started
+barrier_test: Thread 6 created
+barrier_func: Thread 7 started
+barrier_test: Thread 7 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 3 calling pthread_barrier_wait()
+barrier_func: Thread 4 calling pthreadup_block_task: Blocking TCB=806aa40
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=806cb60
+up_unblock_task: New Active Task TCB=806cb60
+up_block_task: Blocking TCB=806cb60
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=806ec80
+up_unblock_task: New Active Task TCB=806ec80
+up_block_task: Blocking TCB=806ec80
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8070da0
+up_unblock_task: New Active Task TCB=8070da0
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: Unblocking TCB=8064700
+up_unblock_task: Unblocking TCB=8066800
+up_unblock_task: Unblocking TCB=8068920
+up_unblock_task: Unblocking TCB=806aa40
+up_unblock_task: Unblocking TCB=806cb60
+up_unblock_task: Unblocking TCB=806ec80
+up_block_task: Blocking TCB=8070da0
+up_block_task: New Active Task TCB=805f420
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8064700
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=8066800
+up_block_task: Blocking TCB=8066800
+up_block_task: New Active Task TCB=8068920
+up_block_task: Blocking TCB=8068920
+up_block_task: New Active Task TCB=806aa40
+up_block_task: Blocking TCB=806aa40
+up_block_task: New Active Task TCB=806cb60
+up_block_task: Blocking TCB=806cb60
+up_block_task: New Active Task TCB=806ec80
+up_block_task: Blocking TCB=806ec80
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8070da0
+up_unblock_task: New Active Task TCB=8070da0
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=26 exit_value=0
+pthread_notifywaiters: pjoin=0x8070e90
+_exit: TCB=8070da0 exitting
+free: Freeing 8070eb0
+free: Freeing 8070da0
+_exit: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=805f420
+up_unblock_task: New Active Task TCB=805f420
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=19 exit_value=0
+pthread_notifywaiters: pjoin=0x805f510
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=805f420
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=805f420
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805f420
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=805f420 exitting
+free: Freeing 805f530
+free: Freeing 805f420
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x805f510
+free: Freeing 805f510
+pthread_join: Returning 0
+pthread_join: thread=20
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8064700
+up_unblock_task: New Active Task TCB=8064700
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=20 exit_value=0
+pthread_notifywaiters: pjoin=0x8061540
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8064700
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=8064700
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8064700
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=8064700 exitting
+free: Freeing 80647f0
+free: Freeing 8064700
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x8061540
+free: Freeing 8061540
+pthread_join: Returning 0
+pthread_join: thread=21
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8066800
+up_unblock_task: New Active Task TCB=8066800
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=21 exit_value=0
+pthread_notifywaiters: pjoin=0x80668f0
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8066800
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=8066800
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8066800
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=8066800 exitting
+free: Freeing 8066910
+free: Freeing 8066800
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x80668f0
+free: Freeing 80668f0
+pthread_join: Returning 0
+pthread_join: thread=22
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8068920
+up_unblock_task: New Active Task TCB=8068920
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=22 exit_value=0
+pthread_notifywaiters: pjoin=0x8068a10
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=8068920
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=8068920
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=8068920
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=8068920 exitting
+free: Freeing 8068a30
+free: Freeing 8068920
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x8068a10
+free: Freeing 8068a10
+pthread_join: Returning 0
+_barrier_wait()
+barrier_func: Thread 5 calling pthread_barrier_wait()
+barrier_func: Thread 6 calling pthread_barrier_wait()
+barrier_func: Thread 7 calling pthread_barrier_wait()
+barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2, back with status=0 (I am not special)
+barrier_func: Thread 3, back with status=0 (I am not special)
+barrier_func: Thread 4, back with status=0 (I am not special)
+barrier_func: Thread 5, back with status=0 (I am not special)
+barrier_func: Thread 6, back with status=0 (I am not special)
+barrier_func: Thread 7 done
+barrier_func: Thread 0 done
+barrier_test: Thread 0 completed with result=0
+barrier_func: Thread 1 done
+barrier_test: Thread 1 completed with result=0
+barrier_func: Thread 2 done
+barrier_test: Thread 2 completed with result=0
+barrier_func: Thread 3 done
+barrier_test: Thread 3 completed with result=pthread_join: thread=23
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=806aa40
+up_unblock_task: New Active Task TCB=806aa40
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=23 exit_value=0
+pthread_notifywaiters: pjoin=0x806ab30
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=806aa40
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=806aa40
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=806aa40
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=806aa40 exitting
+free: Freeing 806ab50
+free: Freeing 806aa40
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x806ab30
+free: Freeing 806ab30
+pthread_join: Returning 0
+pthread_join: thread=24
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=806cb60
+up_unblock_task: New Active Task TCB=806cb60
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=24 exit_value=0
+pthread_notifywaiters: pjoin=0x806cc50
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=806cb60
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=806cb60
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=806cb60
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=806cb60 exitting
+free: Freeing 806cc70
+free: Freeing 806cb60
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x806cc50
+free: Freeing 806cc50
+pthread_join: Returning 0
+pthread_join: thread=25
+pthread_join: Thread is still running
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=806ec80
+up_unblock_task: New Active Task TCB=806ec80
+pthread_exit: exit_value=0
+pthread_completejoin: process_id=25 exit_value=0
+pthread_notifywaiters: pjoin=0x806ed70
+up_unblock_task: Unblocking TCB=8061570
+up_block_task: Blocking TCB=806ec80
+up_block_task: New Active Task TCB=8061570
+pthread_join: exit_value=0x0
+up_unblock_task: Unblocking TCB=806ec80
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=806ec80
+up_unblock_task: Unblocking TCB=8061570
+_exit: TCB=806ec80 exitting
+free: Freeing 806ed90
+free: Freeing 806ec80
+_exit: New Active Task TCB=8061570
+pthread_destroyjoin: pjoin=0x806ed70
+free: Freeing 806ed70
+pthread_join: Returning 0
+pthread_join: thread=26
+pthread_join: Thread has terminated
+pthread_join: exit_value=0x0
+pthread_destroyjoin: pjoin=0x8070e90
+free: Freeing 8070e90
+pthread_join: Returning 0
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+up_block_task: Blocking TCB=8061570
+up_block_task: New Active Task TCB=805d140
+up_unblock_task: Unblocking TCB=8061570
+up_unblock_task: New Active Task TCB=8061570
+0
+barrier_func: Thread 4 done
+barrier_test: Thread 4 completed with result=0
+barrier_func: Thread 5 done
+barrier_test: Thread 5 completed with result=0
+barrier_func: Thread 6 done
+barrier_test: Thread 6 completed with result=0
+barrier_test: Thread 7 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 400000 400000
+ordblks 2 2
+mxordblk 3f8b40 3f8b40
+uordblks 5370 5370
+fordblks 3fac90 3fac90
+user_main: Exitting
+_exit: TCB=8061570 exitting
+free: Freeing 80626b0
+free: Freeing 80646c0
+free: Freeing 80646d0
+free: Freeing 80646e0
+free: Freeing 80646f0
+free: Freeing 8061660
+free: Freeing 8061a80
+free: Freeing 8061e90
+free: Freeing 80622a0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 0
+free: Freeing 80617f0
+free: Freeing 8061570
+_exit: New Active Task TCB=805d140
diff --git a/nuttx/configs/sim/include/README.txt b/nuttx/configs/sim/include/README.txt
new file mode 100644
index 000000000..f80744904
--- /dev/null
+++ b/nuttx/configs/sim/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the Linux user-mode platform.
diff --git a/nuttx/configs/sim/mount/Make.defs b/nuttx/configs/sim/mount/Make.defs
new file mode 100644
index 000000000..4c1af7fb1
--- /dev/null
+++ b/nuttx/configs/sim/mount/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/mount/Make.defs
+#
+# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/mount/appconfig b/nuttx/configs/sim/mount/appconfig
new file mode 100644
index 000000000..ca9cf3df4
--- /dev/null
+++ b/nuttx/configs/sim/mount/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sim/mount/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/mount
+
diff --git a/nuttx/configs/sim/mount/defconfig b/nuttx/configs/sim/mount/defconfig
new file mode 100644
index 000000000..f5d28054f
--- /dev/null
+++ b/nuttx/configs/sim/mount/defconfig
@@ -0,0 +1,226 @@
+############################################################################
+# sim/mount/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="mount_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/mount/setenv.sh b/nuttx/configs/sim/mount/setenv.sh
new file mode 100755
index 000000000..318e1628e
--- /dev/null
+++ b/nuttx/configs/sim/mount/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nettest/Make.defs b/nuttx/configs/sim/nettest/Make.defs
new file mode 100644
index 000000000..285a5d139
--- /dev/null
+++ b/nuttx/configs/sim/nettest/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/Make.defs
+#
+# Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nettest/appconfig b/nuttx/configs/sim/nettest/appconfig
new file mode 100644
index 000000000..ce5961c14
--- /dev/null
+++ b/nuttx/configs/sim/nettest/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/sim/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/sim/nettest/defconfig b/nuttx/configs/sim/nettest/defconfig
new file mode 100644
index 000000000..83de44c36
--- /dev/null
+++ b/nuttx/configs/sim/nettest/defconfig
@@ -0,0 +1,225 @@
+############################################################################
+# configs/sim/nettest/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=16
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nettest/setenv.sh b/nuttx/configs/sim/nettest/setenv.sh
new file mode 100755
index 000000000..273e418ee
--- /dev/null
+++ b/nuttx/configs/sim/nettest/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nsh/Make.defs b/nuttx/configs/sim/nsh/Make.defs
new file mode 100644
index 000000000..cd3d31813
--- /dev/null
+++ b/nuttx/configs/sim/nsh/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/nsh/Make.defs
+#
+# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nsh/appconfig b/nuttx/configs/sim/nsh/appconfig
new file mode 100644
index 000000000..264588e51
--- /dev/null
+++ b/nuttx/configs/sim/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/sim/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig
new file mode 100644
index 000000000..3f0ceab26
--- /dev/null
+++ b/nuttx/configs/sim/nsh/defconfig
@@ -0,0 +1,270 @@
+############################################################################
+# sim/nsh/defconfig
+#
+# Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+CONFIG_SCHED_ONEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_SYSLOG_DEVPATH="/dev/syslog"
+CONFIG_SYSLOG_CHAR=n
+
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=y
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=2
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nsh/setenv.sh b/nuttx/configs/sim/nsh/setenv.sh
new file mode 100755
index 000000000..c629c5a1e
--- /dev/null
+++ b/nuttx/configs/sim/nsh/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/nsh/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nsh2/Make.defs b/nuttx/configs/sim/nsh2/Make.defs
new file mode 100644
index 000000000..ad166f93c
--- /dev/null
+++ b/nuttx/configs/sim/nsh2/Make.defs
@@ -0,0 +1,140 @@
+############################################################################
+# configs/sim/nsh2/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHDEFINESXX = -DCONFIG_WCHAR_BUILTIN
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINESXX) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nsh2/appconfig b/nuttx/configs/sim/nsh2/appconfig
new file mode 100644
index 000000000..e74014a50
--- /dev/null
+++ b/nuttx/configs/sim/nsh2/appconfig
@@ -0,0 +1,51 @@
+############################################################################
+# configs/sim/nsh2/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# NSH Built-In Functions
+
+CONFIGURED_APPS += examples/nx
+CONFIGURED_APPS += examples/nxhello
+CONFIGURED_APPS += examples/nxlines
+CONFIGURED_APPS += examples/touchscreen
+
diff --git a/nuttx/configs/sim/nsh2/defconfig b/nuttx/configs/sim/nsh2/defconfig
new file mode 100644
index 000000000..f6f36bf51
--- /dev/null
+++ b/nuttx/configs/sim/nsh2/defconfig
@@ -0,0 +1,373 @@
+############################################################################
+# sim/nsh2/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Simulated framebuffer configuration
+#
+CONFIG_SIM_X11FB=y
+CONFIG_SIM_FBWIDTH=480
+CONFIG_SIM_FBHEIGHT=240
+CONFIG_SIM_FBBPP=32
+
+#
+# Simulated touchscreen configuration
+# (Set both of the following to 'y' to enable)
+#
+CONFIG_INPUT=y
+CONFIG_SIM_TOUCHSCREEN=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_INPUT=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=6
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_SIG_SIGWORK=4
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=n
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=y
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=2
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+#CONFIG_EXAMPLES_NXHELLO_BGCOLOR
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+#CONFIG_EXAMPLES_NXHELLO_FONTCOLOR
+CONFIG_EXAMPLES_NXHELLO_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+#CONFIG_EXAMPLES_NXLINES_BGCOLOR
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+#CONFIG_EXAMPLES_NXLINES_LINECOLOR
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+#CONFIG_EXAMPLES_NXLINES_BORDERCOLOR
+#CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR
+CONFIG_EXAMPLES_NXLINES_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/mount
+#
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nsh2/setenv.sh b/nuttx/configs/sim/nsh2/setenv.sh
new file mode 100755
index 000000000..78204f6eb
--- /dev/null
+++ b/nuttx/configs/sim/nsh2/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/nsh2/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nx/Make.defs b/nuttx/configs/sim/nx/Make.defs
new file mode 100644
index 000000000..8d541214f
--- /dev/null
+++ b/nuttx/configs/sim/nx/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/nx/Make.defs
+#
+# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nx/appconfig b/nuttx/configs/sim/nx/appconfig
new file mode 100644
index 000000000..de984c1f6
--- /dev/null
+++ b/nuttx/configs/sim/nx/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/sim/nx/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+# Various NX tests can be supported, simply comment-out examples/nx and
+# uncomment the test you wish to perform
+
+CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxconsole
+
diff --git a/nuttx/configs/sim/nx/defconfig b/nuttx/configs/sim/nx/defconfig
new file mode 100644
index 000000000..34d86f384
--- /dev/null
+++ b/nuttx/configs/sim/nx/defconfig
@@ -0,0 +1,327 @@
+############################################################################
+# sim/nx/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# Simulated framebuffer configuration
+#
+CONFIG_SIM_X11FB=n
+CONFIG_SIM_FBWIDTH=480
+CONFIG_SIM_FBHEIGHT=240
+CONFIG_SIM_FBBPP=8
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=y
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=28
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=16
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=n
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=8
+CONFIG_NXCONSOLE_MXCHARS=256
+#
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=2
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+#CONFIG_EXAMPLES_NXLINES_BGCOLOR=
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+#CONFIG_EXAMPLES_NXLINES_LINECOLOR=
+CONFIG_EXAMPLES_NXLINES_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/mount
+#
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nx/setenv.sh b/nuttx/configs/sim/nx/setenv.sh
new file mode 100755
index 000000000..764d2a8be
--- /dev/null
+++ b/nuttx/configs/sim/nx/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/nx/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nx11/Make.defs b/nuttx/configs/sim/nx11/Make.defs
new file mode 100644
index 000000000..1386f4b36
--- /dev/null
+++ b/nuttx/configs/sim/nx11/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/nx11/Make.defs
+#
+# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nx11/appconfig b/nuttx/configs/sim/nx11/appconfig
new file mode 100644
index 000000000..ce54b34e4
--- /dev/null
+++ b/nuttx/configs/sim/nx11/appconfig
@@ -0,0 +1,41 @@
+############################################################################
+# configs/sim/nx11/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+# Various NX tests can be supported, simply comment-out examples/nx and
+# uncomment the test you wish to perform
+
+CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxconsole
diff --git a/nuttx/configs/sim/nx11/defconfig b/nuttx/configs/sim/nx11/defconfig
new file mode 100644
index 000000000..8734ebc69
--- /dev/null
+++ b/nuttx/configs/sim/nx11/defconfig
@@ -0,0 +1,322 @@
+############################################################################
+# sim/nx11/defconfig
+#
+# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# Simulated framebuffer configuration
+#
+CONFIG_SIM_X11FB=y
+CONFIG_SIM_FBWIDTH=480
+CONFIG_SIM_FBHEIGHT=240
+CONFIG_SIM_FBBPP=32
+
+#
+# Simulated touchscreen configuration
+# (Set both of the following to 'y' to enable)
+#
+CONFIG_INPUT=n
+CONFIG_SIM_TOUCHSCREEN=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_GRAPHICS=y
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=28
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=16
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=y
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=n
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=32
+CONFIG_NXCONSOLE_MXCHARS=256
+#
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=2
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+#
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=16384
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nx11/setenv.sh b/nuttx/configs/sim/nx11/setenv.sh
new file mode 100755
index 000000000..a9371a9d2
--- /dev/null
+++ b/nuttx/configs/sim/nx11/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/nx11/setenv.sh
+#
+# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nxffs/Make.defs b/nuttx/configs/sim/nxffs/Make.defs
new file mode 100644
index 000000000..f664ff777
--- /dev/null
+++ b/nuttx/configs/sim/nxffs/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/nxffs/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nxffs/appconfig b/nuttx/configs/sim/nxffs/appconfig
new file mode 100644
index 000000000..6eb93ac77
--- /dev/null
+++ b/nuttx/configs/sim/nxffs/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sim/nxffs/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxffs
+
diff --git a/nuttx/configs/sim/nxffs/defconfig b/nuttx/configs/sim/nxffs/defconfig
new file mode 100644
index 000000000..22746a2f6
--- /dev/null
+++ b/nuttx/configs/sim/nxffs/defconfig
@@ -0,0 +1,235 @@
+############################################################################
+# configs/sim/nxffs/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxffs_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEBUG_FS=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=29
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=y
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+##
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Various FS, NXFFS, RAMMTD and other settings needed for
+# apps/examples/nxffs
+#
+CONFIG_LIB_RAND_ORDER=3
+CONFIG_FS_NXFFS=y
+CONFIG_NXFFS_ERASEDSTATE=0xff
+CONFIG_NXFSS_PREALLOCATED=y
+CONFIG_RAMMTD_BLOCKSIZE=512
+CONFIG_RAMMTD_ERASESIZE=4096
+CONFIG_RAMMTD_ERASESTATE=0xff
+CONFIG_RAMMTD_FLASHSIM=y
+CONFIG_EXAMPLES_NXFFS_NEBLOCKS=32
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nxffs/setenv.sh b/nuttx/configs/sim/nxffs/setenv.sh
new file mode 100755
index 000000000..3aa03bc98
--- /dev/null
+++ b/nuttx/configs/sim/nxffs/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# confisgs/sim/nxffs/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/nxwm/Make.defs b/nuttx/configs/sim/nxwm/Make.defs
new file mode 100644
index 000000000..1f4dd9796
--- /dev/null
+++ b/nuttx/configs/sim/nxwm/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/nxwm/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/nxwm/appconfig b/nuttx/configs/sim/nxwm/appconfig
new file mode 100644
index 000000000..47c290dfe
--- /dev/null
+++ b/nuttx/configs/sim/nxwm/appconfig
@@ -0,0 +1,40 @@
+############################################################################
+# configs/sim/nxwm/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig
new file mode 100644
index 000000000..812233cbf
--- /dev/null
+++ b/nuttx/configs/sim/nxwm/defconfig
@@ -0,0 +1,405 @@
+############################################################################
+# sim/nxwm/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Simulated framebuffer configuration
+#
+CONFIG_SIM_X11FB=y
+CONFIG_SIM_FBWIDTH=480
+CONFIG_SIM_FBHEIGHT=240
+CONFIG_SIM_FBBPP=32
+
+#
+# Simulated touchscreen configuration
+# (Set both of the following to 'y' to enable)
+#
+CONFIG_INPUT=n
+CONFIG_SIM_TOUCHSCREEN=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxwm_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=1
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=8192
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+CONFIG_SCHED_ONEXIT=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=16
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=48
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=y
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=y
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=n
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0x005a96bd
+CONFIG_NXTK_BORDERCOLOR2=0x00233a49
+CONFIG_NXTK_BORDERCOLOR3=0x00f8f8f8
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=y
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxWidgets / NxWM
+#
+# Use all defaults except
+# 1. 32 bits-per-pixel
+# 2. Need an especially big server stack size to work with X
+# 3. Make the NxWidgets background color match the NxWM back color
+# 4. Taskbar on the left
+# 5. Bigger stack for NxConsole
+# 6. No touchscreen
+#
+CONFIG_NXWIDGETS_BPP=32
+CONFIG_NXWIDGETS_SERVERSTACK=16384
+CONFIG_NXWIDGETS_LISTENERSTACK=8192
+CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215)
+CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241)
+CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73)
+
+CONFIG_NXWM_TASKBAR_LEFT=y
+CONFIG_NXWM_NXCONSOLE_STACKSIZE=8192
+CONFIG_NXWM_UNITTEST=y
+CONFIG_NXWM_TOUCHSCREEN=n
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=y
+CONFIG_NXCONSOLE_BPP=32
+CONFIG_NXCONSOLE_MXCHARS=256
+#
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=2
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+#CONFIG_EXAMPLES_NXHELLO_BGCOLOR
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+#CONFIG_EXAMPLES_NXHELLO_FONTCOLOR
+CONFIG_EXAMPLES_NXHELLO_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+#CONFIG_EXAMPLES_NXLINES_BGCOLOR
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+#CONFIG_EXAMPLES_NXLINES_LINECOLOR
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+#CONFIG_EXAMPLES_NXLINES_BORDERCOLOR
+#CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR
+CONFIG_EXAMPLES_NXLINES_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/mount
+#
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=8192
+CONFIG_USERMAIN_STACKSIZE=8192
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/nxwm/setenv.sh b/nuttx/configs/sim/nxwm/setenv.sh
new file mode 100755
index 000000000..a3e949cda
--- /dev/null
+++ b/nuttx/configs/sim/nxwm/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/nxwm/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/ostest/Make.defs b/nuttx/configs/sim/ostest/Make.defs
new file mode 100644
index 000000000..285a5d139
--- /dev/null
+++ b/nuttx/configs/sim/ostest/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/Make.defs
+#
+# Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/ostest/appconfig b/nuttx/configs/sim/ostest/appconfig
new file mode 100644
index 000000000..082743504
--- /dev/null
+++ b/nuttx/configs/sim/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sim/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig
new file mode 100644
index 000000000..92c696dc6
--- /dev/null
+++ b/nuttx/configs/sim/ostest/defconfig
@@ -0,0 +1,219 @@
+############################################################################
+# configs/sim/ostest/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=27
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=y
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+##
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/ostest/setenv.sh b/nuttx/configs/sim/ostest/setenv.sh
new file mode 100755
index 000000000..273e418ee
--- /dev/null
+++ b/nuttx/configs/sim/ostest/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/pashello/Make.defs b/nuttx/configs/sim/pashello/Make.defs
new file mode 100644
index 000000000..2a19ff38a
--- /dev/null
+++ b/nuttx/configs/sim/pashello/Make.defs
@@ -0,0 +1,141 @@
+############################################################################
+# configs/sim/pashello/Make.defs
+#
+# Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+EXTRA_LIBS = -lm
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/pashello/appconfig b/nuttx/configs/sim/pashello/appconfig
new file mode 100644
index 000000000..85af74b20
--- /dev/null
+++ b/nuttx/configs/sim/pashello/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/sim/pashello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/pashello
+
+# Path to the Pascal p-code runtime interpreter module
+
+CONFIGURED_APPS += interpreters/pcode
diff --git a/nuttx/configs/sim/pashello/defconfig b/nuttx/configs/sim/pashello/defconfig
new file mode 100644
index 000000000..57530d3bb
--- /dev/null
+++ b/nuttx/configs/sim/pashello/defconfig
@@ -0,0 +1,214 @@
+############################################################################
+# configs/sim/pashello/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="pashello_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=27
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/pashello/setenv.sh b/nuttx/configs/sim/pashello/setenv.sh
new file mode 100755
index 000000000..273e418ee
--- /dev/null
+++ b/nuttx/configs/sim/pashello/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sim/src/Makefile b/nuttx/configs/sim/src/Makefile
new file mode 100644
index 000000000..69e2ca9e7
--- /dev/null
+++ b/nuttx/configs/sim/src/Makefile
@@ -0,0 +1,83 @@
+############################################################################
+# configs/sim/src/Makefile
+#
+# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS =
+ifeq ($(CONFIG_SIM_X11FB),y)
+ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
+ CSRCS += up_touchscreen.c
+endif
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @$(AR) $@ # Create an empty archive
+ifneq ($(OBJS),)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+endif
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/sim/src/README.txt b/nuttx/configs/sim/src/README.txt
new file mode 100644
index 000000000..28315582a
--- /dev/null
+++ b/nuttx/configs/sim/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the Linux user-mode platform.
diff --git a/nuttx/configs/sim/src/up_touchscreen.c b/nuttx/configs/sim/src/up_touchscreen.c
new file mode 100644
index 000000000..c951c5c69
--- /dev/null
+++ b/nuttx/configs/sim/src/up_touchscreen.c
@@ -0,0 +1,182 @@
+/****************************************************************************
+ * config/sim/src/up_touchscreen.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/fb.h>
+#include <nuttx/input/touchscreen.h>
+#include <nuttx/nx/nx.h>
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Pick a background color */
+
+#ifndef CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR
+# define CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR 0x007b68ee
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct sim_touchscreen_s
+{
+ NXHANDLE hnx;
+};
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct sim_touchscreen_s g_simtc;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: arch_tcinitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the touchscreen
+ * hardware. This interface must be provided by all configurations
+ * using apps/examples/touchscreen
+ *
+ ****************************************************************************/
+
+int arch_tcinitialize(int minor)
+{
+ FAR NX_DRIVERTYPE *dev;
+ nxgl_mxpixel_t color;
+ int ret;
+
+ /* Initialize the simulated frame buffer device. We need to create an
+ * X11 window to support the mouse-driven touchscreen simulation.
+ */
+
+ ivdbg("Initializing framebuffer\n");
+ ret = up_fbinitialize();
+ if (ret < 0)
+ {
+ idbg("up_fbinitialize failed: %d\n", -ret);
+ goto errout;
+ }
+
+ dev = up_fbgetvplane(0);
+ if (!dev)
+ {
+ idbg("up_fbgetvplane 0 failed\n");
+ ret = -ENODEV;
+ goto errout_with_fb;
+ }
+
+ /* Then open NX */
+
+ ivdbg("Open NX\n");
+ g_simtc.hnx = nx_open(dev);
+ if (!g_simtc.hnx)
+ {
+ ret = -errno;
+ idbg("nx_open failed: %d\n", ret);
+ goto errout_with_fb;
+ }
+
+ /* Set the background to the configured background color */
+
+ ivdbg("Set background color=%d\n", CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR);
+
+ color = CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR;
+ ret = nx_setbgcolor(g_simtc.hnx, &color);
+ if (ret < 0)
+ {
+ idbg("nx_setbgcolor failed: %d\n", ret);
+ goto errout_with_nx;
+ }
+
+ /* Finally, initialize the touchscreen simulation on the X window */
+
+ ret = arch_tcinitialize(minor);
+ if (ret < 0)
+ {
+ idbg("arch_tcinitialize failed: %d\n", ret);
+ goto errout_with_nx;
+ }
+ return OK;
+
+errout_with_nx:
+ nx_close(g_simtc.hnx);
+ goto errout;
+errout_with_fb:
+ fb_uninitialize();
+errout:
+ return ret;
+}
+
+/****************************************************************************
+ * Name: arch_tcuninitialize()
+ *
+ * Description:
+ * Perform architecuture-specific un-initialization of the touchscreen
+ * hardware. This interface must be provided by all configurations
+ * using apps/examples/touchscreen
+ *
+ ****************************************************************************/
+
+void arch_tcuninitialize(void)
+{
+ /* Shut down the touchscreen driver */
+
+ sim_tcuninitialize();
+
+ /* Close NX */
+
+ nx_close(g_simtc.hnx);
+}
diff --git a/nuttx/configs/sim/touchscreen/Make.defs b/nuttx/configs/sim/touchscreen/Make.defs
new file mode 100644
index 000000000..112f6def7
--- /dev/null
+++ b/nuttx/configs/sim/touchscreen/Make.defs
@@ -0,0 +1,139 @@
+############################################################################
+# configs/sim/touchscreen/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -O2
+endif
+
+ARCHCPUFLAGS = -fno-builtin
+ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ARCHSCRIPT =
+
+ifeq ($(CONFIG_SIM_M32),y)
+ ARCHCPUFLAGS += -m32
+ ARCHCPUFLAGSXX += -m32
+endif
+
+CROSSDEV =
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+
+ifeq ($(HOSTOS),Cygwin)
+ EXEEXT = .exe
+else
+ EXEEXT =
+endif
+
+LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
+CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
+LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDLINKFLAGS += -g
+ CCLINKFLAGS += -g
+ LDFLAGS += -g
+endif
+
+ifeq ($(CONFIG_SIM_M32),y)
+ LDLINKFLAGS += -melf_i386
+ CCLINKFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/sim/touchscreen/appconfig b/nuttx/configs/sim/touchscreen/appconfig
new file mode 100644
index 000000000..4bcbabeb4
--- /dev/null
+++ b/nuttx/configs/sim/touchscreen/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sim/touchscreen/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/touchscreen
+
diff --git a/nuttx/configs/sim/touchscreen/defconfig b/nuttx/configs/sim/touchscreen/defconfig
new file mode 100644
index 000000000..b9630c8e2
--- /dev/null
+++ b/nuttx/configs/sim/touchscreen/defconfig
@@ -0,0 +1,321 @@
+############################################################################
+# sim/touchscreen/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+
+#
+# Simulated framebuffer configuration
+#
+CONFIG_SIM_X11FB=y
+CONFIG_SIM_FBWIDTH=240
+CONFIG_SIM_FBHEIGHT=320
+CONFIG_SIM_FBBPP=32
+
+#
+# Simulated touchscreen configuration
+# (Set both of the following to 'y' to enable)
+#
+CONFIG_INPUT=y
+CONFIG_SIM_TOUCHSCREEN=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="tc_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_INPUT=y
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=32
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=28
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=16
+CONFIG_NFILE_STREAMS=16
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=1024
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=32
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+CONFIG_FB_CMAP=y
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# FAT filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=n
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+#CONFIG_NXTK_BORDERCOLOR1
+#CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=100
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=80
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=2
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_VPLANE=0
+#CONFIG_EXAMPLES_NX_BGCOLOR
+#CONFIG_EXAMPLES_NX_COLOR1
+#CONFIG_EXAMPLES_NX_COLOR2
+#CONFIG_EXAMPLES_NX_TBCOLOR
+#CONFIG_EXAMPLES_NX_FONTCOLOR
+CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=8192
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+
+#
+# Settings for examples/mount
+CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
+#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
+#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
+#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=n
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Additional examples/touchscreen needed only for the simulated target
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR=0x007b68ee
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=8192
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sim/touchscreen/setenv.sh b/nuttx/configs/sim/touchscreen/setenv.sh
new file mode 100755
index 000000000..4cc3bba57
--- /dev/null
+++ b/nuttx/configs/sim/touchscreen/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# sim/touchscreen/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+#export NUTTX_BIN=
+#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/skp16c26/Kconfig b/nuttx/configs/skp16c26/Kconfig
new file mode 100644
index 000000000..7a1044c5e
--- /dev/null
+++ b/nuttx/configs/skp16c26/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_SKP16C26
+endif
diff --git a/nuttx/configs/skp16c26/README.txt b/nuttx/configs/skp16c26/README.txt
new file mode 100644
index 000000000..a09ca5a17
--- /dev/null
+++ b/nuttx/configs/skp16c26/README.txt
@@ -0,0 +1,116 @@
+configs/skp16c26/README.txt
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+1. The buildroot package can be used to build an M16C toolchain. The toolchain
+ buildroot can be downloaded from misc/buildroot in the NuttX SVN. Insructions
+ for building the toolchain are provided below.
+
+ However, the target cannot be built because the GNU m16c-elf-ld link fails with
+ the following message:
+
+ m32c-elf-ld: BFD (GNU Binutils) 2.19 assertion fail /home/Owner/projects/nuttx/buildroot/toolchain_build_m32c/binutils-2.19/bfd/elf32-m32c.c:482
+
+ Where the reference line is:
+
+ /* If the symbol is out of range for a 16-bit address,
+ we must have allocated a plt entry. */
+ BFD_ASSERT (*plt_offset != (bfd_vma) -1);
+
+ No workaround is known at this time. This is a show stopper for M16C.
+
+2. A supported version of the M16C toolchain is available here:
+
+ http://www.kpitgnutools.com/index.php
+
+ This download is free but requires registration. Unfortunately, this v0901 of
+ this toolchain shows the same behavior:
+
+ c:\Hew3\Tools\KPIT Cummins\GNUM16CM32C-ELF\v0901\m32c-elf\bin\m32c-elf-ld.exe: BFD (GNU Binutils) 2.19-GNUM16CM32C_v0901 assertion fail /home/kpit/fsfsrc/binutils-2.19/bfd/elf32-m32c.c:482
+
+It is possible that this error messasge my be telling me -- a very roundabout way --
+that I have exceeded the FLASH region, but I think that unlikely (it is difficult
+to know if the link does not complete gracefully).
+
+BUILDING THE R8C/M16C/M32C GNU TOOLCHAIN USING BUILDROOT
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+NOTE: See the toolchain issues above -- you may not want to waste your time.
+
+1. CD to the correct directory.
+
+ Change to the directory just above the NuttX installation. If <nuttx-dir> is
+ where NuttX is installed, then cd to <nuttx-dir>/..
+
+2. Get and Install the buildroot Module
+
+ a. Using a release tarball:
+
+ cd <nuttx-dir>/..
+ Download the appropriate buildroot package.
+ unpack the buildroot package
+ rename the directory to buildroot
+
+ b. Using SVN
+
+ Check out the misc/buildroot module. SVN checkout instructions:
+
+ svn co https://nuttx.svn.sourceforge.net/svnroot/nuttx nuttx/trunk/misc/buildroot
+
+ Move the buildroot Source Tree and create the archive directory
+
+ mv misc/buildroot .
+
+ Make the archive directory:
+
+ mkdir archive
+
+ The <nuttx-dir>/../buildroot is where the toolchain is built;
+ The <nuttx-dir>/../archive directory is where toolchain sources will be downloaded.
+
+3. Make sure that NuttX is configured
+
+ cd <nuttx-dir>/tools
+ ./configure.sh <nuttx-configuration>
+
+4. Configure and Make the buildroot
+
+ cd buildroot
+ cp configs/m32c-defconfig-4.2.4 .config
+ make oldconfig
+ make
+
+ This will download the large source packages for the toolchain and build the toolchain.
+ The resulting binaries will be under buildroot/build_m32c. There will also be a
+ large build directory called toolchain_build_m32c; this directory can be removed once
+ the build completes successfully.
+
+Cygwin GCC BUILD NOTES
+^^^^^^^^^^^^^^^^^^^^^^
+ On Cygwin, the buildroot 'make' command will fail with an error like:
+
+ "...
+ build/genchecksum cc1-dummy > cc1-checksum.c
+ opening cc1-dummy: No such file or directory
+ ..."
+
+ This is caused because on Cygwin, host executables will be generated with the extension .exe
+ and, apparently, the make variable "exeext" is set incorrectly. A work around after the
+ above occurs is:
+
+ cd toolchain_build_m32c/gcc-4.2.4-initial/gcc # Go to the directory where error occurred
+ mv cc1-dummy.exe cc1-dummy # Rename the executable without .exe
+ rm cc1-checksum.c # Get rid of the bad generated file
+
+ Then resume the buildroot make:
+
+ cd - # Back to the buildroot make directory
+ make # Restart the build
+
+ GCC is built twice. First a initial, "bootstap" GCC is produced in
+ toolchain_build_m32c/gcc-4.2.4-initial, then the final GCC is produced in
+ toolchain_build_m32c/gcc-4.2.4-final. The above error will occur twice: Once for
+ the intial GCC build (see above) and once for the final GCC build. For the final GCC
+ build, the workaround is the same except that the directory will be
+ toolchain_build_m32c/gcc-4.2.4-final/gcc.
+
+ \ No newline at end of file
diff --git a/nuttx/configs/skp16c26/include/README.txt b/nuttx/configs/skp16c26/include/README.txt
new file mode 100644
index 000000000..8ee740b2b
--- /dev/null
+++ b/nuttx/configs/skp16c26/include/README.txt
@@ -0,0 +1,2 @@
+This directory contains header files specific to the board architecture. In particular,
+it must contain a file named board.h.
diff --git a/nuttx/configs/skp16c26/include/board.h b/nuttx/configs/skp16c26/include/board.h
new file mode 100644
index 000000000..cf0a1c15b
--- /dev/null
+++ b/nuttx/configs/skp16c26/include/board.h
@@ -0,0 +1,138 @@
+/************************************************************************************
+ * configs/skp16c26/include/board.h
+ * arch/board/board.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_SKP16C26_INCLUDE_BOARD_H
+#define __CONFIGS_SKP16C26_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* User configuration checks ********************************************************/
+
+/* According to SKP16C26 documention, "SIO/UART1 pins are used for communication
+ * between the SKP16C26 board kernel and KD30 Debugger through the ICD. Do not
+ * connect these pins to any other circuit, as UART1 cannot be used in the user
+ * program. For details, please see ICD (RTA-FoUSB-MON) User Manual on Target M16C
+ * ROM Monitor Resources or related ICD application notes."
+ *
+ * However, the schematic appears to show that SIO/UART2 is actual connection.
+ * To be safe, we will error out on either selection:
+ */
+
+#if !defined(CONFIG_UART1_DISABLE) || !defined(CONFIG_UART2_DISABLE)
+# error "UART1/2 should not be used on SKP16C26"
+#endif
+
+/* Hardware defintitions ************************************************************/
+
+/* Xin Freq */
+
+#define M16C_XIN_FREQ 20000000 /* 20MHz */
+
+/* Interrupt Priority Levels ********************************************************/
+
+/* IPL settings */
+
+#define M16C_DEFAULT_IPL 0 /* Default M16C Interrupt priority level */
+#undef M16C_INTERRUPT_IPL /* Default interrupt IPL to enabled nested interrupts */
+
+/* Define any of the following to specify interrupt priorities. A default
+ * value of 5 will be used for any unspecified values
+ */
+
+#undef M16C_INT3_PRIO /* INT3 interrupt priority */
+#undef M16C_INT5_PRIO /* INT5 interrupt priority */
+#undef M16C_INT4_PRIO /* INT4 interrupt priority */
+#undef M16C_BCN_PRIO /* Bus collision detection interrupt priority */
+#undef M16C_DM0_PRIO /* DMA0 interrupt priority */
+#undef M16C_DM1_PRIO /* DMA1 interrupt priority */
+#undef M16C_KUP_PRIO /* Key input interrupt priority */
+#undef M16C_AD_PRIO /* A-D conversion interrupt priority */
+#undef M16C_S2T_PRIO /* UART2 transmit interrupt priority */
+#undef M16C_S2R_PRIO /* UART2 receive interrupt priority */
+#undef M16C_S0T_PRIO /* UART0 transmit interrupt priority */
+#undef M16C_S0R_PRIO /* UART0 receive interrupt priority */
+#undef M16C_S1T_PRIO /* UART1 transmit interrupt priority */
+#undef M16C_S1R_PRIO /* UART1 receive interrupt priority */
+#define M16C_TA0_PRIO 5 /* Timer A0 interrupt priority */
+#undef M16C_TA1_PRIO /* Timer A1 interrupt priority */
+#undef M16C_TA2_PRIO /* Timer A2 interrupt priority */
+#undef M16C_TA3_PRIO /* Timer A3 interrupt priority */
+#undef M16C_TA4_PRIO /* Timer A4 interrupt priority */
+#undef M16C_TB0_PRIO /* Timer B0 interrupt priority */
+#undef M16C_TB1_PRIO /* Timer B1 interrupt priority */
+#undef M16C_TB2_PRIO /* Timer B2 interrupt priority */
+#undef M16C_INT0_PRIO /* INT0 interrupt priority */
+#undef M16C_INT1_PRIO /* INT1 interrupt priority */
+
+/* LED definitions **********************************************************/
+
+ /* GREEN YELLOW RED */
+#define LED_STARTED 0 /* OFF OFF OFF */
+#define LED_HEAPALLOCATE 1 /* ON OFF OFF */
+#define LED_IRQSENABLED 2 /* OFF ON OFF */
+#define LED_STACKCREATED 3 /* ON ON OFF */
+#define LED_INIRQ 4 /* ON OFF ON */
+#define LED_SIGNAL 5 /* OFF ON ON */
+#define LED_ASSERTION 6 /* ON ON ON */
+#define LED_PANIC 7 /* NC** NC** ON* */
+
+/* *=FLASHING **=if INIRQ, SIGNAL, or ASSERTION will be flashing */
+
+/* BUTTON definitions **************************************************************/
+
+#define SW1_PRESSED 0x01 /* Bit 0: 1=SW1 pressed */
+#define SW2_PRESSED 0x02 /* Bit 1: 1=SW2 pressed */
+#define SW3_PRESSED 0x04 /* Bit 2: 1=SW3 pressed */
+
+/************************************************************************************
+ * Macro Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Inline Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#endif
+
+#endif /* __CONFIGS_SKP16C26_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/skp16c26/ostest/Make.defs b/nuttx/configs/skp16c26/ostest/Make.defs
new file mode 100644
index 000000000..bad496656
--- /dev/null
+++ b/nuttx/configs/skp16c26/ostest/Make.defs
@@ -0,0 +1,107 @@
+############################################################################
+# configs/skp16c26/ostest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV = m32c-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCPUFLAGS = -mcpu=m16c -fno-builtin
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/skp16c26/ostest/appconfig b/nuttx/configs/skp16c26/ostest/appconfig
new file mode 100644
index 000000000..7475e5818
--- /dev/null
+++ b/nuttx/configs/skp16c26/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/skp16c26/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/skp16c26/ostest/defconfig b/nuttx/configs/skp16c26/ostest/defconfig
new file mode 100644
index 000000000..91917f8f0
--- /dev/null
+++ b/nuttx/configs/skp16c26/ostest/defconfig
@@ -0,0 +1,320 @@
+############################################################################
+# configs/skp16c26/ostest/defconfig
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection. NOTE: There are additional M16C-specific
+# settings that are provided via the arch/board/board.h file.
+#
+
+CONFIG_ARCH="sh"
+CONFIG_ARCH_M16C=y
+CONFIG_ARCH_CHIP="m16c"
+CONFIG_ARCH_CHIP_M30262F8=y
+CONFIG_ARCH_BOARD="skp16c26"
+CONFIG_ARCH_BOARD_SKP16C26=y
+CONFIG_ARCH_NOINTC=y
+CONFIG_ENDIAN_BIG=y
+CONFIG_DRAM_SIZE=2048
+CONFIG_DRAM_START=0x00400
+CONFIG_BOARD_LOOPSPERMSEC=16945
+CONFIG_ARCH_INTERRUPTSTACK=128
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_LCD=y
+
+#
+# M16C specific device driver settings
+#
+CONFIG_UART0_DISABLE=y
+CONFIG_UART1_DISABLE=y
+CONFIG_UART2_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=64
+CONFIG_UART1_TXBUFSIZE=64
+CONFIG_UART2_TXBUFSIZE=64
+CONFIG_UART0_RXBUFSIZE=64
+CONFIG_UART1_RXBUFSIZE=64
+CONFIG_UART2_RXBUFSIZE=64
+CONFIG_UART0_BAUD=19200
+CONFIG_UART1_BAUD=19200
+CONFIG_UART2_BAUD=19200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# Enable LCD console
+CONFIG_LCD_CONSOLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=y
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=20
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=2
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# M16C USB Configuration
+#
+CONFIG_M16C_GIO_USBATTACH=6
+CONFIG_M16C_GIO_USBDPPULLUP=17
+CONFIG_M16C_VENDORID=0xd320
+CONFIG_M16C_PRODUCTID=0x3211
+CONFIG_M16C_USBDEV_DMA=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303_EPINTIN=3
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=1
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=1
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# DM90x0 Driver Settings
+CONFIG_NET_DM90x0=n
+CONFIG_DM9X_NINTERFACES=1
+CONFIG_DM9X_STATS=n
+CONFIG_DM9X_BASE=0xd0000300
+CONFIG_DM9X_IRQ=27
+CONFIG_DM9X_BUSWIDTH8=n
+CONFIG_DM9X_BUSWIDTH16=y
+CONFIG_DM9X_BUSWIDTH32=n
+CONFIG_DM9X_CHECKSUM=n
+CONFIG_DM9X_ETRANS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
+CONFIG_PTHREAD_STACK_MIN=64
+CONFIG_PTHREAD_STACK_DEFAULT=256
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/skp16c26/ostest/ld.script b/nuttx/configs/skp16c26/ostest/ld.script
new file mode 100644
index 000000000..8ae1a8697
--- /dev/null
+++ b/nuttx/configs/skp16c26/ostest/ld.script
@@ -0,0 +1,139 @@
+/****************************************************************************
+ * configs/skp16c26/ostest/ld.script
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(m32c)
+ENTRY(_stext)
+SECTIONS
+{
+ /* "Far" flash memory begins at address 0xf0000 for the M20262F8 part and
+ * ends at address 0xfffff (all parts). The program entry point is
+ * the first address in flash
+ */
+
+ . = 0xf0000;
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ _enronly = ABSOLUTE(.); /* End of read-only values */
+ /* .ndata will be relocated */
+ /* from this address */
+
+ /* The "variable" vector table will be fixed at the following address */
+
+ . = 0xffd00;
+ .varvect : {
+ _svarvect = ABSOLUTE(.);
+ *(.varvect)
+ _evarvect = ABSOLUTE(.);
+ }
+
+ /* Followed by the special page/fixed vector table. */
+
+ . = 0xffe00;
+ .specpg : {
+ _sspecpg = ABSOLUTE(.);
+ *(.specpg)
+ _especpg = ABSOLUTE(.);
+ }
+
+ . = 0xfffdc;
+ .fixvect : {
+ _sfixvect = ABSOLUTE(.);
+ *(.fixvect)
+ _efixvect = ABSOLUTE(.);
+ }
+
+ /* Internal "near" RAM begins at address 0x00400 (all parts) and ends at
+ * address 0x00bff (M20262F6 and M20262F8 parts). With the RAM
+ * region, used is .data followed by .bss. The remainder of RAM
+ * carved up by the start-up code into stacks and heaps.
+ */
+
+ . = 0x00400;
+
+ .ndata : {
+ _sndata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _endata = ABSOLUTE(.);
+ }
+
+ .nbss : { /* BSS */
+ _snbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _enbss = ABSOLUTE(.);
+ }
+
+ /* "Far" RAM begins at 0x10000. The SKP16C26 has no far RAM */
+
+ . = 0x10000;
+
+ .fdata : {
+ _sfdata = ABSOLUTE(.);
+ *(.fdata)
+ CONSTRUCTORS
+ _efdata = ABSOLUTE(.);
+ }
+
+ .fbss : { /* BSS */
+ _sfbss = ABSOLUTE(.);
+ *(.fbss)
+ *(COMMON)
+ _efbss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/skp16c26/ostest/setenv.sh b/nuttx/configs/skp16c26/ostest/setenv.sh
new file mode 100755
index 000000000..a74258fb8
--- /dev/null
+++ b/nuttx/configs/skp16c26/ostest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/skp16c26/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_m32c/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/skp16c26/src/Makefile b/nuttx/configs/skp16c26/src/Makefile
new file mode 100644
index 000000000..483c24498
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/Makefile
@@ -0,0 +1,77 @@
+############################################################################
+# configs/skp16c26/src/Makefile
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c up_buttons.c up_lcd.c up_lcdconsole.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/skp16c26/src/README.txt b/nuttx/configs/skp16c26/src/README.txt
new file mode 100644
index 000000000..44ec231d7
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/README.txt
@@ -0,0 +1,2 @@
+This file contains source files specific for the board architecture. It must also
+contain a Makefile for the libboard.a target.
diff --git a/nuttx/configs/skp16c26/src/skp16c26_internal.h b/nuttx/configs/skp16c26/src/skp16c26_internal.h
new file mode 100644
index 000000000..048292048
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/skp16c26_internal.h
@@ -0,0 +1,67 @@
+/************************************************************************************
+ * configs/skp16c26/src/scp16c26_internal.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_SKP16C26_SRC_SKP16C26_INTERNAL_H
+#define __CONFIGS_SKP16C26_SRC_SKP16C26_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/********************************************************************************/
+/* Macro Definitions */
+/********************************************************************************/
+
+/************************************************************************************
+ * Inline Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#endif
+
+/************************************************************************************
+ * Global Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#endif
+
+#endif /* __CONFIGS_SKP16C26_SRC_SKP16C26_INTERNAL_H */
diff --git a/nuttx/configs/skp16c26/src/up_buttons.c b/nuttx/configs/skp16c26/src/up_buttons.c
new file mode 100644
index 000000000..a483aaeaa
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/up_buttons.c
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/skp16c26/src/up_buttons.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* The SKP62C26 has 3 buttons control by bits 1, 2, and 3 in port 8. */
+
+#define SW1_BIT (1 << 3) /* Bit 3, port 8 */
+#define SW2_BIT (1 << 2) /* Bit 2, port 8 */
+#define SW3_BIT (1 << 1) /* Bit 1, port 8 */
+
+#define SW_PRESSED(p,b) (((p) & (b)) == 0)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+void up_buttoninit(void)
+{
+ uint8_t regval;
+
+ regval = getreg8(M16C_PD8);
+ regval |= (SW1_BIT | SW2_BIT | SW3_BIT);
+ putreg8(regval, M16C_PD8);
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t swset = 0;
+ uint8_t regval = getreg8(M16C_P8);
+
+ if (SW_PRESSED(regval, SW1_BIT))
+ {
+ swset |= SW1_PRESSED;
+ }
+
+ if (SW_PRESSED(regval, SW2_BIT))
+ {
+ swset |= SW2_PRESSED;
+ }
+
+ if (SW_PRESSED(regval, SW3_BIT))
+ {
+ swset |= SW3_PRESSED;
+ }
+
+ return swset;
+}
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/skp16c26/src/up_lcd.c b/nuttx/configs/skp16c26/src/up_lcd.c
new file mode 100644
index 000000000..a47f4af51
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/up_lcd.c
@@ -0,0 +1,282 @@
+/************************************************************************************
+ * configs/scp16c26/src/up_lcd.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <ctype.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "chip.h"
+
+#ifdef CONFIG_ARCH_LCD
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* LCD dimensions *******************************************************************/
+
+#define LCD_NLINES 2 /* Two lines */
+#define LCD_NCHARS 8 /* Eight characters per line */
+
+/* LCD commands *********************************************************************/
+
+#define LCD_CLEAR 0x01 /* Clear LCD display and home cursor */
+#define CURSOR_MODE_DEC 0x04 /* Cursor auto decrement after R/W */
+#define CURSOR_MODE_INC 0x06 /* Cursor auto increment after R/W */
+#define LCD_CURSOR_ON 0x0e /* Display ON with Cursor */
+#define LCD_CURSOR_OFF 0x0c /* Display ON with Cursor off */
+#define LCD_CURSOR_BLINK 0x0d /* Display on with blinking cursor */
+#define LCD_CURSOR_LEFT 0x10 /* Move Cursor Left One Position */
+#define LCD_CURSOR_RIGHT 0x14 /* Move Cursor Right One Position */
+#define FUNCTION_SET 0x28 /* Setup, 4 bits,2 lines, 5X7 */
+#define LCD_CGRAM 0x40 /* Map characters to CG RAM */
+#define LCD_POS_L1(p) (0x80 | p) /* Move cursor to line 1, character p+1 */
+#define LCD_POS_L2(p) (0xc0 | p) /* Move cursor to line 2, character p+1 */
+#define LCD_HOME_L1 0x80 /* Move cursor to line 1 */
+#define LCD_HOME_L2 0xc0 /* Move cursor to line 2 */
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+static uint8_t g_nchars; /* Number of characters in lines 2 */
+static uint8_t g_line[LCD_NCHARS]; /* The content of lines 2 */
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_lcddelay
+ ************************************************************************************/
+
+static void up_lcddelay(uint16_t count)
+{
+ uint32_t counter = (uint16_t)count << 8;
+ while(counter--)
+ {
+ asm("\tnop\n\tnop\n\tnop\n" : :); /* 3 NOPs */
+ }
+}
+
+/************************************************************************************
+ * Name: up_setrs
+ ************************************************************************************/
+
+static inline void up_setrs(bool data)
+{
+ /* Set/clear bit 1 of port 6 */
+
+ register uint8_t regval = getreg8(M16C_P6);
+ if (data)
+ {
+ regval |= (1 << 0); /* High = data */
+ }
+ else
+ {
+ regval &= ~(1 << 0); /* Low = control */
+ }
+ putreg8(regval, M16C_P6);
+}
+
+/************************************************************************************
+ * Name: up_seten
+ ************************************************************************************/
+
+static inline void up_seten(void)
+{
+ /* Set bit 1 of port 6 */
+
+ register uint8_t regval = getreg8(M16C_P6);
+ regval = (1 << 1);
+ putreg8(regval, M16C_P6);
+}
+
+/************************************************************************************
+ * Name: up_clren
+ ************************************************************************************/
+
+static inline void up_clren(void)
+{
+ /* Clear bit 1 of port 6 */
+
+ register uint8_t regval = getreg8(M16C_P6);
+ regval &= ~(1 << 1);
+ putreg8(regval, M16C_P6);
+}
+
+/************************************************************************************
+ * Name: up_enpluse
+ ************************************************************************************/
+
+static inline void up_enpulse(bool data)
+{
+ up_seten(); /* EN enable chip (HIGH) */
+ up_lcddelay(0); /* Short delay */
+ up_clren(); /* Latch data by setting EN low */
+ up_lcddelay(0); /* Short delay for data writes */
+ if (!data) up_lcddelay(0); /* Longer delay for control writes */
+}
+
+/************************************************************************************
+ * Name: up_lcdwrite
+ ************************************************************************************/
+
+void up_lcdwrite(bool data, uint8_t ch)
+{
+ up_setrs(data); /* Set RS appropriately */
+
+ /* Write upper nibble first. Only the lower 4 bits of P9 are valid. The upper four
+ * bits are reserved and must be zero.
+ */
+
+ putreg8(ch >> 4, M16C_P9);
+ up_enpulse(data);
+
+ /* Write lower nibble second */
+
+ putreg8(ch & 0x0f, M16C_P9);
+ up_enpulse(data);
+}
+
+/************************************************************************************
+ * Name: up_scroll
+ ************************************************************************************/
+
+static void up_scroll(void)
+{
+ int i;
+
+ /* Clear the display and position the cursor at the beginning of line 1 */
+
+ up_lcdwrite(false, LCD_CLEAR);
+ up_lcdwrite(false, LCD_HOME_L1);
+
+ /* Copy line 2 to line 1 */
+
+ for (i = 0; i < g_nchars; i++)
+ {
+ up_lcdwrite(true, g_line[i]);
+ }
+
+ /* Position the cursor at the beginning of line 2 */
+
+ up_lcdwrite(false, LCD_HOME_L2);
+ g_nchars = 0;
+}
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_lcdinit
+ ************************************************************************************/
+
+void up_lcdinit(void)
+{
+ uint8_t regval;
+
+ /* Enable writing to PD9 by selecting bit 2 in the protection register */
+
+ regval = getreg8(M16C_PRCR);
+ regval |= (1 << 2);
+ putreg8(regval, M16C_PRCR);
+
+ /* We can't read PD9, so we can't OR the values in */
+
+ putreg8(0x0f, M16C_PD9);
+
+ /* Set EN (port 6 bit 1) and Set RS (port 6 bit 0) as outputs */
+
+ regval = getreg8(M16C_P6);
+ regval |= (1 << 1) | (1 << 0);
+ putreg8(regval, M16C_P6);
+
+ regval = getreg8(M16C_PD6);
+ regval |= (1 << 1) | (1 << 0);
+ putreg8(regval, M16C_PD6);
+
+ /* Set EN low */
+
+ up_clren();
+
+ /* Write the reset sequence */
+
+ up_lcdwrite(false, 0x33);
+ up_lcddelay(20);
+ up_lcdwrite(false, 0x32);
+ up_lcddelay(20);
+ up_lcdwrite(false, FUNCTION_SET); /* reset sequence */
+ up_lcdwrite(false, FUNCTION_SET);
+ up_lcdwrite(false, LCD_CURSOR_OFF);
+ up_lcdwrite(false, LCD_CLEAR);
+ up_lcdwrite(false, LCD_HOME_L1);
+}
+
+/************************************************************************************
+ * Name: up_lcdputc
+ ************************************************************************************/
+
+void up_lcdputc(char ch)
+{
+ /* Check for new line */
+
+ if (ch == '\n')
+ {
+ up_scroll();
+ }
+
+ /* Should we wrap to truncate at the end of line??? Let's truncate. In either
+ * case, let's ignore all other non-printable characters.
+ */
+
+ else if (g_nchars < LCD_NCHARS && isprint(ch))
+ {
+ up_lcdwrite(true, ch);
+ g_line[g_nchars] = ch;
+ g_nchars++;
+ }
+}
+
+#endif /* CONFIG_ARCH_LCD */
diff --git a/nuttx/configs/skp16c26/src/up_lcdconsole.c b/nuttx/configs/skp16c26/src/up_lcdconsole.c
new file mode 100644
index 000000000..1ae00fb22
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/up_lcdconsole.c
@@ -0,0 +1,141 @@
+/************************************************************************************
+ * configs/scp16c26/src/up_lcd.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/arch.h>
+
+#include "up_internal.h"
+#include "skp16c26_internal.h"
+
+/* Only use the LCD as a console if there are is no serial console */
+
+#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
+# define HAVE_SERIALCONSOLE 1
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE)
+# define HAVE_SERIALCONSOLE 1
+#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE)
+# define HAVE_SERIALCONSOLE 1
+#else
+# undef HAVE_SERIALCONSOLE
+#endif
+
+#if !defined(HAVE_SERIALCONSOLE) && defined(CONFIG_ARCH_LCD) && defined(CONFIG_LCD_CONSOLE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_earlyconsoleinit
+ *
+ * Description:
+ * Performs the low level UART initialization early in debug so that the serial
+ * console will be available during bootup. This must be called before
+ * up_consoleinit.
+ *
+ ************************************************************************************/
+
+#ifdef USE_EARLYSERIALINIT
+# warning "You probably need to define CONFIG_ARCH_LOWCONSOLE"
+void up_earlyconsoleinit(void)
+{
+ /* There is probably a problem if we are here */
+}
+#endif
+
+/************************************************************************************
+ * Name: up_consoleinit
+ *
+ * Description:
+ * Register serial console and serial ports. This assumes that
+ * up_earlyconsoleinit was called previously.
+ *
+ ************************************************************************************/
+
+#if USE_SERIALDRIVER
+# warning "You probably need to define CONFIG_ARCH_LOWCONSOLE"
+void up_consoleinit(void)
+{
+ /* There is probably a problem if we are here */
+
+ lowconsole_init();
+}
+#endif
+
+/************************************************************************************
+ * Name: up_lowputc
+ *
+ * Description:
+ * Output one character on the console
+ *
+ ************************************************************************************/
+
+void up_lowputc(char ch)
+{
+ up_lcdputc(ch);
+}
+
+/************************************************************************************
+ * Name: up_putc
+ *
+ * Description:
+ * Output one character on the console
+ *
+ ************************************************************************************/
+
+int up_putc(int ch)
+{
+ up_lcdputc(ch);
+ return ch;
+}
+
+#endif /* !HAVE_SERIALCONSOLE && CONFIG_ARCH_LCD */
diff --git a/nuttx/configs/skp16c26/src/up_leds.c b/nuttx/configs/skp16c26/src/up_leds.c
new file mode 100644
index 000000000..024d8f143
--- /dev/null
+++ b/nuttx/configs/skp16c26/src/up_leds.c
@@ -0,0 +1,245 @@
+/************************************************************************************
+ * configs/scp16c26/src/up_leds.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "up_arch.h"
+#include "up_internal.h"
+#include "chip.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/************************************************************************************
+ * Preprocessor Definitions
+ ************************************************************************************/
+
+/* The SKP62C26 has 3 LEDs control by bits 0 and 2 in port 7 and bit 0 in port 8. */
+
+#define GREEN_LED (1 << 2) /* Bit 2, port 7 */
+#define YELLOW_LED (1 << 4) /* Bit 4, port 7 */
+#define RED_LED (1 << 0) /* Bit 0, port 8 */
+
+#define GREEN_LED_ON 0
+#define GREEN_LED_OFF GREEN_LED
+#define GREEN_LED_MASK GREEN_LED
+#define GREEN_LED_PORT M16C_P7
+
+#define YELLOW_LED_ON 0
+#define YELLOW_LED_OFF YELLOW_LED
+#define YELLOW_LED_MASK YELLOW_LED
+#define YELLOW_LED_PORT M16C_P7
+
+#define GREENYELLOW_LED_MASK (GREEN_LED_MASK|YELLOW_LED_MASK)
+#define GREENYELLOW_LED_PORT M16C_P7
+#define GREENYELLOW_DIR_PORT M16C_PD7
+
+#define RED_LED_ON 0
+#define RED_LED_OFF RED_LED
+#define RED_LED_MASK RED_LED
+#define RED_LED_PORT M16C_P8
+#define RED_DIR_PORT M16C_PD8
+
+/************************************************************************************
+ * Private Type Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data Definitions
+ ************************************************************************************/
+
+static const uint8_t g_ledstate[7] =
+{
+ (GREEN_LED_OFF | YELLOW_LED_OFF | RED_LED_OFF), /* LED_STARTED */
+ (GREEN_LED_ON | YELLOW_LED_OFF | RED_LED_OFF), /* LED_HEAPALLOCATE */
+ (GREEN_LED_OFF | YELLOW_LED_ON | RED_LED_OFF), /* LED_IRQSENABLED */
+ (GREEN_LED_ON | YELLOW_LED_ON | RED_LED_OFF), /* LED_STACKCREATED */
+
+ (GREEN_LED_ON | YELLOW_LED_OFF | RED_LED_ON ), /* LED_INIRQ */
+ (GREEN_LED_OFF | YELLOW_LED_ON | RED_LED_ON ), /* LED_SIGNAL */
+ (GREEN_LED_ON | YELLOW_LED_ON | RED_LED_ON ) /* LED_ASSERTION */
+};
+
+static uint8_t g_prevled[3];
+static uint8_t g_nestlevel;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_ledinit
+ ************************************************************************************/
+
+static void up_setleds(uint8_t gybits, uint8_t rbit)
+{
+ uint8_t regval;
+
+ regval = getreg8(GREENYELLOW_LED_PORT);
+ regval &= ~GREENYELLOW_LED_MASK;
+ regval |= gybits;
+ putreg8(regval, GREENYELLOW_LED_PORT);
+
+ regval = getreg8(RED_LED_PORT);
+ regval &= ~RED_LED_MASK;
+ regval |= rbit;
+ putreg8(regval, RED_LED_PORT);
+}
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_ledinit
+ ************************************************************************************/
+
+void up_ledinit(void)
+{
+ register uint8_t regval;
+
+ /* Make sure that the LEDs are in the OFF state */
+
+ regval = getreg8(GREENYELLOW_LED_PORT);
+ regval |= (GREEN_LED_OFF |YELLOW_LED_OFF);
+ putreg8(regval, GREENYELLOW_LED_PORT);
+
+ regval = getreg8(RED_LED_PORT);
+ regval |= RED_LED_OFF;
+ putreg8(regval, RED_LED_PORT);
+
+ /* Set the direction to output */
+
+ regval = getreg8(GREENYELLOW_DIR_PORT);
+ regval |= (GREEN_LED |YELLOW_LED);
+ putreg8(regval, GREENYELLOW_DIR_PORT);
+
+ regval = getreg8(RED_DIR_PORT);
+ regval |= RED_LED;
+ putreg8(regval, RED_DIR_PORT);
+}
+
+/************************************************************************************
+ * Name: up_ledon
+ ************************************************************************************/
+
+void up_ledon(int led)
+{
+ uint8_t ledset;
+
+ /* If this is the ASSERTION led, preserve the Y&G bits from the last setting and
+ * set the RED LED on.
+ */
+
+ if (led == LED_ASSERTION)
+ {
+ ledset = g_ledstate[g_prevled[g_nestlevel]];
+ up_setleds(ledset & GREENYELLOW_LED_MASK, RED_LED_ON);
+ }
+ else if (led < LED_ASSERTION)
+ {
+ /* Otherwise, just show the LEDs corresponding to this state */
+
+ ledset = g_ledstate[led];
+ up_setleds(ledset & GREENYELLOW_LED_MASK, ledset & RED_LED_MASK);
+
+ /* If this was a nested states (INIRQ, SIGNAL, or ASSERTION) then
+ * stack up the previous value.
+ */
+
+ if (led > LED_STACKCREATED)
+ {
+ g_nestlevel++;
+ }
+ g_prevled[g_nestlevel] = led;
+ }
+}
+
+/************************************************************************************
+ * Name: up_ledoff
+ ************************************************************************************/
+
+void up_ledoff(int led)
+{
+ uint8_t ledset;
+
+ /* If this is the ASSERTION led then what we do depends on the previous state */
+
+ if (led == LED_ASSERTION)
+ {
+ /* If the previous state was one of the nested states (INIRQ, SIGNAL, or ASSERTION),
+ * then turn the green and yellow LEDs all off. That way we can distinguish
+ * that case from the simple cases.
+ */
+
+ if (g_nestlevel > 0)
+ {
+ ledset = 0;
+ }
+ else
+ {
+ ledset = g_ledstate[g_prevled[0]];
+ }
+ up_setleds(ledset & GREENYELLOW_LED_MASK, RED_LED_OFF);
+ }
+ else if (led > 0 && led < LED_ASSERTION)
+ {
+ /* If this was one of the nested states, then we want to back to the LED setting
+ * before entering that nested statel.
+ */
+
+ if (g_nestlevel > 0)
+ {
+ g_nestlevel--;
+ led = g_prevled[g_nestlevel];
+ }
+ else if (led > LED_STACKCREATED)
+ {
+ /* This shouldn't happen */
+
+ led--;
+ }
+ ledset = g_ledstate[led];
+ up_setleds(ledset & GREENYELLOW_LED_MASK, ledset & RED_LED_MASK);
+ g_prevled[g_nestlevel]= led;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3210e-eval/Kconfig b/nuttx/configs/stm3210e-eval/Kconfig
new file mode 100644
index 000000000..95ad5f108
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/Kconfig
@@ -0,0 +1,147 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_STM3210E_EVAL
+comment "STM3210E-EVAL LCD Hardware Configuration"
+
+config STM3210E_LCD
+ bool "Select support for the STM3210E-EVAL LCD"
+ default y
+ depends on LCD && STM32_FSMC
+ ---help---
+ Enable support for the LCD on the STM3210E-EVAL board. See additional,
+ LCD-common settings in the drivers/lcd Kconfig file.
+
+config LCD_BACKLIGHT
+ bool "LCD backlight support"
+ depends on STM3210E_LCD
+ default n
+ ---help---
+ Define to support a backlight.
+
+config LCD_PWM
+ bool "LCD backlight PWM control"
+ default n
+ depends on LCD_BACKLIGHT && STM32_TIM1
+ ---help---
+ If STM32_TIM1 is also defined, then an adjustable backlight will be
+ provided using timer 1 to generate various pulse widthes. The
+ granularity of the settings is determined by LCD_MAXPOWER. If LCD_PWM
+ (or STM32_TIM1) is not defined, then a simple on/off backlight is
+ provided.
+
+config LCD_RDSHIFT
+ int "LCD data shift"
+ default 5
+ depends on STM3210E_LCD
+ ---help---
+ When reading 16-bit gram data, there appears to be a shift in the returned
+ data. This value fixes the offset. Default 5.
+
+config STM32_AM240320_DISABLE
+ bool "Disable AM240320 support"
+ default n
+ depends on STM3210E_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option
+
+config STM32_SPFD5408B_DISABLE
+ bool "Disable SPFD5408B support"
+ default n
+ depends on STM3210E_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option
+
+config STM32_R61580_DISABLE
+ bool "Disable R61580 support"
+ default n
+ depends on STM3210E_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option
+
+endif
+
+config PM_BUTTONS
+ bool "PM Button support"
+ default n
+ depends on PM && ARCH_IRQBUTTONS
+ ---help---
+ Enable PM button EXTI interrupts to support PM testing
+
+config PM_BUTTONS_MIN
+ int "Minimum button number"
+ default 0
+ depends on PM_BUTTONS
+ ---help---
+ The lowest button code to use for PM testing (see board.h)
+
+config PM_BUTTONS_MAX
+ int "Maximum button number"
+ default 7
+ depends on PM_BUTTONS
+ ---help---
+ The highest button code to use for PM testing (see board.h)
+
+config PM_IRQBUTTONS_MIN
+ int "Minimum interrupting button number"
+ default 0
+ depends on PM_BUTTONS
+ ---help---
+ The lowest interrupting button code to use for PM testing (see board.h)
+
+config PM_IRQBUTTONS_MAX
+ int "Maximum interrupting button number"
+ default 7
+ depends on PM_BUTTONS
+ ---help---
+ The highest interrupting button code to use for PM testing (see board.h)
+
+config PM_BUTTON_ACTIVITY
+ int "Button PM activity weight"
+ default 10
+ depends on PM_BUTTONS
+ ---help---
+ The activity weight to report to the power management subsystem when a button is pressed.
+
+config PM_ALARM_SEC
+ int "PM_STANDBY delay (seconds)"
+ default 15
+ depends on PM && RTC_ALARM
+ --help---
+ Number of seconds to wait in PM_STANDBY before going to PM_STANDBY mode.
+
+config PM_ALARM_NSEC
+ int "PM_STANDBY delay (nanoseconds)"
+ default 0
+ depends on PM && RTC_ALARM
+ --help---
+ Number of additional nanoseconds to wait in PM_STANDBY before going to PM_STANDBY mode.
+
+config PM_SLEEP_WAKEUP
+ bool "PM_SLEEP wake-up alarm"
+ default n
+ depends on PM && RTC_ALARM
+ --help---
+ Wake-up of PM_SLEEP mode after a delay and resume normal operation.
+
+config PM_SLEEP_WAKEUP_SEC
+ int "PM_SLEEP delay (seconds)"
+ default 10
+ depends on PM && RTC_ALARM
+ --help---
+ Number of seconds to wait in PM_SLEEP before going to PM_STANDBY mode.
+
+config PM_SLEEP_WAKEUP_NSEC
+ int "PM_SLEEP delay (nanoseconds)"
+ default 0
+ depends on PM && RTC_ALARM
+ --help---
+ Number of additional nanoseconds to wait in PM_SLEEP before going to PM_STANDBY mode.
diff --git a/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt
new file mode 100644
index 000000000..8582e95ff
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/README.txt
@@ -0,0 +1,915 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the
+STMicro STM3210E-EVAL development board.
+
+Contents
+========
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - DFU and JTAG
+ - OpenOCD
+ - LEDs
+ - Temperature Sensor
+ - RTC
+ - FSMC SRAM
+ - STM3210E-EVAL-specific Configuration Options
+ - Configurations
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Raisonance R-Link emulatator and some RIDE7 development tools
+ were used and those tools works only under Windows.
+
+GNU Toolchain Options
+=====================
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. Raisonance GNU toolchain, or
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh stm3210e-eval/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+DFU and JTAG
+============
+
+ Enbling Support for the DFU Bootloader
+ --------------------------------------
+ The linker files in these projects can be configured to indicate that you
+ will be loading code using STMicro built-in USB Device Firmware Upgrade (DFU)
+ loader or via some JTAG emulator. You can specify the DFU bootloader by
+ adding the following line:
+
+ CONFIG_STM32_DFU=y
+
+ to your .config file. Most of the configurations in this directory are set
+ up to use the DFU loader.
+
+ If CONFIG_STM32_DFU is defined, the code will not be positioned at the beginning
+ of FLASH (0x08000000) but will be offset to 0x08003000. This offset is needed
+ to make space for the DFU loader and 0x08003000 is where the DFU loader expects
+ to find new applications at boot time. If you need to change that origin for some
+ other bootloader, you will need to edit the file(s) ld.script.dfu for the
+ configuration.
+
+ The DFU SE PC-based software is available from the STMicro website,
+ http://www.st.com. General usage instructions:
+
+ 1. Convert the NuttX Intel Hex file (nuttx.hex) into a special DFU
+ file (nuttx.dfu)... see below for details.
+ 2. Connect the STM3210E-EVAL board to your computer using a USB
+ cable.
+ 3. Start the DFU loader on the STM3210E-EVAL board. You do this by
+ resetting the board while holding the "Key" button. Windows should
+ recognize that the DFU loader has been installed.
+ 3. Run the DFU SE program to load nuttx.dfu into FLASH.
+
+ What if the DFU loader is not in FLASH? The loader code is available
+ inside of the Demo dirctory of the USBLib ZIP file that can be downloaded
+ from the STMicro Website. You can build it using RIDE (or other toolchains);
+ you will need a JTAG emulator to burn it into FLASH the first time.
+
+ In order to use STMicro's built-in DFU loader, you will have to get
+ the NuttX binary into a special format with a .dfu extension. The
+ DFU SE PC_based software installation includes a file "DFU File Manager"
+ conversion program that a file in Intel Hex format to the special DFU
+ format. When you successfully build NuttX, you will find a file called
+ nutt.hex in the top-level directory. That is the file that you should
+ provide to the DFU File Manager. You will end up with a file called
+ nuttx.dfu that you can use with the STMicro DFU SE program.
+
+ Enabling JTAG
+ -------------
+ If you are not using the DFU, then you will probably also need to enable
+ JTAG support. By default, all JTAG support is disabled but there NuttX
+ configuration options to enable JTAG in various different ways.
+
+ These configurations effect the setting of the SWJ_CFG[2:0] bits in the AFIO
+ MAPR register. These bits are used to configure the SWJ and trace alternate function I/Os. The SWJ (SerialWire JTAG) supports JTAG or SWD access to the
+ Cortex debug port. The default state in this port is for all JTAG support
+ to be disable.
+
+ CONFIG_STM32_JTAG_FULL_ENABLE - sets SWJ_CFG[2:0] to 000 which enables full
+ SWJ (JTAG-DP + SW-DP)
+
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - sets SWJ_CFG[2:0] to 001 which enable
+ full SWJ (JTAG-DP + SW-DP) but without JNTRST.
+
+ CONFIG_STM32_JTAG_SW_ENABLE - sets SWJ_CFG[2:0] to 010 which would set JTAG-DP
+ disabled and SW-DP enabled
+
+ The default setting (none of the above defined) is SWJ_CFG[2:0] set to 100
+ which disable JTAG-DP and SW-DP.
+
+OpenOCD
+=======
+
+I have also used OpenOCD with the STM3210E-EVAL. In this case, I used
+the Olimex USB ARM OCD. See the script in configs/stm3210e-eval/tools/oocd.sh
+for more information. Using the script:
+
+1) Start the OpenOCD GDB server
+
+ cd <nuttx-build-directory>
+ configs/stm3210e-eval/tools/oocd.sh $PWD
+
+2) Load Nuttx
+
+ cd <nuttx-built-directory>
+ arm-none-eabi-gdb nuttx
+ gdb> target remote localhost:3333
+ gdb> mon reset
+ gdb> mon halt
+ gdb> load nuttx
+
+3) Running NuttX
+
+ gdb> mon reset
+ gdb> c
+
+LEDs
+====
+
+The STM3210E-EVAL board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
+board.. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
+defined. In that case, the usage by the board port is defined in
+include/board.h and src/up_leds.c. The LEDs are used to encode OS-related
+events as follows:
+
+ SYMBOL Meaning LED1* LED2 LED3 LED4
+ ---------------- ----------------------- ----- ----- ----- -----
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
+ is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+*** LED2 may also flicker normally if signals are processed.
+
+Temperature Sensor
+==================
+
+Support for the on-board LM-75 temperature sensor is available. This supported
+has been verified, but has not been included in any of the available the
+configurations. To set up the temperature sensor, add the following to the
+NuttX configuration file
+
+ CONFIG_I2C=y
+ CONFIG_I2C_LM75=y
+
+Then you can implement logic like the following to use the temperature sensor:
+
+ #include <nuttx/sensors/lm75.h>
+ #include <arch/board/board.h>
+
+ ret = stm32_lm75initialize("/dev/temp"); /* Register the temperature sensor */
+ fd = open("/dev/temp", O_RDONLY); /* Open the temperature sensor device */
+ ret = ioctl(fd, SNIOC_FAHRENHEIT, 0); /* Select Fahrenheit */
+ bytesread = read(fd, buffer, 8*sizeof(b16_t)); /* Read temperature samples */
+
+More complex temperature sensor operations are also available. See the IOCTAL
+commands enumerated in include/nuttx/sensors/lm75.h. Also read the descriptions
+of the stm32_lm75initialize() and stm32_lm75attach() interfaces in the
+arch/board/board.h file (sames as configs/stm3210e-eval/include/board.h).
+
+RTC
+===
+
+ The STM32 RTC may configured using the following settings.
+
+ CONFIG_RTC - Enables general support for a hardware RTC. Specific
+ architectures may require other specific settings.
+ CONFIG_RTC_HIRES - The typical RTC keeps time to resolution of 1
+ second, usually supporting a 32-bit time_t value. In this case,
+ the RTC is used to &quot;seed&quot; the normal NuttX timer and the
+ NuttX timer provides for higher resoution time. If CONFIG_RTC_HIRES
+ is enabled in the NuttX configuration, then the RTC provides higher
+ resolution time and completely replaces the system timer for purpose of
+ date and time.
+ CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the
+ frequency of the high resolution RTC must be provided. If CONFIG_RTC_HIRES
+ is not defined, CONFIG_RTC_FREQUENCY is assumed to be one.
+ CONFIG_RTC_ALARM - Enable if the RTC hardware supports setting of an alarm.
+ A callback function will be executed when the alarm goes off
+
+ In hi-res mode, the STM32 RTC operates only at 16384Hz. Overflow interrupts
+ are handled when the 32-bit RTC counter overflows every 3 days and 43 minutes.
+ A BKP register is incremented on each overflow interrupt creating, effectively,
+ a 48-bit RTC counter.
+
+ In the lo-res mode, the RTC operates at 1Hz. Overflow interrupts are not handled
+ (because the next overflow is not expected until the year 2106.
+
+ WARNING: Overflow interrupts are lost whenever the STM32 is powered down. The
+ overflow interrupt may be lost even if the STM32 is powered down only momentarily.
+ Therefore hi-res solution is only useful in systems where the power is always on.
+
+FSMC SRAM
+=========
+
+The 8-Mbit SRAM is connected to the STM32 at PG10 which will be FSMC_NE3, Bank1
+SRAM3. This memory will appear at address 0x68000000.
+
+The on-board SRAM can be configured by setting
+
+ CONFIG_STM32_FSMC=y : Enables the FSMC
+ CONFIG_STM32_FSMC_SRAM=y : Enable external SRAM support
+ CONFIG_HEAP2_BASE=0x68000000 : SRAM will be located at 0x680000000
+ CONFIG_HEAP2_SIZE=1048576 : The size of the SRAM is 1Mbyte
+ CONFIG_MM_REGIONS=2 : There will be two memory regions
+ : in the heap
+
+STM3210E-EVAL-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F103ZET6
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=stm3210e_eval (for the STM3210E-EVAL development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The STM32F103Z supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+ AHB
+ ---
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_CRC
+ CONFIG_STM32_FSMC
+ CONFIG_STM32_SDIO
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI4
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_USB
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_BKP
+ CONFIG_STM32_PWR
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_USB
+
+ APB2
+ ----
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_ADC3
+
+ Timer and I2C devices may need to the following to force power to be applied
+ unconditionally at power up. (Otherwise, the device is powered when it is
+ initialized).
+
+ CONFIG_STM32_FORCEPOWER
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,8
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,8
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,8, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,8
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,8, m=1,..,2
+
+ For each timer that is enabled for PWM usage, we need the following additional
+ configuration settings:
+
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+
+ NOTE: The STM32 timers are each capable of generating different signals on
+ each of the four channels with different duty cycles. That capability is
+ not supported by this driver: Only one output channel per timer.
+
+ Alternate pin mappings. The STM3210E-EVAL board requires only CAN1 remapping
+ On the STM3210E-EVAL board pin PB9 is wired as TX and pin PB8 is wired as RX.
+ Which then makes the proper connection through the CAN transiver SN65HVD230
+ out to the CAN D-type 9-pn male connector where pin 2 is CANL and pin 7 is CANH.
+
+ CONFIG_STM32_TIM1_FULL_REMAP
+ CONFIG_STM32_TIM1_PARTIAL_REMAP
+ CONFIG_STM32_TIM2_FULL_REMAP
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_1
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_2
+ CONFIG_STM32_TIM3_FULL_REMAP
+ CONFIG_STM32_TIM3_PARTIAL_REMAP
+ CONFIG_STM32_TIM4_REMAP
+ CONFIG_STM32_USART1_REMAP
+ CONFIG_STM32_USART2_REMAP
+ CONFIG_STM32_USART3_FULL_REMAP
+ CONFIG_STM32_USART3_PARTIAL_REMAP
+ CONFIG_STM32_SPI1_REMAP
+ CONFIG_STM32_SPI3_REMAP
+ CONFIG_STM32_I2C1_REMAP
+ CONFIG_STM32_CAN1_REMAP1
+ CONFIG_STM32_CAN1_REMAP2
+ CONFIG_STM32_CAN2_REMAP
+
+ JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+
+ STM32F103Z specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+
+ STM3210E-EVAL CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ STM3210E-EVAL LCD Hardware Configuration
+
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. Default is this 320x240 "landscape" orientation
+ (this setting is informative only... not used).
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support. In this orientation, the STM3210E-EVAL's
+ LCD ribbon cable is at the bottom of the display. Default is
+ 320x240 "landscape" orientation.
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support. In this orientation, the
+ STM3210E-EVAL's LCD ribbon cable is at the top of the display.
+ Default is 320x240 "landscape" orientation.
+ CONFIG_LCD_BACKLIGHT - Define to support a backlight.
+ CONFIG_LCD_PWM - If CONFIG_STM32_TIM1 is also defined, then an
+ adjustable backlight will be provided using timer 1 to generate
+ various pulse widthes. The granularity of the settings is
+ determined by CONFIG_LCD_MAXPOWER. If CONFIG_LCD_PWM (or
+ CONFIG_STM32_TIM1) is not defined, then a simple on/off backlight
+ is provided.
+ CONFIG_LCD_RDSHIFT - When reading 16-bit gram data, there appears
+ to be a shift in the returned data. This value fixes the offset.
+ Default 5.
+
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using:
+
+ CONFIG_STM32_AM240320_DISABLE
+ CONFIG_STM32_SPFD5408B_DISABLE
+ CONFIG_STM32_R61580_DISABLE
+
+Configurations
+==============
+
+Each STM3210E-EVAL configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh stm3210e-eval/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ buttons:
+ --------
+
+ Uses apps/examples/buttons to exercise STM3210E-EVAL buttons and
+ button interrupts.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ composite
+ ---------
+
+ This configuration exercises a composite USB interface consisting
+ of a CDC/ACM device and a USB mass storage device. This configuration
+ uses apps/examples/composite.
+
+ nsh and nsh2:
+ ------------
+ Configure the NuttShell (nsh) located at examples/nsh.
+
+ Differences between the two NSH configurations:
+
+ =========== ======================= ================================
+ nsh nsh2
+ =========== ======================= ================================
+ Toolchain: NuttX buildroot for Codesourcery for Windows (1)
+ Linux or Cygwin (1,2)
+ ----------- ----------------------- --------------------------------
+ Loader: DfuSe DfuSe
+ ----------- ----------------------- --------------------------------
+ Serial Debug output: USART1 Debug output: USART1
+ Console: NSH output: USART1 NSH output: USART1 (3)
+ ----------- ----------------------- --------------------------------
+ I2C No I2C1
+ ----------- ----------------------- --------------------------------
+ microSD Yes Yes
+ Support
+ ----------- ----------------------- --------------------------------
+ FAT FS CONFIG_FAT_LCNAME=y CONFIG_FAT_LCNAME=y
+ Config CONFIG_FAT_LFN=n CONFIG_FAT_LFN=y (4)
+ ----------- ----------------------- --------------------------------
+ Support for No Yes
+ Built-in
+ Apps
+ ----------- ----------------------- --------------------------------
+ Built-in None apps/examples/nx
+ Apps apps/examples/nxhello
+ apps/examples/usbstorage (5)
+ apps/system/i2c
+ =========== ======================= ================================
+
+ (1) You will probably need to modify nsh/setenv.sh or nsh2/setenv.sh
+ to set up the correct PATH variable for whichever toolchain you
+ may use.
+ (2) Since DfuSe is assumed, this configuration may only work under
+ Cygwin without modification.
+ (3) When any other device other than /dev/console is used for a user
+ interface, (1) linefeeds (\n) will not be expanded to carriage return
+ / linefeeds \r\n). You will need to configure your terminal program
+ to account for this. And (2) input is not automatically echoed so
+ you will have to turn local echo on.
+ (4) Microsoft holds several patents related to the design of
+ long file names in the FAT file system. Please refer to the
+ details in the top-level COPYING file. Please do not use FAT
+ long file name unless you are familiar with these patent issues.
+ (5) When built as an NSH add-on command (CONFIG_EXAMPLES_USBMSC_BUILTIN=y),
+ Caution should be used to assure that the SD drive is not in use when
+ the USB storage device is configured. Specifically, the SD driver
+ should be unmounted like:
+
+ nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Card is mounted in NSH
+ ...
+ nsh> umount /mnd/sdcard # Unmount before connecting USB!!!
+ nsh> msconn # Connect the USB storage device
+ ...
+ nsh> msdis # Disconnect USB storate device
+ nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Restore the mount
+
+ Failure to do this could result in corruption of the SD card format.
+
+ The nsh2 contains support for some built-in applications that can be
+ enabled by make some additional minor changes:
+
+ (1) examples/can. The CAN test example can be enabled by changing the
+ following settings in nsh2/defconfig:
+
+ CONFIG_CAN=y # Enable CAN "upper-half" driver support
+ CONFIG_STM32_CAN1=y # Enable STM32 CAN1 "lower-half" driver support
+
+ The default CAN settings may need to change in your board board
+ configuration:
+
+ CONFIG_CAN_EXTID=y # Support extended IDs
+ CONFIG_CAN1_BAUD=250000 # Bit rate: 250 KHz
+ CONFIG_CAN_TSEG1=12 # 80% sample point
+ CONFIG_CAN_TSEG2=3
+ nx:
+ ---
+ An example using the NuttX graphics system (NX). This example
+ focuses on general window controls, movement, mouse and keyboard
+ input.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
+
+ nxconsole:
+ ----------
+ This is yet another NSH configuration. This NSH configuration differs
+ from the other, however, in that it uses the NxConsole driver to host
+ the NSH shell.
+
+ Some of the differences in this configuration include these settings
+ in the defconfig file:
+
+ These select NX Multi-User mode:
+
+ CONFG_NX_MULTIUSER=y
+ CONFIG_DISABLE_MQUEUE=n
+
+ The following definition in the defconfig file to enables the NxConsole
+ driver:
+
+ CONFIG_NXCONSOLE=y
+
+ The appconfig file selects examples/nxconsole instead of examples/nsh:
+
+ CONFIGURED_APPS += examples/nxconsole
+
+ Other configuration settings:
+
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+ CONFIG_LCD_LANDSCAPE=y : 320x240 landscape
+
+ nxlines:
+ ------
+ Another example using the NuttX graphics system (NX). This
+ example focuses on placing lines on the background in various
+ orientations.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
+
+ nxtext:
+ ------
+ Another example using the NuttX graphics system (NX). This
+ example focuses on placing text on the background while pop-up
+ windows occur. Text should continue to update normally with
+ or without the popup windows present.
+
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+ CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
+
+ NOTE: When I tried building this example with the CodeSourcery
+ tools, I got a hardfault inside of its libgcc. I haven't
+ retested since then, but beware if you choose to change the
+ toolchain.
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+
+ pm:
+ --
+ This is a configuration that is used to test STM32 power management, i.e.,
+ to test that the board can go into lower and lower states of power usage
+ as a result of inactivity. This configuration is based on the nsh2
+ configuration with modifications for testing power management. This
+ configuration should provide some guideline for power management in your
+ STM32 application.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ CONFIG_PM_CUSTOMINIT and CONFIG_IDLE_CUSTOM are necessary parts of the
+ PM configuration:
+
+ CONFIG_PM_CUSTOMINIT=y
+
+ CONFIG_PM_CUSTOMINIT moves the PM initialization from arch/arm/src/stm32/stm32_pminitialiaze.c
+ to configs/stm3210-eval/src/up_pm.c. This allows us to support board-
+ specific PM initialization.
+
+ CONFIG_IDLE_CUSTOM=y
+
+ The bulk of the PM activities occur in the IDLE loop. The IDLE loop is
+ special because it is what runs when there is no other task running. Therefore
+ when the IDLE executes, we can be assure that nothing else is going on; this
+ is the ideal condition for doing reduced power management.
+
+ The configuration CONFIG_IDLE_CUSTOM allows us to "steal" the normal STM32
+ IDLE loop (of arch/arm/src/stm32/stm32_idle.c) and replace this with our own
+ custom IDLE loop (at configs/stm3210-eval/src/up_idle.c).
+
+ Here are some additional things to note in the configuration:
+
+ CONFIG_PM_BUTTONS=y
+
+ CONFIG_PM_BUTTONS enables button support for PM testing. Buttons can drive
+ EXTI interrupts and EXTI interrrupts can be used to wakeup for certain reduced
+ power modes (STOP mode). The use of the buttons here is for PM testing purposes
+ only; buttons would normally be part the application code and CONFIG_PM_BUTTONS
+ would not be defined.
+
+ CONFIG_RTC_ALARM=y
+
+ The RTC alarm is used to wake up from STOP mode and to transition to
+ STANDBY mode. This used of the RTC alarm could conflict with other uses of
+ the RTC alarm in your application.
+
+ RIDE
+ ----
+ This configuration builds a trivial bring-up binary. It is
+ useful only because it words with the RIDE7 IDE and R-Link debugger.
+
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+
+ usbserial:
+ ---------
+ This configuration directory exercises the USB serial class
+ driver at examples/usbserial. See examples/README.txt for
+ more information.
+
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+
+ USB debug output can be enabled as by changing the following
+ settings in the configuration file:
+
+ -CONFIG_DEBUG=n
+ -CONFIG_DEBUG_VERBOSE=n
+ -CONFIG_DEBUG_USB=n
+ +CONFIG_DEBUG=y
+ +CONFIG_DEBUG_VERBOSE=y
+ +CONFIG_DEBUG_USB=y
+
+ -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+ -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+ +CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=y
+ +CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=y
+
+ By default, the usbserial example uses the Prolific PL2303
+ serial/USB converter emulation. The example can be modified
+ to use the CDC/ACM serial class by making the following changes
+ to the configuration file:
+
+ -CONFIG_PL2303=y
+ +CONFIG_PL2303=n
+
+ -CONFIG_CDCACM=n
+ +CONFIG_CDCACM=y
+
+ The example can also be converted to use the alternative
+ USB serial example at apps/examples/usbterm by changing the
+ following:
+
+ -CONFIGURED_APPS += examples/usbserial
+ +CONFIGURED_APPS += examples/usbterm
+
+ In either the original appconfig file (before configuring)
+ or in the final apps/.config file (after configuring).
+
+ usbstorage:
+ ----------
+ This configuration directory exercises the USB mass storage
+ class driver at examples/usbstorage. See examples/README.txt for
+ more information.
+
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+
diff --git a/nuttx/configs/stm3210e-eval/RIDE/Make.defs b/nuttx/configs/stm3210e-eval/RIDE/Make.defs
new file mode 100644
index 000000000..021119c01
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/RIDE/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/RIDE/README.txt b/nuttx/configs/stm3210e-eval/RIDE/README.txt
new file mode 100644
index 000000000..8da1c38c9
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/README.txt
@@ -0,0 +1,38 @@
+README
+------
+
+This directory contains a simple RIDE7 project used to bring up the
+STM3210E-EVAL board. This project includes only the STM32 boot-up
+code under arch/arm/src and configs/stm3210e-eval/src plus as little
+additional environmental support as necessary.
+
+bigfatstub.c
+
+ The NuttX OS is not included in this project. This file contains
+ stubs for all of the NuttX entry points and this replaces NuttX
+
+Make.defs, defconfig, setenv.h
+
+ The first step to using this RIDE project is to build a compatible
+ cygwin project. This will set up of the directories and produce
+ all of the necessary autogenerated files.
+
+ cd tools
+ ./configure.sh stm3210e-eva/RIDE
+ cd ..
+ . ./setenv.sh
+ make
+
+nuttx.*
+
+ RIDE7 project files
+
+stm32-nuttx.ld
+
+ This is the linker script that replaces the RIDE7 linker script.
+
+stm32-ld.sh
+
+ This is a shell script that will use the RIDE7 tools to relink the
+ NuttX binaries. Useful because RIDE7 does not provide much linker
+ output to see what is going on.
diff --git a/nuttx/configs/stm3210e-eval/RIDE/appconfig b/nuttx/configs/stm3210e-eval/RIDE/appconfig
new file mode 100644
index 000000000..138b4e47a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/RIDE/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/null
+
diff --git a/nuttx/configs/stm3210e-eval/RIDE/bigfatstub.c b/nuttx/configs/stm3210e-eval/RIDE/bigfatstub.c
new file mode 100644
index 000000000..b9b51dd98
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/bigfatstub.c
@@ -0,0 +1,31 @@
+#include <stdint.h>
+#include <nuttx/irq.h>
+#include "up_internal.h"
+
+void os_start(void)
+{
+ up_lowputc('X');
+ up_lowputc('\n');
+ for (;;);
+}
+
+void up_assert_code(const uint8_t *filename, int lineno, int errorcode)
+{
+ up_lowputc('?');
+ up_lowputc('\n');
+ for (;;);
+}
+
+int irq_attach(int irq, xcpt_t isr)
+{
+ up_lowputc('A');
+ up_lowputc('\n');
+ for (;;);
+}
+
+uint32_t *up_doirq(int irq, uint32_t *regs)
+{
+ up_lowputc('I');
+ up_lowputc('\n');
+ for (;;);
+} \ No newline at end of file
diff --git a/nuttx/configs/stm3210e-eval/RIDE/defconfig b/nuttx/configs/stm3210e-eval/RIDE/defconfig
new file mode 100755
index 000000000..dd0a89ecc
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/defconfig
@@ -0,0 +1,470 @@
+############################################################################
+# configs/stm3210e-eval/RIDE/defconfig
+#
+# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=y
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+#CONFIG_USER_ENTRYPOINT=
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=y
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.ctx b/nuttx/configs/stm3210e-eval/RIDE/nuttx.ctx
new file mode 100755
index 000000000..eaa41d318
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.ctx
@@ -0,0 +1,40 @@
+
+<Debug>
+ <FindStrings/>
+ <ReplaceStrings/>
+ <nuttx>
+ <CodeView TopRow="134220190" Focus="4294967295" />
+ <CodeView TopRow="134220190" Focus="4294967295" />
+
+ </nuttx>
+ <Flags>
+ <Report>
+ <Def Header="FlagReport" NbCol="8" >
+ <Col Type="PT_BOOL" Header="Check" sizeCache="18" AutoSize="0" Edit="1" Sortable="1" Icon="C:\Program Files\Raisonance\Ride\config\resources\check.bmp" />
+ <Col Type="PT_STRING" Header="Kind" sizeCache="DDDDDDDDDDD" AutoSize="1" Edit="0" Sortable="1" />
+ <Col Type="PT_STRING" Header="KindID" sizeCache="DD" AutoSize="1" Edit="0" Sortable="1" Visible="0" />
+ <Col Type="PT_STRING" Header="Space" sizeCache="DDDDDD" AutoSize="1" Edit="0" Sortable="1" />
+ <Col Type="PT_STRING" Header="SpaceID" sizeCache="DD" AutoSize="0" Edit="0" Sortable="0" Visible="0" />
+ <Col Type="PT_STRING" Header="Condition" sizeCache="DDDDDDDDDDDDDDDDDDDDDDDD" AutoSize="1" Edit="0" Sortable="0" />
+ <Col Type="PT_STRING" Header="Line" sizeCache="DDDDDD" AutoSize="1" Edit="0" Sortable="1" Visible="1" />
+ <Col Type="PT_STRING" Header="Path" sizeCache="DDDDDDDDDDDDDDDDDDDD" AutoSize="1" Edit="0" Sortable="1" Visible="1" />
+
+ </Def>
+ <Rows>
+ <Row Check="True" Kind="Breakpoint" KindID="0" Space="code" SpaceID="0" Condition="" Line="L:148" Path="C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\stm32\stm32_start.c" />
+
+ </Rows>
+
+ </Report>
+
+ </Flags>
+ <Views/>
+</Debug>AutoSize="1" Edit="0" Sortable="1" Visible="1" />
+ <Col Type="PT_STRING" Header="Path" sizeCache="DDDDDDDDDDDDDDDDDDDD" AutoSize="1" Edit="0" Sortable="1" Visible="1" />
+ </Def>
+ <Rows>
+ <Row Check="True" Kind="Breakpoint" KindID="0" Space="code" SpaceID="0" Condition="" Line="L:148" Path="C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\stm32\stm32_start.c" />
+ </Rows>
+ </Report>
+ </Flags>
+</Debug> \ No newline at end of file
diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.dbi b/nuttx/configs/stm3210e-eval/RIDE/nuttx.dbi
new file mode 100755
index 000000000..51748d1b0
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.dbi
@@ -0,0 +1,23 @@
+[Application]
+ApplicationPath=C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\nuttx.elf
+CSX=0
+HighBankAddr=400000
+BootMode=0
+Format=ELF
+CodeOffset=0x0
+DataOffset=0x0
+LoaderTool=ARM
+Target=ARM
+DebugTool=RLINK_CORTEX
+ApplicationComponents=
+[Device]
+Name=STM32F101VET6
+[ARMSigDrv options]
+CXS=0
+[Debug]
+Explore=No
+Startup=1
+StartupSymb=main
+ToolName=RLINK_CORTEX
+[SimFile]
+path=C:\Program Files\Raisonance\Ride\sim\ARM\STM32F101VET6.sim
diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.elf.ld b/nuttx/configs/stm3210e-eval/RIDE/nuttx.elf.ld
new file mode 100755
index 000000000..f4d3a6ca1
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.elf.ld
@@ -0,0 +1,19 @@
+
+SEARCH_DIR(".")
+SEARCH_DIR("C:\Program Files\Raisonance\Ride\Lib\ARM")
+STARTUP("C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\stm32_vectors.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32_gpio.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32_irq.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32_lowputc.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32_rcc.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32_serial.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32_start.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\bigfatstub.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\up_svcall.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\up_hardfault.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\up_leds.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\up_boot.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\irq_unexpectedisr.o")
+INPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\lib_memcpy.o")
+OUTPUT("C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\nuttx.elf")
+INCLUDE "C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32-nuttx.ld"
diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.rapp b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rapp
new file mode 100755
index 000000000..4ab167792
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rapp
@@ -0,0 +1,83 @@
+
+<ApplicationBuild Header="nuttx" Extern=".\nuttx.rapp" Path=".\nuttx.rapp" OutputFile=".\nuttx.elf" sate="98" >
+ <NodeC Path="..\..\..\arch\arm\src\stm32\stm32_gpio.c" Header="stm32_gpio.c" Marker="-1" OutputFile=".\stm32_gpio.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\stm32\stm32_irq.c" Header="stm32_irq.c" Marker="-1" OutputFile=".\stm32_irq.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\stm32\stm32_lowputc.c" Header="stm32_lowputc.c" Marker="-1" OutputFile=".\stm32_lowputc.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\stm32\stm32_rcc.c" Header="stm32_rcc.c" Marker="-1" OutputFile=".\stm32_rcc.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\stm32\stm32_serial.c" Header="stm32_serial.c" Marker="-1" OutputFile=".\stm32_serial.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\stm32\stm32_start.c" Header="stm32_start.c" Marker="-1" OutputFile=".\stm32_start.o" sate="0" />
+ <NodeC Path=".\bigfatstub.c" Header="bigfatstub.c" Marker="-1" OutputFile=".\bigfatstub.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\armv7-m\up_svcall.c" Header="up_svcall.c" Marker="-1" OutputFile=".\up_svcall.o" sate="0" />
+ <NodeC Path="..\..\..\arch\arm\src\armv7-m\up_hardfault.c" Header="up_hardfault.c" Marker="-1" OutputFile=".\up_hardfault.o" sate="0" />
+ <NodeC Path="..\src\up_leds.c" Header="up_leds.c" Marker="-1" OutputFile=".\up_leds.o" sate="0" />
+ <NodeC Path="..\src\up_boot.c" Header="up_boot.c" Marker="-1" OutputFile=".\up_boot.o" sate="0" />
+ <NodeC Path="..\..\..\sched\irq_unexpectedisr.c" Header="irq_unexpectedisr.c" Marker="-1" OutputFile=".\irq_unexpectedisr.o" sate="0" />
+ <NodeC Path="..\..\..\lib\lib_memcpy.c" Header="lib_memcpy.c" Marker="-1" OutputFile=".\lib_memcpy.o" sate="0" />
+ <Options>
+ <Config Header="Standard" >
+ <Set Header="ApplicationBuild" >
+ <Section Header="General" >
+ <Property Header="TargetFamily" Value="ARM" />
+
+ </Section>
+ <Section Header="Directories" >
+ <Property Header="IncDir" Value=".;C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\common;C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\armv7-m;C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\stm32;C:\cygwin\home\Owner\projects\nuttx\nuttx\include;C:\cygwin\home\Owner\projects\nuttx\nuttx\sched" Removable="1" />
+
+ </Section>
+
+ </Set>
+ <Set Header="Target" >
+ <Section Header="ProcessorARM" >
+ <Property Header="Processor" Value="STM32F101VET6" />
+
+ </Section>
+ <Section Header="ToolSetARM" >
+ <Property Header="BuildToolSetARM" Value="ARM\\GNU.config" Removable="1" />
+
+ </Section>
+
+ </Set>
+ <Set Header="AS" >
+ <Section Header="Options" >
+ <Property Header="More" Value="-D __ASSEMBLY__" />
+
+ </Section>
+
+ </Set>
+ <Set Header="LD" >
+ <Section Header="Startup" >
+ <Property Header="DEFAULTSTARTUP" Value="No" Removable="1" />
+ <Property Header="File" Value="C:\cygwin\home\Owner\projects\nuttx\nuttx\arch\arm\src\stm32_vectors.o" Removable="1" />
+
+ </Section>
+ <Section Header="More" >
+ <Property Header="More" Value="-nostdlib" />
+
+ </Section>
+ <Section Header="LIB" >
+ <Property Header="STLIB" Value="0" Removable="1" />
+ <Property Header="UART0PUTC" Value="0" Removable="1" />
+ <Property Header="SMALLP" Value="0" Removable="1" />
+
+ </Section>
+ <Section Header="Scripts" >
+ <Property Header="SCRIPTFILES" Value="No" Removable="1" />
+ <Property Header="File" Value="C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\stm32-nuttx.ld" Removable="1" />
+
+ </Section>
+ <Section Header="Linker" >
+ <Property Header="GC_SECTIONS" Value="" Removable="1" />
+
+ </Section>
+
+ </Set>
+ <Set Header="GCC" >
+ <Section Header="More" >
+ <Property Header="More" Value="-nostdinc" />
+
+ </Section>
+
+ </Set>
+ </Config>
+ </Options>
+</ApplicationBuild>
diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb
new file mode 100755
index 000000000..db83e52db
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rdb
Binary files differ
diff --git a/nuttx/configs/stm3210e-eval/RIDE/nuttx.rprj b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rprj
new file mode 100755
index 000000000..b366ffc08
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/nuttx.rprj
@@ -0,0 +1,4 @@
+
+<Project Header="Project 'nuttx'" Path=".\nuttx.rprj" Project="Yes" OutputFile="" sate="96" ActiveApp="nuttx" >
+ <ApplicationBuild Header="nuttx" Extern=".\nuttx.rapp" Path=".\nuttx.rapp" OutputFile=".\nuttx.elf" sate="98" />
+</Project> \ No newline at end of file
diff --git a/nuttx/configs/stm3210e-eval/RIDE/setenv.sh b/nuttx/configs/stm3210e-eval/RIDE/setenv.sh
new file mode 100755
index 000000000..b73411136
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/stm3210e-eval/RIDE/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/RIDE/stm32-ld.sh b/nuttx/configs/stm3210e-eval/RIDE/stm32-ld.sh
new file mode 100755
index 000000000..d9a8bf260
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/stm32-ld.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+GNUPATH="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+RIDEPATH="/cygdrive/c/Program Files/Raisonance/Ride/Bin"
+
+LD=arm-none-eabi-gcc.exe
+OBJCOPY=arm-none-eabi-objcopy.exe
+REXRDR=rexrdr.exe
+SIZE=arm-none-eabi-size.exe
+DWF2XML=dwf2xml.exe
+
+SCRIPT="C:\cygwin\home\Owner\projects\nuttx\nuttx\configs\stm3210e-eval\RIDE\nuttx.elf.ld"
+LDFLAGS="-mcpu=cortex-m3 -mthumb -u _start -Wl,-static -nostartfiles -Wl,--warn-once -nostdlib"
+
+${LD} ${LDFLAGS} -Wl,-T -Xlinker "${SCRIPT}"
+${OBJCOPY} nuttx.elf --target=ihex nuttx.hex
+${REXRDR} nuttx.elf.sizetmp 0 ${SIZE} nuttx.elf
+${DWF2XML} nuttx.dbi nuttx-globals.Standard.xml nuttx.Standard.xml ARM
diff --git a/nuttx/configs/stm3210e-eval/RIDE/stm32-nuttx.ld b/nuttx/configs/stm3210e-eval/RIDE/stm32-nuttx.ld
new file mode 100755
index 000000000..704960ad9
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/RIDE/stm32-nuttx.ld
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/stm3210e-eval/RIDE/stm32-nuttx.ld
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3210e-eval/buttons/Make.defs b/nuttx/configs/stm3210e-eval/buttons/Make.defs
new file mode 100644
index 000000000..f8d135853
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/buttons/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/buttons/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/buttons/appconfig b/nuttx/configs/stm3210e-eval/buttons/appconfig
new file mode 100644
index 000000000..a747036fe
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/buttons/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/buttons/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/buttons
+
diff --git a/nuttx/configs/stm3210e-eval/buttons/defconfig b/nuttx/configs/stm3210e-eval/buttons/defconfig
new file mode 100644
index 000000000..b355f4067
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/buttons/defconfig
@@ -0,0 +1,497 @@
+############################################################################
+# configs/stm3210e-eval/buttons/defconfig
+#
+# Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="buttons_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=7
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=7
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=2
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="WAKEUP"
+CONFIG_EXAMPLE_BUTTONS_NAME1="TAMPER"
+CONFIG_EXAMPLE_BUTTONS_NAME2="KEY"
+CONFIG_EXAMPLE_BUTTONS_NAME3="SELECT"
+CONFIG_EXAMPLE_BUTTONS_NAME4="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME5="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME6="RIGHT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="UP"
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/buttons/setenv.sh b/nuttx/configs/stm3210e-eval/buttons/setenv.sh
new file mode 100755
index 000000000..2bdf53674
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/buttons/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/stm3210e-eval/buttons/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/composite/Make.defs b/nuttx/configs/stm3210e-eval/composite/Make.defs
new file mode 100644
index 000000000..8c768324c
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/composite/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/composite/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/composite/appconfig b/nuttx/configs/stm3210e-eval/composite/appconfig
new file mode 100644
index 000000000..0219ca40b
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/composite/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/composite/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/composite
+
diff --git a/nuttx/configs/stm3210e-eval/composite/defconfig b/nuttx/configs/stm3210e-eval/composite/defconfig
new file mode 100755
index 000000000..2a76e5caf
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/composite/defconfig
@@ -0,0 +1,562 @@
+############################################################################
+# configs/stm3210e-eval/composite/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="conn_main"
+#CONFIG_USER_ENTRYPOINT="disconn_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=30
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_COMPOSITE=y
+CONFIG_USBMSC_IFNOBASE=2
+CONFIG_USBMSC_STRBASE=4
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=4
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=y
+CONFIG_CDCACM_COMPOSITE=y
+CONFIG_CDCACM_IFNOBASE=0
+CONFIG_CDCACM_STRBASE=4
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Composite Device Configuration
+#
+CONFIG_USBDEV_COMPOSITE=y
+CONFIG_COMPOSITE_IAD=y
+#CONFIG_COMPOSITE_EP0MAXPACKET
+CONFIG_COMPOSITE_VENDORID=0x03eb
+CONFIG_COMPOSITE_PRODUCTID=0x2022
+CONFIG_COMPOSITE_VENDORSTR="NuttX"
+CONFIG_COMPOSITE_PRODUCTSTR="Composite Device"
+CONFIG_COMPOSITE_SERIALSTR="12345"
+CONFIG_COMPOSITE_CONFIGSTR="examples/composite"
+CONFIG_COMPOSITE_VERSIONNO=0x0101
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/composite
+#
+CONFIG_EXAMPLES_COMPOSITE_DEBUGMM=n
+CONFIG_EXAMPLES_COMPOSITE_NLUNS=1
+CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1=0
+CONFIG_EXAMPLES_COMPOSITE_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_COMPOSITE_TTYUSB=0
+CONFIG_EXAMPLES_COMPOSITE_SERDEV="/dev/ttyUSB0"
+CONFIG_EXAMPLES_COMPOSITE_BUFSIZE=256
+CONFIG_EXAMPLES_COMPOSITE_TRACEINIT=n
+CONFIG_EXAMPLES_COMPOSITE_TRACECLASS=n
+CONFIG_EXAMPLES_COMPOSITE_TRACETRANSFERS=n
+CONFIG_EXAMPLES_COMPOSITE_TRACECONTROLLER=n
+CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/composite/setenv.sh b/nuttx/configs/stm3210e-eval/composite/setenv.sh
new file mode 100755
index 000000000..ce267428b
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/composite/setenv.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# configs/stm3210e-eval/composite/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/include/README.txt b/nuttx/configs/stm3210e-eval/include/README.txt
new file mode 100644
index 000000000..e4c44b8f6
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the STMicro STM3210E-EVAL development board.
diff --git a/nuttx/configs/stm3210e-eval/include/board.h b/nuttx/configs/stm3210e-eval/include/board.h
new file mode 100644
index 000000000..8a479a7e5
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/include/board.h
@@ -0,0 +1,323 @@
+/************************************************************************************
+ * configs/stm3210e-eval/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* On-board crystal frequency is 8MHz (HSE) */
+
+#define STM32_BOARD_XTAL 8000000ul
+
+/* PLL source is HSE/1, PLL multipler is 9: PLL frequency is 8MHz (XTAL) x 9 = 72MHz */
+
+#define STM32_CFGR_PLLSRC RCC_CFGR_PLLSRC
+#define STM32_CFGR_PLLXTPRE 0
+#define STM32_CFGR_PLLMUL RCC_CFGR_PLLMUL_CLKx9
+#define STM32_PLL_FREQUENCY (9*STM32_BOARD_XTAL)
+
+/* Use the PLL and set the SYSCLK source to be the PLL */
+
+#define STM32_SYSCLK_SW RCC_CFGR_SW_PLL
+#define STM32_SYSCLK_SWS RCC_CFGR_SWS_PLL
+#define STM32_SYSCLK_FREQUENCY STM32_PLL_FREQUENCY
+
+/* AHB clock (HCLK) is SYSCLK (72MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
+#define STM32_HCLK_FREQUENCY STM32_PLL_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB2 clock (PCLK2) is HCLK (72MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
+#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_APB2_CLKIN (STM32_PCLK2_FREQUENCY) /* Timers 2-7, 12-14 */
+
+/* APB2 timers 1 and 8 will receive PCLK2. */
+
+#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
+
+/* APB1 clock (PCLK1) is HCLK/2 (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd2
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB1 timers 2-4 will be twice PCLK1 (I presume the remaining will receive PCLK1) */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
+
+/* USB divider -- Divide PLL clock by 1.5 */
+
+#define STM32_CFGR_USBPRE 0
+
+/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
+ * otherwise frequency is 2xAPBx.
+ * Note: TIM1,8 are on APB2, others on APB1 */
+
+#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode. These values have not been
+ * tuned!!!
+ *
+ * HCLK=72MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(178+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (178 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_MMCXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_SDXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* SRAM definitions *****************************************************************/
+/* The 8 Mbit SRAM is provided on the PT3 board using the FSMC_NE3 chip select. */
+
+/* This is the Bank1 SRAM3 address: */
+
+#define BOARD_SRAM_BASE 0x68000000 /* Bank2 SRAM3 base address */
+#define BOARD_SRAM_SIZE (1*1024*1024) /* 8-Mbit = 1-Mbyte */
+
+/* LED definitions ******************************************************************/
+
+/* The STM3210E-EVAL board has 4 LEDs that we will encode as: */
+
+#define LED_STARTED 0 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED2 */
+#define LED_IRQSENABLED 2 /* LED1 + LED2 */
+#define LED_STACKCREATED 3 /* LED3 */
+#define LED_INIRQ 4 /* LED1 + LED3 */
+#define LED_SIGNAL 5 /* LED2 + LED3 */
+#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
+#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+
+/* The STM3210E-EVAL supports several buttons
+ *
+ * Reset -- Connected to NRST
+ * Wakeup -- Connected to PA.0
+ * Tamper -- Connected to PC.13
+ * Key -- Connected to PG.8
+ *
+ * And a Joystick
+ *
+ * Joystick center -- Connected to PG.7
+ * Joystick down -- Connected to PD.3
+ * Joystick left -- Connected to PG.14
+ * Joystick right -- Connected to PG.13
+ * Joystick up -- Connected to PG.15
+ */
+
+#define BUTTON_WAKEUP 0
+#define BUTTON_TAMPER 1
+#define BUTTON_KEY 2
+
+#define JOYSTICK_SEL 3
+#define JOYSTICK_DOWN 4
+#define JOYSTICK_LEFT 5
+#define JOYSTICK_RIGHT 6
+#define JOYSTICK_UP 7
+
+#define NUM_BUTTONS 8
+
+#define BUTTON_WAKEUP_BIT (1 << BUTTON_WAKEUP)
+#define BUTTON_TAMPER_BIT (1 << BUTTON_TAMPER)
+#define BUTTON_KEY_BIT (1 << BUTTON_KEY)
+
+#define JOYSTICK_SEL_BIT (1 << JOYSTICK_SEL)
+#define JOYSTICK_DOWN_BIT (1 << JOYSTICK_DOWN)
+#define JOYSTICK_LEFT_BIT (1 << JOYSTICK_LEFT)
+#define JOYSTICK_RIGHT_BIT (1 << JOYSTICK_RIGHT)
+#define JOYSTICK_UP_BIT (1 << JOYSTICK_UP)
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+/************************************************************************************
+ * Name: stm3210e_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the STM3210E-EVAL board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * dispaly is cleared by simply setting all GRAM memory to the specified color.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+EXTERN void stm3210e_lcdclear(uint16_t color);
+#endif
+
+/************************************************************************************
+ * Name: stm32_lm75initialize
+ *
+ * Description:
+ * Initialize and register the LM-75 Temperature Sensor driver.
+ *
+ * Input parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/temp0"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75) && defined(CONFIG_STM32_I2C1)
+EXTERN int stm32_lm75initialize(FAR const char *devpath);
+#endif
+
+/************************************************************************************
+ * Name: stm32_lm75attach
+ *
+ * Description:
+ * Attach the LM-75 interrupt handler
+ *
+ * Input parameters:
+ * irqhandler - the LM-75 interrupt handler
+ *
+ * Returned Value:
+ * The previous LM-75 interrupt handler
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75) && defined(CONFIG_STM32_I2C1)
+EXTERN xcpt_t stm32_lm75attach(xcpt_t irqhandler);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/stm3210e-eval/nsh/Make.defs b/nuttx/configs/stm3210e-eval/nsh/Make.defs
new file mode 100644
index 000000000..30e18eb8f
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/nsh/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/nsh/appconfig b/nuttx/configs/stm3210e-eval/nsh/appconfig
new file mode 100644
index 000000000..a3999a76a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/stm3210e-eval/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/stm3210e-eval/nsh/defconfig b/nuttx/configs/stm3210e-eval/nsh/defconfig
new file mode 100755
index 000000000..886b2aa07
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh/defconfig
@@ -0,0 +1,482 @@
+############################################################################
+# configs/stm3210e-eval/nsh/defconfig
+#
+# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=y
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/nsh/setenv.sh b/nuttx/configs/stm3210e-eval/nsh/setenv.sh
new file mode 100755
index 000000000..ee33a8d21
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/stm3210e-eval/dfu/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/nsh2/Make.defs b/nuttx/configs/stm3210e-eval/nsh2/Make.defs
new file mode 100644
index 000000000..2fdadbb03
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh2/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/nsh2/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/nsh2/appconfig b/nuttx/configs/stm3210e-eval/nsh2/appconfig
new file mode 100644
index 000000000..72fa5cd7e
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh2/appconfig
@@ -0,0 +1,63 @@
+############################################################################
+# configs/stm3210e-eval/nsh2/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# The NX and NXHELLO examples configured as an NX built-in commands
+# Various NX tests can be supported, simply comment-out examples/nx and
+# uncomment the test you wish to perform
+
+CONFIGURED_APPS += examples/nx
+CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nxlines
+#CONFIGURED_APPS += examples/nxtext
+CONFIGURED_APPS += examples/usbstorage
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
diff --git a/nuttx/configs/stm3210e-eval/nsh2/defconfig b/nuttx/configs/stm3210e-eval/nsh2/defconfig
new file mode 100644
index 000000000..3c0fb3d70
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh2/defconfig
@@ -0,0 +1,723 @@
+############################################################################
+# configs/stm3210e-eval/nsh2/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Alternate pin mappings
+#
+CONFIG_STM32_TIM1_FULL_REMAP=n
+CONFIG_STM32_TIM1_PARTIAL_REMAP=n
+CONFIG_STM32_TIM2_FULL_REMAP=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_1=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_2=n
+CONFIG_STM32_TIM3_FULL_REMAP=n
+CONFIG_STM32_TIM3_PARTIAL_REMAP=n
+CONFIG_STM32_TIM4_REMAP=n
+CONFIG_STM32_USART1_REMAP=n
+CONFIG_STM32_USART2_REMAP=n
+CONFIG_STM32_USART3_FULL_REMAP=n
+CONFIG_STM32_USART3_PARTIAL_REMAP=n
+CONFIG_STM32_SPI1_REMAP=n
+CONFIG_STM32_SPI3_REMAP=n
+CONFIG_STM32_I2C1_REMAP=n
+CONFIG_STM32_CAN1_REMAP1=y
+CONFIG_STM32_CAN1_REMAP2=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# STM32F10xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=y
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+# ISO-11783 requires the baud to be set to 250K
+CONFIG_CAN1_BAUD=250000
+# ISO-11783 requires the sample point to be within 75 to 80%
+CONFIG_CAN_TSEG1=12
+CONFIG_CAN_TSEG2=3
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_CAN=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=5
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_COMPOSITE=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_COMPOSITE=y
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_COMPOSITE=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=y
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3210E-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=n
+CONFIG_LCD_PWM=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=2
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/nsh2/setenv.sh b/nuttx/configs/stm3210e-eval/nsh2/setenv.sh
new file mode 100755
index 000000000..425acf89e
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nsh2/setenv.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# configs/stm3210e-eval/nsh2/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/nx/Make.defs b/nuttx/configs/stm3210e-eval/nx/Make.defs
new file mode 100644
index 000000000..7a8934d3c
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nx/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/nx/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/nx/appconfig b/nuttx/configs/stm3210e-eval/nx/appconfig
new file mode 100644
index 000000000..f3fe66a61
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nx/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/nx/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nx
+
diff --git a/nuttx/configs/stm3210e-eval/nx/defconfig b/nuttx/configs/stm3210e-eval/nx/defconfig
new file mode 100644
index 000000000..79a3fe7f9
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nx/defconfig
@@ -0,0 +1,602 @@
+############################################################################
+# configs/stm3210e-eval/nx/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nx_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=5
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3210E-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=n
+CONFIG_LCD_PWM=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/nx/setenv.sh b/nuttx/configs/stm3210e-eval/nx/setenv.sh
new file mode 100755
index 000000000..bf9fad443
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nx/setenv.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# configs/stm3210e-eval/nx/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/nxconsole/Make.defs b/nuttx/configs/stm3210e-eval/nxconsole/Make.defs
new file mode 100644
index 000000000..6d14a2378
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxconsole/Make.defs
@@ -0,0 +1,177 @@
+############################################################################
+# configs/stm3210e-eval/nxconsole/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/nxconsole/appconfig b/nuttx/configs/stm3210e-eval/nxconsole/appconfig
new file mode 100644
index 000000000..e17e7f8f2
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxconsole/appconfig
@@ -0,0 +1,55 @@
+############################################################################
+# configs/stm3210e-eval/nxconsole/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxconsole
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Optional built-in applications
+
+ifeq ($(CONFIG_USBDEV),y)
+CONFIGURED_APPS += examples/usbstorage
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
diff --git a/nuttx/configs/stm3210e-eval/nxconsole/defconfig b/nuttx/configs/stm3210e-eval/nxconsole/defconfig
new file mode 100644
index 000000000..243e4ad08
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxconsole/defconfig
@@ -0,0 +1,629 @@
+############################################################################
+# configs/stm3210e-eval/nxconsole/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=29
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=8
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=y
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=y
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3210E-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=y
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=n
+CONFIG_LCD_BACKLIGHT=n
+CONFIG_LCD_PWM=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxtext
+#
+CONFIG_EXAMPLES_NXTEXT_BUILTIN=n
+CONFIG_EXAMPLES_NXTEXT_VPLANE=0
+CONFIG_EXAMPLES_NXTEXT_DEVNO=0
+CONFIG_EXAMPLES_NXTEXT_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXTEXT_BGFONTID=11
+CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXTEXT_PUCOLOR=0xfd20
+CONFIG_EXAMPLES_NXTEXT_PUFONTID=1
+CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR=0x001f
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_NOGETRUN=y
+CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=n
+CONFIG_EXAMPLES_NXTEXT_BMCACHE=512
+CONFIG_EXAMPLES_NXTEXT_GLCACHE=16
+CONFIG_EXAMPLES_NXTEXT_STACKSIZE=2048
+CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO=80
+CONFIG_EXAMPLES_NXTEXT_SERVERPRIO=120
+CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/nxconsole/setenv.sh b/nuttx/configs/stm3210e-eval/nxconsole/setenv.sh
new file mode 100755
index 000000000..629770245
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxconsole/setenv.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# configs/stm3210e-eval/nxconsole/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/nxlines/Make.defs b/nuttx/configs/stm3210e-eval/nxlines/Make.defs
new file mode 100644
index 000000000..381418786
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxlines/Make.defs
@@ -0,0 +1,177 @@
+############################################################################
+# configs/stm3210e-eval/nxlines/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/nxlines/appconfig b/nuttx/configs/stm3210e-eval/nxlines/appconfig
new file mode 100644
index 000000000..c2fc508fa
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxlines/appconfig
@@ -0,0 +1,38 @@
+############################################################################
+# configs/stm3210e-eval/nxlines/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxlines
diff --git a/nuttx/configs/stm3210e-eval/nxlines/defconfig b/nuttx/configs/stm3210e-eval/nxlines/defconfig
new file mode 100644
index 000000000..bd2968e67
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxlines/defconfig
@@ -0,0 +1,626 @@
+############################################################################
+# configs/stm3210e-eval/nxlines/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=y
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxlines_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=y
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3210E-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=n
+CONFIG_LCD_PWM=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxtext
+#
+CONFIG_EXAMPLES_NXTEXT_BUILTIN=n
+CONFIG_EXAMPLES_NXTEXT_VPLANE=0
+CONFIG_EXAMPLES_NXTEXT_DEVNO=0
+CONFIG_EXAMPLES_NXTEXT_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXTEXT_BGFONTID=11
+CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXTEXT_PUCOLOR=0xfd20
+CONFIG_EXAMPLES_NXTEXT_PUFONTID=1
+CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR=0x001f
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_NOGETRUN=y
+CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=n
+CONFIG_EXAMPLES_NXTEXT_BMCACHE=512
+CONFIG_EXAMPLES_NXTEXT_GLCACHE=16
+CONFIG_EXAMPLES_NXTEXT_STACKSIZE=2048
+CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO=80
+CONFIG_EXAMPLES_NXTEXT_SERVERPRIO=120
+CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/nxlines/setenv.sh b/nuttx/configs/stm3210e-eval/nxlines/setenv.sh
new file mode 100755
index 000000000..a9dc78c74
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxlines/setenv.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# configs/stm3210e-eval/nxlines/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!"
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/nxtext/Make.defs b/nuttx/configs/stm3210e-eval/nxtext/Make.defs
new file mode 100644
index 000000000..30e630766
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxtext/Make.defs
@@ -0,0 +1,177 @@
+############################################################################
+# configs/stm3210e-eval/nxtext/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O1
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/nxtext/appconfig b/nuttx/configs/stm3210e-eval/nxtext/appconfig
new file mode 100644
index 000000000..acb27582a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxtext/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/nxtext/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxtext
+
diff --git a/nuttx/configs/stm3210e-eval/nxtext/defconfig b/nuttx/configs/stm3210e-eval/nxtext/defconfig
new file mode 100644
index 000000000..5d4b1f061
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxtext/defconfig
@@ -0,0 +1,626 @@
+############################################################################
+# configs/stm3210e-eval/nxtext/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxtext_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=y
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3210E-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=n
+CONFIG_LCD_PWM=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxtext
+#
+CONFIG_EXAMPLES_NXTEXT_BUILTIN=n
+CONFIG_EXAMPLES_NXTEXT_VPLANE=0
+CONFIG_EXAMPLES_NXTEXT_DEVNO=0
+CONFIG_EXAMPLES_NXTEXT_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXTEXT_BGFONTID=11
+CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXTEXT_PUCOLOR=0xfd20
+CONFIG_EXAMPLES_NXTEXT_PUFONTID=1
+CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR=0x001f
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_NOGETRUN=y
+CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=n
+CONFIG_EXAMPLES_NXTEXT_BMCACHE=512
+CONFIG_EXAMPLES_NXTEXT_GLCACHE=16
+CONFIG_EXAMPLES_NXTEXT_STACKSIZE=2048
+CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO=80
+CONFIG_EXAMPLES_NXTEXT_SERVERPRIO=120
+CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO=4
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/nxtext/setenv.sh b/nuttx/configs/stm3210e-eval/nxtext/setenv.sh
new file mode 100755
index 000000000..a36540cf1
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/nxtext/setenv.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# configs/stm3210e-eval/nxtext/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/ostest/Make.defs b/nuttx/configs/stm3210e-eval/ostest/Make.defs
new file mode 100644
index 000000000..ceabfc045
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/ostest/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/ostest/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/ostest/appconfig b/nuttx/configs/stm3210e-eval/ostest/appconfig
new file mode 100644
index 000000000..3f36a5c7f
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/stm3210e-eval/ostest/defconfig b/nuttx/configs/stm3210e-eval/ostest/defconfig
new file mode 100755
index 000000000..cabd5fa27
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/ostest/defconfig
@@ -0,0 +1,490 @@
+############################################################################
+# configs/stm3210e-eval/ostest/defconfig
+#
+# Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=y
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# STM32F103Z specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/ostest/setenv.sh b/nuttx/configs/stm3210e-eval/ostest/setenv.sh
new file mode 100755
index 000000000..046a7f5ac
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/ostest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/stm3210e-eval/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/pm/Make.defs b/nuttx/configs/stm3210e-eval/pm/Make.defs
new file mode 100644
index 000000000..354a4f47d
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/pm/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/pm/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/pm/appconfig b/nuttx/configs/stm3210e-eval/pm/appconfig
new file mode 100644
index 000000000..c5cf06b39
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/pm/appconfig
@@ -0,0 +1,63 @@
+############################################################################
+# configs/stm3210e-eval/pm/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# The NX and NXHELLO examples configured as an NX built-in commands
+# Various NX tests can be supported, simply comment-out examples/nx and
+# uncomment the test you wish to perform
+
+CONFIGURED_APPS += examples/nx
+CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nxlines
+#CONFIGURED_APPS += examples/nxtext
+CONFIGURED_APPS += examples/usbstorage
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
diff --git a/nuttx/configs/stm3210e-eval/pm/defconfig b/nuttx/configs/stm3210e-eval/pm/defconfig
new file mode 100644
index 000000000..73f7ae52a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/pm/defconfig
@@ -0,0 +1,768 @@
+############################################################################
+# configs/stm3210e-eval/pm/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Alternate pin mappings
+#
+CONFIG_STM32_TIM1_FULL_REMAP=n
+CONFIG_STM32_TIM1_PARTIAL_REMAP=n
+CONFIG_STM32_TIM2_FULL_REMAP=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_1=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_2=n
+CONFIG_STM32_TIM3_FULL_REMAP=n
+CONFIG_STM32_TIM3_PARTIAL_REMAP=n
+CONFIG_STM32_TIM4_REMAP=n
+CONFIG_STM32_USART1_REMAP=n
+CONFIG_STM32_USART2_REMAP=n
+CONFIG_STM32_USART3_FULL_REMAP=n
+CONFIG_STM32_USART3_PARTIAL_REMAP=n
+CONFIG_STM32_SPI1_REMAP=n
+CONFIG_STM32_SPI3_REMAP=n
+CONFIG_STM32_I2C1_REMAP=n
+CONFIG_STM32_CAN1_REMAP1=y
+CONFIG_STM32_CAN1_REMAP2=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=y
+CONFIG_STM32_PWR=y
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=y
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# RTC
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=n
+CONFIG_RTC_HIRES=y
+CONFIG_RTC_FREQUENCY=16384
+CONFIG_RTC_ALARM=y
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# STM32F10xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=y
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+# ISO-11783 requires the baud to be set to 250K
+CONFIG_CAN1_BAUD=250000
+# ISO-11783 requires the sample point to be within 75 to 80%
+CONFIG_CAN_TSEG1=12
+CONFIG_CAN_TSEG2=3
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_CAN=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=5
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# General Power Management Configuration
+# (see include/nuttx/power/pm.h for many more standard configuration options)
+#
+CONFIG_PM=y
+CONFIG_PM_CUSTOMINIT=y
+CONFIG_IDLE_CUSTOM=y
+CONFIG_PM_SLEEP_WAKEUP=n
+
+#
+# Board/Application-Specific Power Management Configuration.
+# These settings are probably not meaningful outside of this configuration
+#
+# Button support can be built into the configs/stm3210e-eval/pm configuration
+# to support PM testing. These would not be part of a normal, operational
+# configuration.
+#
+CONFIG_PM_BUTTONS=y
+CONFIG_PM_IRQBUTTONS_MIN=0
+CONFIG_PM_IRQBUTTONS_MAX=7
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=y
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_COMPOSITE=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_COMPOSITE=y
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_COMPOSITE=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=100
+CONFIG_LCD_MAXCONTRAST=100
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=y
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3210E-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=y
+CONFIG_LCD_PWM=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
+CONFIG_EXAMPLE_BUTTONS_NAME0="WAKEUP"
+CONFIG_EXAMPLE_BUTTONS_NAME1="TAMPER"
+CONFIG_EXAMPLE_BUTTONS_NAME2="KEY"
+CONFIG_EXAMPLE_BUTTONS_NAME3="SELECT"
+CONFIG_EXAMPLE_BUTTONS_NAME4="DOWN"
+CONFIG_EXAMPLE_BUTTONS_NAME5="LEFT"
+CONFIG_EXAMPLE_BUTTONS_NAME6="RIGHT"
+CONFIG_EXAMPLE_BUTTONS_NAME7="UP"
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=2
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/pm/setenv.sh b/nuttx/configs/stm3210e-eval/pm/setenv.sh
new file mode 100755
index 000000000..5a02de258
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/pm/setenv.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# configs/stm3210e-eval/pm/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/scripts/ld.script b/nuttx/configs/stm3210e-eval/scripts/ld.script
new file mode 100644
index 000000000..5504f0f61
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/scripts/ld.script
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/stm3210e-eval/scripts/ld.script
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3210e-eval/scripts/ld.script.dfu b/nuttx/configs/stm3210e-eval/scripts/ld.script.dfu
new file mode 100644
index 000000000..8f879983a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/scripts/ld.script.dfu
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/stm3210e-eval/scripts/ld.script.dfu
+ *
+ * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * STM3210E-EVAL's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } >sram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3210e-eval/src/Makefile b/nuttx/configs/stm3210e-eval/src/Makefile
new file mode 100644
index 000000000..871d01ff1
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/Makefile
@@ -0,0 +1,131 @@
+############################################################################
+# configs/stm3210e-eval/src/Makefile
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_leds.c up_buttons.c up_spi.c up_usbdev.c
+
+ifeq ($(CONFIG_STM32_FSMC),y)
+CSRCS += up_lcd.c up_extcontext.c up_extmem.c up_selectnor.c \
+ up_deselectnor.c up_selectsram.c up_deselectsram.c \
+ up_selectlcd.c up_deselectlcd.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_ADC),y)
+CSRCS += up_adc.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
+CSRCS += up_composite.c
+endif
+
+ifeq ($(CONFIG_I2C_LM75),y)
+CSRCS += up_lm75.c
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CSRCS += up_can.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+ifeq ($(CONFIG_PM_CUSTOMINIT),y)
+CSRCS += up_pm.c
+endif
+
+ifeq ($(CONFIG_PM_BUTTONS),y)
+CSRCS += up_pmbuttons.c
+endif
+
+ifeq ($(CONFIG_IDLE_CUSTOM),y)
+CSRCS += up_idle.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/stm3210e-eval/src/README.txt b/nuttx/configs/stm3210e-eval/src/README.txt
new file mode 100644
index 000000000..d4eda82fd
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the STMicro STM3210E-EVAL development board.
diff --git a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
new file mode 100644
index 000000000..33a8750f9
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
@@ -0,0 +1,322 @@
+/************************************************************************************
+ * configs/stm3210e_eval/src/stm3210e_internal.h
+ * arch/arm/src/board/stm3210e_internal.n
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_STM3210E_EVAL_SRC_STM3210E_INTERNAL_H
+#define __CONFIGS_STM3210E_EVAL_SRC_STM3210E_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SPI modules does this chip support? Most support 2 SPI modules (others
+ * may support more -- in such case, the following must be expanded).
+ */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+#endif
+
+/* There is only CAN1 on the STM3210E-EVAL board */
+
+#if defined(CONFIG_STM32_CAN2)
+# warning "The STM3210E-EVAL only supports CAN1"
+#endif
+
+/* STM3210E-EVAL GPIOs **************************************************************/
+/* LEDs */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN6)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN7)
+#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN8)
+#define GPIO_LED4 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN9)
+
+/* BUTTONS -- NOTE that some have EXTI interrupts configured */
+
+#define MIN_IRQBUTTON BUTTON_KEY
+#define MAX_IRQBUTTON JOYSTICK_UP
+#define NUM_IRQBUTTONS (JOYSTICK_UP - BUTTON_KEY + 1)
+
+#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTA|GPIO_PIN0)
+#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTC|GPIO_PIN13)
+#define GPIO_BTN_KEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN8)
+#define GPIO_JOY_SEL (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN7)
+#define GPIO_JOY_DOWN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTD|GPIO_PIN3)
+#define GPIO_JOY_LEFT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN14)
+#define GPIO_JOY_RIGHT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN13)
+#define GPIO_JOY_UP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN15)
+
+/* SPI FLASH chip select: PA.4 */
+
+#define GPIO_FLASH_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN2)
+
+/* Backlight control: PA.8
+ *
+ * If CONFIG_LCD_TIM1 (and CONFIG_STM32_TIM1) is defined, PA.8 will be
+ * configured as CH1OUT for variable backlight control. Otherwise, the
+ * following definition will be used to support a discrete backlight control.
+ */
+
+#define GPIO_LCD_BACKLIGHT (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN8)
+
+/* USB Soft Connect Pullup: PB.14 */
+
+#define GPIO_USB_PULLUP (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN14)
+
+/* LM-75 Temperature Sensor: PB.5 */
+
+#define GPIO_LM75_OSINT (GPIO_INPUT|GPIO_CNF_INPULLUP|GPIO_MODE_10MHz|\
+ GPIO_EXTI|GPIO_PORTB|GPIO_PIN5)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/* GPIO settings that will be altered when external memory is selected */
+
+struct extmem_save_s
+{
+ uint32_t gpiod_crl;
+ uint32_t gpiod_crh;
+ uint32_t gpioe_crl;
+ uint32_t gpioe_crh;
+ uint32_t gpiof_crl;
+ uint32_t gpiof_crh;
+ uint32_t gpiog_crl;
+ uint32_t gpiog_crh;
+};
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/* GPIO configurations common to SRAM and NOR Flash */
+
+#define NCOMMON_CONFIG 37
+extern const uint16_t g_commonconfig[NCOMMON_CONFIG];
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the STM3210E-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_usbinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_extcontextsave
+ *
+ * Description:
+ * Save current GPIOs that will used by external memory configurations
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extcontextsave(struct extmem_save_s *save);
+
+/************************************************************************************
+ * Name: stm32_extcontextrestore
+ *
+ * Description:
+ * Restore GPIOs that were used by external memory configurations
+ *
+ ************************************************************************************/
+
+void stm32_extcontextrestore(struct extmem_save_s *restore);
+
+/************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for NOR or SRAM
+ *
+ ************************************************************************************/
+
+void stm32_extmemgpios(const uint16_t *gpios, int ngpios);
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_enablefsmc(void);
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_disablefsmc(void);
+
+/************************************************************************************
+ * Name: stm32_selectnor
+ *
+ * Description:
+ * Initialize to access NOR flash
+ *
+ ************************************************************************************/
+
+void stm32_selectnor(void);
+
+/************************************************************************************
+ * Name: stm32_deselectnor
+ *
+ * Description:
+ * Disable NOR FLASH
+ *
+ ************************************************************************************/
+
+void stm32_deselectnor(void);
+
+/************************************************************************************
+ * Name: stm32_selectsram
+ *
+ * Description:
+ * Initialize to access external SRAM
+ *
+ ************************************************************************************/
+
+void stm32_selectsram(void);
+
+/************************************************************************************
+ * Name: stm32_deselectsram
+ *
+ * Description:
+ * Disable external SRAM
+ *
+ ************************************************************************************/
+
+void stm32_deselectsram(void);
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+void stm32_selectlcd(void);
+
+/************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ************************************************************************************/
+
+void stm32_deselectlcd(void);
+
+#endif /* CONFIG_STM32_FSMC */
+
+/************************************************************************************
+ * Name: up_ledpminitialize
+ *
+ * Description:
+ * Register the LEDs to receive power management event callbacks
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_ARCH_LEDS)
+void up_ledpminitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: up_pmbuttons
+ *
+ * Description:
+ * Configure all the buttons of the STM3210e-eval board as EXTI, so any button is
+ * able to wakeup the MCU from the PM_STANDBY mode
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
+void up_pmbuttons(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_STM3210E_EVAL_SRC_STM3210E_INTERNAL_H */
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_adc.c b/nuttx/configs/stm3210e-eval/src/up_adc.c
new file mode 100644
index 000000000..c7c7e0c0a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_adc.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_adc.c
+ * arch/arm/src/board/up_adc.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/analog/adc.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_pwm.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_ADC
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+/* Up to 3 ADC interfaces are supported */
+
+#if STM32_NADC < 3
+# undef CONFIG_STM32_ADC3
+#endif
+
+#if STM32_NADC < 2
+# undef CONFIG_STM32_ADC2
+#endif
+
+#if STM32_NADC < 1
+# undef CONFIG_STM32_ADC1
+#endif
+
+#if defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2) || defined(CONFIG_STM32_ADC3)
+#ifndef CONFIG_STM32_ADC1
+# warning "Channel information only available for ADC1"
+#endif
+
+/* The number of ADC channels in the conversion list */
+
+#define ADC1_NCHANNELS 1
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* Identifying number of each ADC channel: Variable Resistor */
+
+#ifdef CONFIG_STM32_ADC1
+static const uint8_t g_chanlist[ADC1_NCHANNELS] = {14};
+
+/* Configurations of pins used byte each ADC channels */
+
+static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN14};
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: adc_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/adc.
+ *
+ ************************************************************************************/
+
+int adc_devinit(void)
+{
+#ifdef CONFIG_STM32_ADC1
+ static bool initialized = false;
+ struct adc_dev_s *adc;
+ int ret;
+ int i;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Configure the pins as analog inputs for the selected channels */
+
+ for (i = 0; i < ADC1_NCHANNELS; i++)
+ {
+ stm32_configgpio(g_pinlist[i]);
+ }
+
+ /* Call stm32_adcinitialize() to get an instance of the ADC interface */
+
+ adc = stm32_adcinitialize(1, g_chanlist, ADC1_NCHANNELS);
+ if (adc == NULL)
+ {
+ adbg("ERROR: Failed to get ADC interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the ADC driver at "/dev/adc0" */
+
+ ret = adc_register("/dev/adc0", adc);
+ if (ret < 0)
+ {
+ adbg("adc_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+#else
+ return -ENOSYS;
+#endif
+}
+
+#endif /* CONFIG_STM32_ADC1 || CONFIG_STM32_ADC2 || CONFIG_STM32_ADC3 */
+#endif /* CONFIG_ADC */
diff --git a/nuttx/configs/stm3210e-eval/src/up_boot.c b/nuttx/configs/stm3210e-eval/src/up_boot.c
new file mode 100644
index 000000000..576094c5e
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_boot.c
@@ -0,0 +1,108 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm3210e-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* If the FSMC and FSMC_SRAM are selected, then enable SRAM access */
+
+#if defined(CONFIG_STM32_FSMC) && defined(CONFIG_STM32_FSMC_SRAM)
+ stm32_selectsram();
+#endif
+
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/stm3210e-eval/src/up_buttons.c b/nuttx/configs/stm3210e-eval/src/up_buttons.c
new file mode 100644
index 000000000..4f884649c
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_buttons.c
@@ -0,0 +1,170 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_buttons.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
+ * the BUTTON_* and JOYSTICK_* definitions in board.h
+ */
+
+static const uint16_t g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_KEY, GPIO_JOY_SEL,
+ GPIO_JOY_DOWN, GPIO_JOY_LEFT, GPIO_JOY_RIGHT, GPIO_JOY_UP
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for some pins but NOT used in this file
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed for most keys. The exception
+ * is the WAKEUP button.
+ */
+
+ bool released = stm32_gpioread(g_buttons[i]);
+ if (i == BUTTON_WAKEUP)
+ {
+ released = !released;
+ }
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ /* The following should be atomic */
+
+ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
+ {
+ oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/stm3210e-eval/src/up_can.c b/nuttx/configs/stm3210e-eval/src/up_can.c
new file mode 100644
index 000000000..7ca712daf
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_can.c
@@ -0,0 +1,134 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_can.c
+ * arch/arm/src/board/up_can.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/can.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm32_can.h"
+#include "stm3210e-internal.h"
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1)
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+/* The STM32F103ZE supports only CAN1 */
+
+#define CAN_PORT 1
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: can_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/can.
+ *
+ ************************************************************************************/
+
+int can_devinit(void)
+{
+ static bool initialized = false;
+ struct can_dev_s *can;
+ int ret;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Call stm32_caninitialize() to get an instance of the CAN interface */
+
+ can = stm32_caninitialize(CAN_PORT);
+ if (can == NULL)
+ {
+ candbg("ERROR: Failed to get CAN interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the CAN driver at "/dev/can0" */
+
+ ret = can_register("/dev/can0", can);
+ if (ret < 0)
+ {
+ candbg("ERROR: can_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_CAN && CONFIG_STM32_CAN1 */
diff --git a/nuttx/configs/stm3210e-eval/src/up_composite.c b/nuttx/configs/stm3210e-eval/src/up_composite.c
new file mode 100644
index 000000000..e80e0fcb4
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_composite.c
@@ -0,0 +1,163 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_composite.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+#include <nuttx/usb/composite.h>
+
+#include "stm32_internal.h"
+
+/* There is nothing to do here if SDIO support is not selected. */
+
+#ifdef CONFIG_STM32_SDIO
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1
+# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_STM3210E_EVAL
+# undef STM32_MMCSDSLOTNO
+# define STM32_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new STM32 boards here */
+# error "Unrecognized STM32 board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: composite_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int composite_archinitialize(void)
+{
+ /* If examples/composite is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ *
+ * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH
+ * was built.
+ */
+
+#ifndef CONFIG_NSH_BUILTIN_APPS
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("composite_archinitialize: Initializing SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+
+ sdio = sdio_initialize(STM32_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("composite_archinitialize: Failed to initialize SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ message("composite_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1);
+
+ ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1, sdio);
+ if (ret != OK)
+ {
+ message("composite_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n",
+ ret);
+ return ret;
+ }
+ message("composite_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+
+#endif /* CONFIG_NSH_BUILTIN_APPS */
+
+ return OK;
+}
+
+#endif /* CONFIG_STM32_SDIO */
diff --git a/nuttx/configs/stm3210e-eval/src/up_deselectlcd.c b/nuttx/configs/stm3210e-eval/src/up_deselectlcd.c
new file mode 100644
index 000000000..e8642c2e0
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_deselectlcd.c
@@ -0,0 +1,97 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_deselectlcd.c
+ * arch/arm/src/board/up_deselectlcd.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ************************************************************************************/
+
+void stm32_deselectlcd(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(0xffffffff, STM32_FSMC_BCR4);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(0x0fffffff, STM32_FSMC_BTR4);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_deselectnor.c b/nuttx/configs/stm3210e-eval/src/up_deselectnor.c
new file mode 100644
index 000000000..135977023
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_deselectnor.c
@@ -0,0 +1,95 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_deselectnor.c
+ * arch/arm/src/board/up_deselectnor.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectnor
+ *
+ * Description:
+ * Disable NOR FLASH
+ *
+ ************************************************************************************/
+
+void stm32_deselectnor(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(0x000030d2, STM32_FSMC_BCR2);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(0x0fffffff, STM32_FSMC_BTR2);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_deselectsram.c b/nuttx/configs/stm3210e-eval/src/up_deselectsram.c
new file mode 100644
index 000000000..442524d80
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_deselectsram.c
@@ -0,0 +1,97 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_deselectsram.c
+ * arch/arm/src/board/up_deselectsram.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectsram
+ *
+ * Description:
+ * Disable NOR FLASH
+ *
+ ************************************************************************************/
+
+void stm32_deselectsram(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(0x000030d2, STM32_FSMC_BCR3);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(0x0fffffff, STM32_FSMC_BTR3);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_extcontext.c b/nuttx/configs/stm3210e-eval/src/up_extcontext.c
new file mode 100644
index 000000000..07a202f06
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_extcontext.c
@@ -0,0 +1,117 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_extcontext.c
+ * arch/arm/src/board/up_extcontext.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <assert.h>
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_extcontextsave
+ *
+ * Description:
+ * Save current GPIOs that will used by external memory configurations
+ *
+ ************************************************************************************/
+
+void stm32_extcontextsave(struct extmem_save_s *save)
+{
+ DEBUGASSERT(save != NULL);
+ save->gpiod_crl = getreg32(STM32_GPIOE_CRL);
+ save->gpiod_crh = getreg32(STM32_GPIOE_CRH);
+ save->gpioe_crl = getreg32(STM32_GPIOD_CRL);
+ save->gpioe_crh = getreg32(STM32_GPIOD_CRH);
+ save->gpiof_crl = getreg32(STM32_GPIOF_CRL);
+ save->gpiof_crh = getreg32(STM32_GPIOF_CRH);
+ save->gpiog_crl = getreg32(STM32_GPIOG_CRL);
+ save->gpiog_crh = getreg32(STM32_GPIOG_CRH);
+}
+
+/************************************************************************************
+ * Name: stm32_extcontextrestore
+ *
+ * Description:
+ * Restore GPIOs that were used by external memory configurations
+ *
+ ************************************************************************************/
+
+void stm32_extcontextrestore(struct extmem_save_s *restore)
+{
+ DEBUGASSERT(restore != NULL);
+ putreg32(restore->gpiod_crl, STM32_GPIOE_CRL);
+ putreg32(restore->gpiod_crh, STM32_GPIOE_CRH);
+ putreg32(restore->gpioe_crl, STM32_GPIOD_CRL);
+ putreg32(restore->gpioe_crh, STM32_GPIOD_CRH);
+ putreg32(restore->gpiof_crl, STM32_GPIOF_CRL);
+ putreg32(restore->gpiof_crh, STM32_GPIOF_CRH);
+ putreg32(restore->gpiog_crl, STM32_GPIOG_CRL);
+ putreg32(restore->gpiog_crh, STM32_GPIOG_CRH);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_extmem.c b/nuttx/configs/stm3210e-eval/src/up_extmem.c
new file mode 100644
index 000000000..a47d0fe12
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_extmem.c
@@ -0,0 +1,191 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_extmem.c
+ * arch/arm/src/board/up_extmem.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_fsmc.h"
+#include "stm32_gpio.h"
+#include "stm32_internal.h"
+#include "stm3210e-internal.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# warning "FSMC is not enabled"
+#endif
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/* 512Kx16 SRAM is connected to bank2 of the FSMC interface and both 8- and 16-bit
+ * accesses are allowed by BLN0 and BLN1 connected to BLE and BHE of SRAM,
+ * respectively.
+ *
+ * Pin Usage (per schematic)
+ *
+ * FLASH SRAM NAND LCD
+ * D[0..15] [0..15] [0..15] [0..7] [0..15]
+ * A[0..23] [0..22] [0..18] [16,17] [0]
+ * FSMC_NBL0 PE0 OUT ~BLE --- --- ---
+ * FSMC_NBL1 PE1 OUT ~BHE --- --- ---
+ * FSMC_NE2 PG9 OUT --- ~E --- ---
+ * FSMC_NE3 PG10 OUT ~CE --- --- ---
+ * FSMC_NE4 PG12 OUT --- --- --- ~CS
+ * FSMC_NWE PD5 OUT ~WE ~W ~W ~WR/SCL
+ * FSMC_NOE PD4 OUT ~OE ~G ~R ~RD
+ * FSMC_NWAIT PD6 IN --- R~B --- ---
+ * FSMC_INT2 PG6* IN --- --- R~B ---
+ *
+ * *JP7 will switch to PD6
+ */
+
+/* It would be much more efficient to brute force these all into the
+ * the appropriate registers. Just a little tricky.
+ */
+
+/* GPIO configurations common to SRAM and NOR Flash */
+
+const uint16_t g_commonconfig[NCOMMON_CONFIG] =
+{
+ /* A0... A18 */
+
+ GPIO_NPS_A0, GPIO_NPS_A1, GPIO_NPS_A2, GPIO_NPS_A3,
+ GPIO_NPS_A4, GPIO_NPS_A5, GPIO_NPS_A6, GPIO_NPS_A7,
+ GPIO_NPS_A8, GPIO_NPS_A9, GPIO_NPS_A10, GPIO_NPS_A11,
+ GPIO_NPS_A12, GPIO_NPS_A13, GPIO_NPS_A14, GPIO_NPS_A15,
+ GPIO_NPS_A16, GPIO_NPS_A17, GPIO_NPS_A18,
+
+ /* D0... D15 */
+
+ GPIO_NPS_D0, GPIO_NPS_D1, GPIO_NPS_D2, GPIO_NPS_D3,
+ GPIO_NPS_D4, GPIO_NPS_D5, GPIO_NPS_D6, GPIO_NPS_D7,
+ GPIO_NPS_D8, GPIO_NPS_D9, GPIO_NPS_D10, GPIO_NPS_D11,
+ GPIO_NPS_D12, GPIO_NPS_D13, GPIO_NPS_D14, GPIO_NPS_D15,
+
+ /* NOE, NWE */
+
+ GPIO_NPS_NOE, GPIO_NPS_NWE
+};
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for NOR or SRAM
+ *
+ ************************************************************************************/
+
+void stm32_extmemgpios(const uint16_t *gpios, int ngpios)
+{
+ int i;
+
+ /* Configure GPIOs */
+
+ for (i = 0; i < ngpios; i++)
+ {
+ stm32_configgpio(gpios[i]);
+ }
+}
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_enablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHBENR);
+ regval |= RCC_AHBENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHBENR);
+}
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_disablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHBENR);
+ regval &= ~RCC_AHBENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHBENR);
+}
diff --git a/nuttx/configs/stm3210e-eval/src/up_idle.c b/nuttx/configs/stm3210e-eval/src/up_idle.c
new file mode 100644
index 000000000..7b682e2bb
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_idle.c
@@ -0,0 +1,450 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_idle.c
+ * arch/arm/src/board/up_idle.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/clock.h>
+#include <nuttx/power/pm.h>
+#include <nuttx/rtc.h>
+
+#include <arch/irq.h>
+
+#include <arch/board/board.h>
+
+#include "up_internal.h"
+#include "stm32_pm.h"
+#include "stm32_rcc.h"
+#include "stm32_exti.h"
+
+#include "stm3210e-internal.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Does the board support an IDLE LED to indicate that the board is in the
+ * IDLE state?
+ */
+
+#if defined(CONFIG_ARCH_LEDS) && defined(LED_IDLE)
+# define BEGIN_IDLE() up_ledon(LED_IDLE)
+# define END_IDLE() up_ledoff(LED_IDLE)
+#else
+# define BEGIN_IDLE()
+# define END_IDLE()
+#endif
+
+/* Values for the RTC Alarm to wake up from the PM_STANDBY mode
+ * (which corresponds to STM32 stop mode). If this alarm expires,
+ * the logic in this file will wakeup from PM_STANDBY mode and
+ * transition to PM_SLEEP mode (STM32 standby mode).
+ */
+
+#ifndef CONFIG_PM_ALARM_SEC
+# define CONFIG_PM_ALARM_SEC 15
+#endif
+
+#ifndef CONFIG_PM_ALARM_NSEC
+# define CONFIG_PM_ALARM_NSEC 0
+#endif
+
+/* Values for the RTC Alarm to reset from the PM_SLEEP mode (STM32
+ * standby mode). If CONFIG_PM_SLEEP_WAKEUP is defined in the
+ * configuration, then the logic in this file will program the RTC
+ * alarm to wakeup the processor after an a delay.
+ *
+ * This feature might be useful, for example, in a system that needs to
+ * use minimal power but awake up to perform some task at periodic
+ * intervals.
+ */
+
+#ifdef CONFIG_PM_SLEEP_WAKEUP
+
+# ifndef CONFIG_RTC_ALARM
+# error "CONFIG_RTC_ALARM should be enabled to use CONFIG_PM_SLEEP_WAKEUP"
+# endif
+
+ /* If CONFIG_PM_SLEEP_WAKEUP is defined, then CONFIG_PM_SLEEP_WAKEUP_SEC
+ * and CONFIG_PM_SLEEP_WAKEUP_NSEC define the delay until the STM32
+ * awakens from PM_SLEEP mode.
+ */
+
+# ifndef CONFIG_PM_SLEEP_WAKEUP_SEC
+# define CONFIG_PM_SLEEP_WAKEUP_SEC 10
+# endif
+
+# ifndef CONFIG_PM_SLEEP_WAKEUP_NSEC
+# define CONFIG_PM_SLEEP_WAKEUP_NSEC 0
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static volatile bool g_alarmwakeup; /* Wakeup Alarm indicator */
+#endif
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_alarmcb
+ *
+ * Description:
+ * RTC alarm callback
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static void up_alarmcb(void)
+{
+ /* Note that we were awaken by an alarm */
+
+ g_alarmwakeup = true;
+}
+#endif
+
+/****************************************************************************
+ * Name: up_alarm_exti
+ *
+ * Description:
+ * RTC alarm EXTI interrupt service routine
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static int up_alarm_exti(int irq, FAR void *context)
+{
+ up_alarmcb();
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: up_exti_cancel
+ *
+ * Description:
+ * Disable the ALARM EXTI interrupt
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static void up_exti_cancel(void)
+{
+ (void)stm32_exti_alarm(false, false, false, NULL);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_rtc_alarm
+ *
+ * Description:
+ * Set the alarm
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static int up_rtc_alarm(time_t tv_sec, time_t tv_nsec, bool exti)
+{
+ struct timespec alarmtime;
+ int ret;
+
+ /* Configure to receive RTC Alarm EXTI interrupt */
+
+ if (exti)
+ {
+ /* TODO: Make sure that that is no pending EXTI interrupt */
+
+ (void)stm32_exti_alarm(true, true, true, up_alarm_exti);
+ }
+
+ /* Configure the RTC alarm to Auto Wake the system */
+
+ (void)up_rtc_gettime(&alarmtime);
+
+ alarmtime.tv_sec += tv_sec;
+ alarmtime.tv_nsec += tv_nsec;
+
+ /* The tv_nsec value must not exceed 1,000,000,000. That
+ * would be an invalid time.
+ */
+
+ if (alarmtime.tv_nsec >= NSEC_PER_SEC)
+ {
+ /* Carry to the seconds */
+
+ alarmtime.tv_sec++;
+ alarmtime.tv_nsec -= NSEC_PER_SEC;
+ }
+
+ /* Set the alarm */
+
+ g_alarmwakeup = false;
+ ret = up_rtc_setalarm(&alarmtime, up_alarmcb);
+ if (ret < 0)
+ {
+ lldbg("Warning: The alarm is already set\n");
+ }
+
+ return ret;
+}
+#endif
+
+/****************************************************************************
+ * Name: up_idlepm
+ *
+ * Description:
+ * Perform IDLE state power management.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void up_idlepm(void)
+{
+ static enum pm_state_e oldstate = PM_NORMAL;
+ enum pm_state_e newstate;
+ int ret;
+
+ /* The following is logic that is done after the wake-up from PM_STANDBY
+ * state. It decides whether to go back to the PM_NORMAL or to the deeper
+ * power-saving mode PM_SLEEP: If the alarm expired with no "normal"
+ * wake-up event, then PM_SLEEP is entered.
+ *
+ * Logically, this code belongs at the end of the PM_STANDBY case below,
+ * does not work in the position for some unkown reason.
+ */
+
+ if (oldstate == PM_STANDBY)
+ {
+ /* Were we awakened by the alarm? */
+
+#ifdef CONFIG_RTC_ALARM
+ if (g_alarmwakeup)
+ {
+ /* Yes.. Go to SLEEP mode */
+
+ newstate = PM_SLEEP;
+ }
+ else
+#endif
+ {
+ /* Resume normal operation */
+
+ newstate = PM_NORMAL;
+ }
+ }
+ else
+ {
+ /* Let the PM system decide, which power saving level can be obtained */
+
+ newstate = pm_checkstate();
+ }
+
+ /* Check for state changes */
+
+ if (newstate != oldstate)
+ {
+ llvdbg("newstate= %d oldstate=%d\n", newstate, oldstate);
+
+ sched_lock();
+
+ /* Force the global state change */
+
+ ret = pm_changestate(newstate);
+ if (ret < 0)
+ {
+ /* The new state change failed, revert to the preceding state */
+
+ (void)pm_changestate(oldstate);
+
+ /* No state change... */
+
+ goto errout;
+ }
+
+ /* Then perform board-specific, state-dependent logic here */
+
+ switch (newstate)
+ {
+ case PM_NORMAL:
+ {
+ /* If we just awakened from PM_STANDBY mode, then reconfigure
+ * clocking.
+ */
+
+ if (oldstate == PM_STANDBY)
+ {
+ /* Re-enable clocking */
+
+ stm32_clockenable();
+
+ /* The system timer was disabled while in PM_STANDBY or
+ * PM_SLEEP modes. But the RTC has still be running: Reset
+ * the system time the current RTC time.
+ */
+
+#ifdef CONFIG_RTC
+ clock_synchronize();
+#endif
+ }
+ }
+ break;
+
+ case PM_IDLE:
+ {
+ }
+ break;
+
+ case PM_STANDBY:
+ {
+ /* Set the alarm as an EXTI Line */
+
+#ifdef CONFIG_RTC_ALARM
+ up_rtc_alarm(CONFIG_PM_ALARM_SEC, CONFIG_PM_ALARM_NSEC, true);
+#endif
+ /* Wait 10ms */
+
+ up_mdelay(10);
+
+ /* Enter the STM32 stop mode */
+
+ (void)stm32_pmstop(false);
+
+ /* We have been re-awakened by some even: A button press?
+ * An alarm? Cancel any pending alarm and resume the normal
+ * operation.
+ */
+
+#ifdef CONFIG_RTC_ALARM
+ up_exti_cancel();
+ ret = up_rtc_cancelalarm();
+ if (ret < 0)
+ {
+ lldbg("Warning: Cancel alarm failed\n");
+ }
+#endif
+ /* Note: See the additional PM_STANDBY related logic at the
+ * beginning of this function. That logic is executed after
+ * this point.
+ */
+ }
+ break;
+
+ case PM_SLEEP:
+ {
+ /* We should not return from standby mode. The only way out
+ * of standby is via the reset path.
+ */
+
+ /* Configure the RTC alarm to Auto Reset the system */
+
+#ifdef CONFIG_PM_SLEEP_WAKEUP
+ up_rtc_alarm(CONFIG_PM_SLEEP_WAKEUP_SEC, CONFIG_PM_SLEEP_WAKEUP_NSEC, false);
+#endif
+ /* Wait 10ms */
+
+ up_mdelay(10);
+
+ /* Enter the STM32 standby mode */
+
+ (void)stm32_pmstandby();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* Save the new state */
+
+ oldstate = newstate;
+
+errout:
+ sched_unlock();
+ }
+}
+#else
+# define up_idlepm()
+#endif /* CONFIG_PM */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_idle
+ *
+ * Description:
+ * up_idle() is the logic that will be executed when their is no other
+ * ready-to-run task. This is processor idle time and will continue until
+ * some interrupt occurs to cause a context switch from the idle task.
+ *
+ * Processing in this state may be processor-specific. e.g., this is where
+ * power management operations might be performed.
+ *
+ ****************************************************************************/
+
+void up_idle(void)
+{
+#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
+ /* If the system is idle and there are no timer interrupts, then process
+ * "fake" timer interrupts. Hopefully, something will wake up.
+ */
+
+ sched_process_timer();
+#else
+
+ /* Perform IDLE mode power management */
+
+ BEGIN_IDLE();
+ up_idlepm();
+ END_IDLE();
+#endif
+}
diff --git a/nuttx/configs/stm3210e-eval/src/up_lcd.c b/nuttx/configs/stm3210e-eval/src/up_lcd.c
new file mode 100644
index 000000000..8b832aafb
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_lcd.c
@@ -0,0 +1,1867 @@
+/**************************************************************************************
+ * configs/stm3210e-eval/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * With power management enhancements by:
+ *
+ * Author: Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+/* This driver supports the following LCDs:
+ *
+ * 1. Ampire AM-240320LTNQW00H
+ * 2. Orise Tech SPFD5408B
+ * 3. RenesasSP R61580
+ *
+ * The driver dynamically selects the LCD based on the reported LCD ID value. However,
+ * code size can be reduced by suppressing support for individual LCDs using:
+ *
+ * CONFIG_STM32_AM240320_DISABLE
+ * CONFIG_STM32_SPFD5408B_DISABLE
+ * CONFIG_STM32_R61580_DISABLE
+ *
+ * Omitting the above (or setting them to "n") enables support for the LCD. Setting
+ * any of the above to "y" will disable support for the corresponding LCD.
+ */
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+
+#include <arch/board/board.h>
+#include <nuttx/power/pm.h>
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm32_internal.h"
+#include "stm3210e-internal.h"
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+/* Configuration **********************************************************************/
+/* Check contrast selection */
+
+#if !defined(CONFIG_LCD_MAXCONTRAST)
+# define CONFIG_LCD_MAXCONTRAST 1
+#endif
+
+/* Backlight */
+
+#ifndef CONFIG_LCD_BACKLIGHT
+# undef CONFIG_LCD_PWM
+#endif
+
+#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
+# if !defined(CONFIG_STM32_TIM1)
+# warning "CONFIG_LCD_PWM requires CONFIG_STM32_TIM1"
+# undef CONFIG_LCD_PWM
+# endif
+# if defined(CONFIG_STM32_TIM1_FULL_REMAP)
+# warning "PA8 cannot be configured as TIM1 CH1 with full remap"
+# undef CONFIG_LCD_PWM
+# endif
+#endif
+
+#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
+# if CONFIG_LCD_MAXPOWER < 2
+# warning "A larger value of CONFIG_LCD_MAXPOWER is recommended"
+# endif
+#endif
+
+/* Check power setting */
+
+#if !defined(CONFIG_LCD_MAXPOWER) || CONFIG_LCD_MAXPOWER < 1
+# undef CONFIG_LCD_MAXPOWER
+# if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
+# define CONFIG_LCD_MAXPOWER 100
+# else
+# define CONFIG_LCD_MAXPOWER 1
+# endif
+#endif
+
+#if CONFIG_LCD_MAXPOWER > 255
+# error "CONFIG_LCD_MAXPOWER must be less than 256 to fit in uint8_t"
+#endif
+
+/* PWM Frequency */
+
+#ifndef CONFIG_LCD_PWMFREQUENCY
+# define CONFIG_LCD_PWMFREQUENCY 100
+#endif
+
+/* Check orientation */
+
+#if defined(CONFIG_LCD_PORTRAIT)
+# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RPORTRAIT)
+# error "Cannot define both portrait and any other orientations"
+# endif
+#elif defined(CONFIG_LCD_RPORTRAIT)
+# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_PORTRAIT)
+# error "Cannot define both rportrait and any other orientations"
+# endif
+#elif !defined(CONFIG_LCD_LANDSCAPE)
+# define CONFIG_LCD_LANDSCAPE 1
+#endif
+
+/* When reading 16-bit gram data, there may some shifts in the returned data
+ * and/or there may be some colors in the incorrect posisions:
+ *
+ * - SPFD5408B: There appears to be a 5-bit shift in the returned data.
+ * Red and green appear to be swapped on read-back as well
+ * - R61580: There is a 16-bit (1 pixel) shift in the returned data.
+ * - AM240320: Unknown -- assume colors are correct for now.
+ */
+
+#define SPFD5408B_RDSHIFT 5
+
+/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must
+ * also be enabled.
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+# undef CONFIG_DEBUG_LCD
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_LCD
+#endif
+
+/* Display/Color Properties ***********************************************************/
+/* Display Resolution */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+# define STM3210E_XRES 320
+# define STM3210E_YRES 240
+#else
+# define STM3210E_XRES 240
+# define STM3210E_YRES 320
+#endif
+
+/* Color depth and format */
+
+#define STM3210E_BPP 16
+#define STM3210E_COLORFMT FB_FMT_RGB16_565
+
+/* STM3210E-EVAL LCD Hardware Definitions *********************************************/
+/* LCD /CS is CE4, Bank 4 of NOR/SRAM Bank 1~4 */
+
+#define STM3210E_LCDBASE ((uint32_t)(0x60000000 | 0x0c000000))
+#define LCD ((struct lcd_regs_s *) STM3210E_LCDBASE)
+
+#define LCD_REG_0 0x00
+#define LCD_REG_1 0x01
+#define LCD_REG_2 0x02
+#define LCD_REG_3 0x03
+#define LCD_REG_4 0x04
+#define LCD_REG_5 0x05
+#define LCD_REG_6 0x06
+#define LCD_REG_7 0x07
+#define LCD_REG_8 0x08
+#define LCD_REG_9 0x09
+#define LCD_REG_10 0x0a
+#define LCD_REG_12 0x0c
+#define LCD_REG_13 0x0d
+#define LCD_REG_14 0x0e
+#define LCD_REG_15 0x0f
+#define LCD_REG_16 0x10
+#define LCD_REG_17 0x11
+#define LCD_REG_18 0x12
+#define LCD_REG_19 0x13
+#define LCD_REG_20 0x14
+#define LCD_REG_21 0x15
+#define LCD_REG_22 0x16
+#define LCD_REG_23 0x17
+#define LCD_REG_24 0x18
+#define LCD_REG_25 0x19
+#define LCD_REG_26 0x1a
+#define LCD_REG_27 0x1b
+#define LCD_REG_28 0x1c
+#define LCD_REG_29 0x1d
+#define LCD_REG_30 0x1e
+#define LCD_REG_31 0x1f
+#define LCD_REG_32 0x20
+#define LCD_REG_33 0x21
+#define LCD_REG_34 0x22
+#define LCD_REG_36 0x24
+#define LCD_REG_37 0x25
+#define LCD_REG_40 0x28
+#define LCD_REG_41 0x29
+#define LCD_REG_43 0x2b
+#define LCD_REG_45 0x2d
+#define LCD_REG_48 0x30
+#define LCD_REG_49 0x31
+#define LCD_REG_50 0x32
+#define LCD_REG_51 0x33
+#define LCD_REG_52 0x34
+#define LCD_REG_53 0x35
+#define LCD_REG_54 0x36
+#define LCD_REG_55 0x37
+#define LCD_REG_56 0x38
+#define LCD_REG_57 0x39
+#define LCD_REG_58 0x3a
+#define LCD_REG_59 0x3b
+#define LCD_REG_60 0x3c
+#define LCD_REG_61 0x3d
+#define LCD_REG_62 0x3e
+#define LCD_REG_63 0x3f
+#define LCD_REG_64 0x40
+#define LCD_REG_65 0x41
+#define LCD_REG_66 0x42
+#define LCD_REG_67 0x43
+#define LCD_REG_68 0x44
+#define LCD_REG_69 0x45
+#define LCD_REG_70 0x46
+#define LCD_REG_71 0x47
+#define LCD_REG_72 0x48
+#define LCD_REG_73 0x49
+#define LCD_REG_74 0x4a
+#define LCD_REG_75 0x4b
+#define LCD_REG_76 0x4c
+#define LCD_REG_77 0x4d
+#define LCD_REG_78 0x4e
+#define LCD_REG_79 0x4f
+#define LCD_REG_80 0x50
+#define LCD_REG_81 0x51
+#define LCD_REG_82 0x52
+#define LCD_REG_83 0x53
+#define LCD_REG_96 0x60
+#define LCD_REG_97 0x61
+#define LCD_REG_106 0x6a
+#define LCD_REG_118 0x76
+#define LCD_REG_128 0x80
+#define LCD_REG_129 0x81
+#define LCD_REG_130 0x82
+#define LCD_REG_131 0x83
+#define LCD_REG_132 0x84
+#define LCD_REG_133 0x85
+#define LCD_REG_134 0x86
+#define LCD_REG_135 0x87
+#define LCD_REG_136 0x88
+#define LCD_REG_137 0x89
+#define LCD_REG_139 0x8b
+#define LCD_REG_140 0x8c
+#define LCD_REG_141 0x8d
+#define LCD_REG_143 0x8f
+#define LCD_REG_144 0x90
+#define LCD_REG_145 0x91
+#define LCD_REG_146 0x92
+#define LCD_REG_147 0x93
+#define LCD_REG_148 0x94
+#define LCD_REG_149 0x95
+#define LCD_REG_150 0x96
+#define LCD_REG_151 0x97
+#define LCD_REG_152 0x98
+#define LCD_REG_153 0x99
+#define LCD_REG_154 0x9a
+#define LCD_REG_157 0x9d
+#define LCD_REG_164 0xa4
+#define LCD_REG_192 0xc0
+#define LCD_REG_193 0xc1
+#define LCD_REG_229 0xe5
+
+/* LCD IDs */
+
+#define SPFD5408B_ID 0x5408
+#define R61580_ID 0x1580
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg(format, arg...) vdbg(format, ##arg)
+#else
+# define lcddbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/* LCD type */
+
+enum lcd_type_e
+{
+ LCD_TYPE_UNKNOWN = 0,
+ LCD_TYPE_SPFD5408B,
+ LCD_TYPE_R61580,
+ LCD_TYPE_AM240320
+};
+
+/* This structure describes the LCD registers */
+
+struct lcd_regs_s
+{
+ volatile uint16_t address;
+ volatile uint16_t value;
+};
+
+/* This structure describes the state of this driver */
+
+struct stm3210e_dev_s
+{
+ /* Publically visible device structure */
+
+ struct lcd_dev_s dev;
+
+#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
+ uint32_t reload;
+#endif
+
+ /* Private LCD-specific information follows */
+
+ uint8_t type; /* LCD type. See enum lcd_type_e */
+ uint8_t power; /* Current power setting */
+};
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+/* Low Level LCD access */
+
+static void stm3210e_writereg(uint8_t regaddr, uint16_t regval);
+static uint16_t stm3210e_readreg(uint8_t regaddr);
+static inline void stm3210e_gramselect(void);
+static inline void stm3210e_writegram(uint16_t rgbval);
+static void stm3210e_readsetup(FAR uint16_t *accum);
+#ifndef CONFIG_STM32_AM240320_DISABLE
+static void stm3210e_readnosetup(FAR uint16_t *accum);
+#endif
+static uint16_t stm3210e_readshift(FAR uint16_t *accum);
+static uint16_t stm3210e_readnoshift(FAR uint16_t *accum);
+static void stm3210e_setcursor(uint16_t col, uint16_t row);
+
+/* LCD Data Transfer Methods */
+
+static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels);
+static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels);
+
+/* LCD Configuration */
+
+static int stm3210e_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo);
+static int stm3210e_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo);
+
+/* LCD RGB Mapping */
+
+#ifdef CONFIG_FB_CMAP
+# error "RGB color mapping not supported by this driver"
+#endif
+
+/* Cursor Controls */
+
+#ifdef CONFIG_FB_HWCURSOR
+# error "Cursor control not supported by this driver"
+#endif
+
+/* LCD Specific Controls */
+
+static int stm3210e_getpower(struct lcd_dev_s *dev);
+static int stm3210e_setpower(struct lcd_dev_s *dev, int power);
+static int stm3210e_getcontrast(struct lcd_dev_s *dev);
+static int stm3210e_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
+
+/* LCD Power Management */
+
+#ifdef CONFIG_PM
+static void stm3210e_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
+static int stm3210e_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
+#endif
+
+/* Initialization */
+
+static inline void stm3210e_lcdinitialize(void);
+#ifdef CONFIG_LCD_BACKLIGHT
+static void stm3210e_backlight(void);
+#else
+# define stm3210e_backlight()
+#endif
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is working memory allocated by the LCD driver for each LCD device
+ * and for each color plane. This memory will hold one raster line of data.
+ * The size of the allocated run buffer must therefore be at least
+ * (bpp * xres / 8). Actual alignment of the buffer must conform to the
+ * bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
+ */
+
+static uint16_t g_runbuffer[STM3210E_XRES];
+
+/* This structure describes the overall LCD video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{
+ .fmt = STM3210E_COLORFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */
+ .xres = STM3210E_XRES, /* Horizontal resolution in pixel columns */
+ .yres = STM3210E_YRES, /* Vertical resolution in pixel rows */
+ .nplanes = 1, /* Number of color planes supported */
+};
+
+/* This is the standard, NuttX Plane information object */
+
+static const struct lcd_planeinfo_s g_planeinfo =
+{
+ .putrun = stm3210e_putrun, /* Put a run into LCD memory */
+ .getrun = stm3210e_getrun, /* Get a run from LCD memory */
+ .buffer = (uint8_t*)g_runbuffer, /* Run scratch buffer */
+ .bpp = STM3210E_BPP, /* Bits-per-pixel */
+};
+
+/* This is the standard, NuttX LCD driver object */
+
+static struct stm3210e_dev_s g_lcddev =
+{
+ .dev =
+ {
+ /* LCD Configuration */
+
+ .getvideoinfo = stm3210e_getvideoinfo,
+ .getplaneinfo = stm3210e_getplaneinfo,
+
+ /* LCD RGB Mapping -- Not supported */
+ /* Cursor Controls -- Not supported */
+
+ /* LCD Specific Controls */
+
+ .getpower = stm3210e_getpower,
+ .setpower = stm3210e_setpower,
+ .getcontrast = stm3210e_getcontrast,
+ .setcontrast = stm3210e_setcontrast,
+ },
+};
+
+#ifdef CONFIG_PM
+static struct pm_callback_s g_lcdcb =
+{
+ .notify = stm3210e_pm_notify,
+ .prepare = stm3210e_pm_prepare,
+};
+#endif
+
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: stm3210e_writereg
+ *
+ * Description:
+ * Write to an LCD register
+ *
+ **************************************************************************************/
+
+static void stm3210e_writereg(uint8_t regaddr, uint16_t regval)
+{
+ /* Write the register address then write the register value */
+
+ LCD->address = regaddr;
+ LCD->value = regval;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_readreg
+ *
+ * Description:
+ * Read from an LCD register
+ *
+ **************************************************************************************/
+
+static uint16_t stm3210e_readreg(uint8_t regaddr)
+{
+ /* Write the register address then read the register value */
+
+ LCD->address = regaddr;
+ return LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_gramselect
+ *
+ * Description:
+ * Setup to read or write multiple pixels to the GRAM memory
+ *
+ **************************************************************************************/
+
+static inline void stm3210e_gramselect(void)
+{
+ LCD->address = LCD_REG_34;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_writegram
+ *
+ * Description:
+ * Write one pixel to the GRAM memory
+ *
+ **************************************************************************************/
+
+static inline void stm3210e_writegram(uint16_t rgbval)
+{
+ /* Write the value (GRAM register already selected) */
+
+ LCD->value = rgbval;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_readsetup / stm3210e_readnosetup
+ *
+ * Description:
+ * Prime the operation by reading one pixel from the GRAM memory if necessary for
+ * this LCD type. When reading 16-bit gram data, there may be some shifts in the
+ * returned data:
+ *
+ * - SPFD5408B: There appears to be a 5-bit shift in the returned data.
+ * - R61580: There is a 16-bit (1 pixel) shift in the returned data.
+ * - AM240320: Unknown -- assuming no shift in the return data
+ *
+ **************************************************************************************/
+
+/* Used for SPFD5408B and R61580 */
+
+#if !defined(CONFIG_STM32_SPFD5408B_DISABLE) || !defined(CONFIG_STM32_R61580_DISABLE)
+static void stm3210e_readsetup(FAR uint16_t *accum)
+{
+ /* Read-ahead one pixel */
+
+ *accum = LCD->value;
+}
+#endif
+
+/* Used only for AM240320 */
+
+#ifndef CONFIG_STM32_AM240320_DISABLE
+static void stm3210e_readnosetup(FAR uint16_t *accum)
+{
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm3210e_readshift / stm3210e_readnoshift
+ *
+ * Description:
+ * Read one correctly aligned pixel from the GRAM memory. Possibly shifting the
+ * data and possibly swapping red and green components.
+ *
+ * - SPFD5408B: There appears to be a 5-bit shift in the returned data.
+ * Red and green appear to be swapped on read-back as well
+ * - R61580: There is a 16-bit (1 pixel) shift in the returned data.
+ * All colors in the normal order
+ * - AM240320: Unknown -- assuming colors are in the color order
+ *
+ **************************************************************************************/
+
+/* This version is used only for the SPFD5408B. It shifts the data by 5-bits and swaps
+ * red and green
+ */
+
+#ifndef CONFIG_STM32_SPFD5408B_DISABLE
+static uint16_t stm3210e_readshift(FAR uint16_t *accum)
+{
+ uint16_t red;
+ uint16_t green;
+ uint16_t blue;
+
+ /* Read the value (GRAM register already selected) */
+
+ uint16_t next = LCD->value;
+
+ /* Return previous bits 0-10 as bits 6-15 and next data bits 11-15 as bits 0-5
+ *
+ * xxxx xPPP PPPP PPPP
+ * NNNN Nxxx xxxx xxxx
+ *
+ * Assuming that SPFD5408B_RDSHIFT == 5
+ */
+
+ uint16_t value = *accum << SPFD5408B_RDSHIFT | next >> (16-SPFD5408B_RDSHIFT);
+
+ /* Save the value for the next time we are called */
+
+ *accum = next;
+
+ /* Tear the RGB655 apart. Swap read and green */
+
+ red = (value << (11-5)) & 0xf800; /* Move bits 5-9 to 11-15 */
+ green = (value >> (10-5)) & 0x07e0; /* Move bits 10-15 to bits 5-10 */
+ blue = value & 0x001f; /* Blue is in the right place */
+
+ /* And put the RGB565 back together */
+
+ value = red | green | blue;
+
+ /* This is wierd... If blue is zero, then red+green values are off by 0x20.
+ * Except that both 0x0000 and 0x0020 can map to 0x0000. Need to revisit
+ * this!!!!!!!!!!! I might be misinterpreting some of the data that I have.
+ */
+
+#if 0 /* REVISIT */
+ if (value != 0 && blue == 0)
+ {
+ value += 0x20;
+ }
+#endif
+
+ return value;
+}
+#endif
+
+/* This version is used for the R61580 and for the AM240320. It neither shifts nor
+ * swaps colors.
+ */
+
+#if !defined(CONFIG_STM32_R61580_DISABLE) || !defined(CONFIG_STM32_AM240320_DISABLE)
+static uint16_t stm3210e_readnoshift(FAR uint16_t *accum)
+{
+ /* Read the value (GRAM register already selected) */
+
+ return LCD->value;
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm3210e_setcursor
+ *
+ * Description:
+ * Set the cursor position. In landscape mode, the "column" is actually the physical
+ * Y position and the "row" is the physical X position.
+ *
+ **************************************************************************************/
+
+static void stm3210e_setcursor(uint16_t col, uint16_t row)
+{
+ stm3210e_writereg(LCD_REG_32, row); /* GRAM horizontal address */
+ stm3210e_writereg(LCD_REG_33, col); /* GRAM vertical address */
+}
+
+/**************************************************************************************
+ * Name: stm3210e_dumprun
+ *
+ * Description:
+ * Dump the contexts of the run buffer:
+ *
+ * run - The buffer in containing the run read to be dumped
+ * npixels - The number of pixels to dump
+ *
+ **************************************************************************************/
+
+#if 0 /* Sometimes useful */
+static void stm3210e_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels)
+{
+ int i, j;
+
+ lib_rawprintf("\n%s:\n", msg);
+ for (i = 0; i < npixels; i += 16)
+ {
+ up_putc(' ');
+ lib_rawprintf(" ");
+ for (j = 0; j < 16; j++)
+ {
+ lib_rawprintf(" %04x", *run++);
+ }
+ up_putc('\n');
+ }
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm3210e_putrun
+ *
+ * Description:
+ * This method can be used to write a partial raster line to the LCD:
+ *
+ * row - Starting row to write to (range: 0 <= row < yres)
+ * col - Starting column to write to (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer containing the run to be written to the LCD
+ * npixels - The number of pixels to write to the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels)
+{
+ FAR const uint16_t *src = (FAR const uint16_t*)buffer;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ lcddbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Write the run to GRAM. */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+ /* Convert coordinates -- Which edge of the display is the "top?" Here the edge
+ * with the simplest conversion is used.
+ */
+
+ col = (STM3210E_XRES-1) - col;
+
+ /* Set the cursor position */
+
+ stm3210e_setcursor(col, row);
+
+ /* Then write the GRAM data, auto-decrementing X */
+
+ stm3210e_gramselect();
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position (auto-decrements to the next column) */
+
+ stm3210e_writegram(*src++);
+ }
+#elif defined(CONFIG_LCD_PORTRAIT)
+ /* Convert coordinates. (Swap row and column. This is done implicitly). */
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3210e_setcursor(row, col);
+ stm3210e_gramselect();
+ stm3210e_writegram(*src++);
+
+ /* Increment to next column */
+
+ col++;
+ }
+#else /* CONFIG_LCD_RPORTRAIT */
+ /* Convert coordinates. (Swap row and column. This is done implicitly).
+ * Which edge of the display is the "top"?
+ */
+
+ col = (STM3210E_XRES-1) - col;
+ row = (STM3210E_YRES-1) - row;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3210e_setcursor(row, col);
+ stm3210e_gramselect();
+ stm3210e_writegram(*src++);
+
+ /* Decrement to next column */
+
+ col--;
+ }
+#endif
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_getrun
+ *
+ * Description:
+ * This method can be used to read a partial raster line from the LCD:
+ *
+ * row - Starting row to read from (range: 0 <= row < yres)
+ * col - Starting column to read read (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer in which to return the run read from the LCD
+ * npixels - The number of pixels to read from the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels)
+{
+ FAR uint16_t *dest = (FAR uint16_t*)buffer;
+ void (*readsetup)(FAR uint16_t *accum);
+ uint16_t (*readgram)(FAR uint16_t *accum);
+ uint16_t accum;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ lcddbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Configure according to the LCD type */
+
+ switch (g_lcddev.type)
+ {
+#ifndef CONFIG_STM32_SPFD5408B_DISABLE
+ case LCD_TYPE_SPFD5408B:
+ readsetup = stm3210e_readsetup;
+ readgram = stm3210e_readshift;
+ break;
+#endif
+
+#ifndef CONFIG_STM32_R61580_DISABLE
+ case LCD_TYPE_R61580:
+ readsetup = stm3210e_readsetup;
+ readgram = stm3210e_readnoshift;
+ break;
+#endif
+
+#ifndef CONFIG_STM32_AM240320_DISABLE
+ case LCD_TYPE_AM240320:
+ readsetup = stm3210e_readnosetup;
+ readgram = stm3210e_readnoshift;
+ break;
+#endif
+
+ default: /* Shouldn't happen */
+ return -ENOSYS;
+ }
+
+ /* Read the run from GRAM. */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+ /* Convert coordinates -- Which edge of the display is the "top?" Here the edge
+ * with the simplest conversion is used.
+ */
+
+ col = (STM3210E_XRES-1) - col;
+
+ /* Set the cursor position */
+
+ stm3210e_setcursor(col, row);
+
+ /* Then read the GRAM data, auto-decrementing Y */
+
+ stm3210e_gramselect();
+
+ /* Prime the pump for unaligned read data */
+
+ readsetup(&accum);
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position (autoincrements to the next row) */
+
+ *dest++ = readgram(&accum);
+ }
+#elif defined(CONFIG_LCD_PORTRAIT)
+ /* Convert coordinates (Swap row and column. This is done implicitly). */
+
+ /* Then read the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position */
+
+ stm3210e_setcursor(row, col);
+ stm3210e_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Increment to next column */
+
+ col++;
+ }
+#else /* CONFIG_LCD_RPORTRAIT */
+ /* Convert coordinates. (Swap row and column. This is done implicitly).
+ * Whic edge of the display is the "top"?
+ */
+
+ col = (STM3210E_XRES-1) - col;
+ row = (STM3210E_YRES-1) - row;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3210e_setcursor(row, col);
+ stm3210e_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Decrement to next column */
+
+ col--;
+ }
+#endif
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_getvideoinfo
+ *
+ * Description:
+ * Get information about the LCD video controller configuration.
+ *
+ **************************************************************************************/
+
+static int stm3210e_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ DEBUGASSERT(dev && vinfo);
+ gvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
+ g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_getplaneinfo
+ *
+ * Description:
+ * Get information about the configuration of each LCD color plane.
+ *
+ **************************************************************************************/
+
+static int stm3210e_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo)
+{
+ DEBUGASSERT(dev && pinfo && planeno == 0);
+ gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
+ memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_getpower
+ *
+ * Description:
+ * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3210e_getpower(struct lcd_dev_s *dev)
+{
+ gvdbg("power: %d\n", 0);
+ return g_lcddev.power;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_poweroff
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3210e_poweroff(void)
+{
+ /* Turn the display off */
+
+ stm3210e_writereg(LCD_REG_7, 0);
+
+ /* Disable timer 1 clocking */
+
+#if defined(CONFIG_LCD_BACKLIGHT)
+# if defined(CONFIG_LCD_PWM)
+ modifyreg32(STM32_RCC_APB2ENR, RCC_APB2ENR_TIM1EN, 0);
+#endif
+
+ /* Configure the PA8 pin as an output */
+
+ stm32_configgpio(GPIO_LCD_BACKLIGHT);
+
+ /* Turn the backlight off */
+
+ stm32_gpiowrite(GPIO_LCD_BACKLIGHT, false);
+#endif
+
+ /* Remember the power off state */
+
+ g_lcddev.power = 0;
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_setpower
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3210e_setpower(struct lcd_dev_s *dev, int power)
+{
+ gvdbg("power: %d\n", power);
+ DEBUGASSERT((unsigned)power <= CONFIG_LCD_MAXPOWER);
+
+ /* Set new power level */
+
+ if (power > 0)
+ {
+#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
+ uint32_t frac;
+ uint32_t duty;
+
+ /* If we are coming up from the power off state, then re-configure the timer */
+
+ if (g_lcddev.power == 0)
+ {
+ stm3210e_backlight();
+ }
+
+ /* Make sure that the power value is within range */
+
+ if (power > CONFIG_LCD_MAXPOWER)
+ {
+ power = CONFIG_LCD_MAXPOWER;
+ }
+
+ /* Caclulate the new backlight duty. It is a faction of the timer1
+ * period based on the ration of the current power setting to the
+ * maximum power setting.
+ */
+
+ frac = (power << 16) / CONFIG_LCD_MAXPOWER;
+ duty = (g_lcddev.reload * frac) >> 16;
+ if (duty > 0)
+ {
+ duty--;
+ }
+
+ putreg16((uint16_t)duty, STM32_TIM1_CCR1);
+#else
+ /* Turn the backlight on */
+
+ stm32_gpiowrite(GPIO_LCD_BACKLIGHT, true);
+#endif
+ /* Then turn the display on */
+
+#ifndef CONFIG_STM32_AM240320_DISABLE
+# if !defined (CONFIG_STM32_SPFD5408B_DISABLE) || !defined(CONFIG_STM32_R61580_DISABLE)
+ stm3210e_writereg(LCD_REG_7, g_lcddev.type == LCD_TYPE_AM240320 ? 0x0173 : 0x0112);
+# else
+ stm3210e_writereg(LCD_REG_7, 0x0173);
+# endif
+#else
+ stm3210e_writereg(LCD_REG_7, 0x0112);
+#endif
+ g_lcddev.power = power;
+ }
+ else
+ {
+ /* Turn the display off */
+
+ stm3210e_poweroff();
+ }
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_getcontrast
+ *
+ * Description:
+ * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int stm3210e_getcontrast(struct lcd_dev_s *dev)
+{
+ gvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: stm3210e_setcontrast
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int stm3210e_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
+{
+ gvdbg("contrast: %d\n", contrast);
+ return -ENOSYS;
+}
+
+/****************************************************************************
+ * Name: stm3210e_pm_notify
+ *
+ * Description:
+ * Notify the driver of new power state. This callback is called after
+ * all drivers have had the opportunity to prepare for the new power state.
+ *
+ * Input Parameters:
+ *
+ * cb - Returned to the driver. The driver version of the callback
+ * strucure may include additional, driver-specific state data at
+ * the end of the structure.
+ *
+ * pmstate - Identifies the new PM state
+ *
+ * Returned Value:
+ * None - The driver already agreed to transition to the low power
+ * consumption state when when it returned OK to the prepare() call.
+ *
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void stm3210e_pm_notify(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+#ifdef CONFIG_LCD_PWM
+ uint32_t frac;
+ uint32_t duty;
+#endif
+
+ switch (pmstate)
+ {
+ case(PM_NORMAL):
+ {
+ /* Restore normal LCD operation */
+
+#ifdef CONFIG_LCD_PWM
+ frac = (g_lcddev.power << 16) / CONFIG_LCD_MAXPOWER;
+ duty = (g_lcddev.reload * frac) >> 16;
+ if (duty > 0)
+ {
+ duty--;
+ }
+
+ putreg16((uint16_t)duty, STM32_TIM1_CCR1);
+#endif
+ }
+ break;
+
+ case(PM_IDLE):
+ {
+ /* Entering IDLE mode - Reduce LCD light */
+
+#ifdef CONFIG_LCD_PWM
+ frac = (g_lcddev.power << 16) / CONFIG_LCD_MAXPOWER;
+ duty = (g_lcddev.reload * frac) >> 16;
+ if (duty > 0)
+ {
+ duty--;
+ }
+
+ /* Reduce the LCD backlight to 50% of the MAXPOWER */
+
+ duty >>= 1;
+ putreg16((uint16_t)duty, STM32_TIM1_CCR1);
+#endif
+ }
+ break;
+
+ case(PM_STANDBY):
+ {
+ /* Entering STANDBY mode - Turn display backlight off */
+
+#ifdef CONFIG_LCD_PWM
+ putreg16(0, STM32_TIM1_CCR1);
+#endif
+ }
+ break;
+
+ case(PM_SLEEP):
+ {
+ /* Entering SLEEP mode - Turn off LCD */
+
+ if (g_lcddev.type == LCD_TYPE_AM240320)
+ {
+ /* Display off sequence */
+
+ stm3210e_writereg(LCD_REG_0, 0xa0); /* White display mode setting */
+ up_mdelay(10); /* Wait for 2 frame scan */
+ stm3210e_writereg(LCD_REG_59, 0x00); /* Gate scan stop */
+
+ /* Power off sequence */
+
+ stm3210e_writereg(LCD_REG_30, 0x09); /* VCOM stop */
+ stm3210e_writereg(LCD_REG_27, 0x0e); /* VS/VDH turn off */
+ stm3210e_writereg(LCD_REG_24, 0xc0); /* CP1, CP2, CP3 turn off */
+ up_mdelay(10); /* wait 10 ms */
+
+ stm3210e_writereg(LCD_REG_24, 0x00); /* VR1 / VR2 off*/
+ stm3210e_writereg(LCD_REG_28, 0x30); /* Step up circuit operating current stop */
+ up_mdelay(10);
+
+ stm3210e_poweroff();
+ stm3210e_writereg(LCD_REG_0, 0xa0); /* White display mode setting */
+ up_mdelay(10); /* Wait for 2 frame scan */
+
+ stm3210e_writereg(LCD_REG_59, 0x00); /* Gate scan stop */
+ }
+ else
+ {
+ (void)stm3210e_poweroff();
+ }
+ }
+ break;
+
+ default:
+ {
+ /* Should not get here */
+
+ }
+ break;
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: stm3210e_pm_prepare
+ *
+ * Description:
+ * Request the driver to prepare for a new power state. This is a warning
+ * that the system is about to enter into a new power state. The driver
+ * should begin whatever operations that may be required to enter power
+ * state. The driver may abort the state change mode by returning a
+ * non-zero value from the callback function.
+ *
+ * Input Parameters:
+ *
+ * cb - Returned to the driver. The driver version of the callback
+ * strucure may include additional, driver-specific state data at
+ * the end of the structure.
+ *
+ * pmstate - Identifies the new PM state
+ *
+ * Returned Value:
+ * Zero - (OK) means the event was successfully processed and that the
+ * driver is prepared for the PM state change.
+ *
+ * Non-zero - means that the driver is not prepared to perform the tasks
+ * needed achieve this power setting and will cause the state
+ * change to be aborted. NOTE: The prepare() method will also
+ * be called when reverting from lower back to higher power
+ * consumption modes (say because another driver refused a
+ * lower power state change). Drivers are not permitted to
+ * return non-zero values when reverting back to higher power
+ * consumption modes!
+ *
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static int stm3210e_pm_prepare(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ /* No preparation to change power modes is required by the LCD driver. We always
+ * accept the state change by returning OK.
+ */
+
+ return OK;
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm3210e_lcdinitialize
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static inline void stm3210e_lcdinitialize(void)
+{
+ uint16_t id;
+
+ /* Check if the LCD is Orise Tech SPFD5408B Controller (or the compatible RenesasSP
+ * R61580).
+ */
+
+ id = stm3210e_readreg(LCD_REG_0);
+ lcddbg("LCD ID: %04x\n", id);
+
+ /* Check if the ID is for the SPFD5408B */
+
+#if !defined(CONFIG_STM32_SPFD5408B_DISABLE)
+ if (id == SPFD5408B_ID)
+ {
+ /* Set the LCD type for the SPFD5408B */
+
+ g_lcddev.type = LCD_TYPE_SPFD5408B;
+ lcddbg("LCD type: %d\n", g_lcddev.type);
+
+ /* Start Initial Sequence */
+
+ stm3210e_writereg(LCD_REG_1, 0x0100); /* Set SS bit */
+ stm3210e_writereg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
+ stm3210e_writereg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */
+ stm3210e_writereg(LCD_REG_4, 0x0000); /* Resize register */
+ stm3210e_writereg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
+ stm3210e_writereg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
+ stm3210e_writereg(LCD_REG_10, 0x0000); /* FMARK function */
+ stm3210e_writereg(LCD_REG_12, 0x0000); /* RGB 18-bit System interface setting */
+ stm3210e_writereg(LCD_REG_13, 0x0000); /* Frame marker Position */
+ stm3210e_writereg(LCD_REG_15, 0x0000); /* RGB interface polarity, no impact */
+
+ /* Power On sequence */
+
+ stm3210e_writereg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3210e_writereg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ stm3210e_writereg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
+ stm3210e_writereg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
+ up_mdelay(200); /* Dis-charge capacitor power voltage (200ms) */
+
+ stm3210e_writereg(LCD_REG_17, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_16, 0x12B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_18, 0x01bd); /* External reference voltage= Vci */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_19, 0x1400); /* VDV[4:0] for VCOM amplitude */
+ stm3210e_writereg(LCD_REG_41, 0x000e); /* VCM[4:0] for VCOMH */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
+ stm3210e_writereg(LCD_REG_33, 0x013f); /* GRAM Vertical Address */
+
+ /* Adjust the Gamma Curve (SPFD5408B)*/
+
+ stm3210e_writereg(LCD_REG_48, 0x0b0d);
+ stm3210e_writereg(LCD_REG_49, 0x1923);
+ stm3210e_writereg(LCD_REG_50, 0x1c26);
+ stm3210e_writereg(LCD_REG_51, 0x261c);
+ stm3210e_writereg(LCD_REG_52, 0x2419);
+ stm3210e_writereg(LCD_REG_53, 0x0d0b);
+ stm3210e_writereg(LCD_REG_54, 0x1006);
+ stm3210e_writereg(LCD_REG_55, 0x0610);
+ stm3210e_writereg(LCD_REG_56, 0x0706);
+ stm3210e_writereg(LCD_REG_57, 0x0304);
+ stm3210e_writereg(LCD_REG_58, 0x0e05);
+ stm3210e_writereg(LCD_REG_59, 0x0e01);
+ stm3210e_writereg(LCD_REG_60, 0x010e);
+ stm3210e_writereg(LCD_REG_61, 0x050e);
+ stm3210e_writereg(LCD_REG_62, 0x0403);
+ stm3210e_writereg(LCD_REG_63, 0x0607);
+
+ /* Set GRAM area */
+
+ stm3210e_writereg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
+ stm3210e_writereg(LCD_REG_81, 0x00ef); /* Horizontal GRAM End Address */
+ stm3210e_writereg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
+ stm3210e_writereg(LCD_REG_83, 0x013f); /* Vertical GRAM End Address */
+ stm3210e_writereg(LCD_REG_96, 0xa700); /* Gate Scan Line */
+ stm3210e_writereg(LCD_REG_97, 0x0001); /* NDL, VLE, REV */
+ stm3210e_writereg(LCD_REG_106, 0x0000); /* set scrolling line */
+
+ /* Partial Display Control */
+
+ stm3210e_writereg(LCD_REG_128, 0x0000);
+ stm3210e_writereg(LCD_REG_129, 0x0000);
+ stm3210e_writereg(LCD_REG_130, 0x0000);
+ stm3210e_writereg(LCD_REG_131, 0x0000);
+ stm3210e_writereg(LCD_REG_132, 0x0000);
+ stm3210e_writereg(LCD_REG_133, 0x0000);
+
+ /* Panel Control */
+
+ stm3210e_writereg(LCD_REG_144, 0x0010);
+ stm3210e_writereg(LCD_REG_146, 0x0000);
+ stm3210e_writereg(LCD_REG_147, 0x0003);
+ stm3210e_writereg(LCD_REG_149, 0x0110);
+ stm3210e_writereg(LCD_REG_151, 0x0000);
+ stm3210e_writereg(LCD_REG_152, 0x0000);
+
+ /* Set GRAM write direction and BGR=1
+ * I/D=01 (Horizontal : increment, Vertical : decrement)
+ * AM=1 (address is updated in vertical writing direction)
+ */
+
+ stm3210e_writereg(LCD_REG_3, 0x1018);
+ stm3210e_writereg(LCD_REG_7, 0); /* Display OFF */
+ }
+ else
+#endif
+
+ /* Check if the ID is for the almost compatible R61580 */
+
+#if !defined(CONFIG_STM32_R61580_DISABLE)
+ if (id == R61580_ID)
+ {
+ /* Set the LCD type for the R61580 */
+
+ g_lcddev.type = LCD_TYPE_R61580;
+ lcddbg("LCD type: %d\n", g_lcddev.type);
+
+ /* Start Initial Sequence */
+
+ stm3210e_writereg(LCD_REG_0, 0x0000);
+ stm3210e_writereg(LCD_REG_0, 0x0000);
+ up_mdelay(100);
+ stm3210e_writereg(LCD_REG_0, 0x0000);
+ stm3210e_writereg(LCD_REG_0, 0x0000);
+ stm3210e_writereg(LCD_REG_0, 0x0000);
+ stm3210e_writereg(LCD_REG_0, 0x0000);
+ stm3210e_writereg(LCD_REG_164, 0x0001);
+ up_mdelay(100);
+ stm3210e_writereg(LCD_REG_96, 0xa700);
+ stm3210e_writereg(LCD_REG_8, 0x0808);
+
+ /* Gamma Setting */
+
+ stm3210e_writereg(LCD_REG_48, 0x0203);
+ stm3210e_writereg(LCD_REG_49, 0x080f);
+ stm3210e_writereg(LCD_REG_50, 0x0401);
+ stm3210e_writereg(LCD_REG_51, 0x050b);
+ stm3210e_writereg(LCD_REG_52, 0x3330);
+ stm3210e_writereg(LCD_REG_53, 0x0b05);
+ stm3210e_writereg(LCD_REG_54, 0x0005);
+ stm3210e_writereg(LCD_REG_55, 0x0f08);
+ stm3210e_writereg(LCD_REG_56, 0x0302);
+ stm3210e_writereg(LCD_REG_57, 0x3033);
+
+ /* Power Setting */
+
+ stm3210e_writereg(LCD_REG_144, 0x0018); /* 80Hz */
+ stm3210e_writereg(LCD_REG_16, 0x0530); /* BT, AP */
+ stm3210e_writereg(LCD_REG_17, 0x0237); /* DC1,DC0,VC */
+ stm3210e_writereg(LCD_REG_18, 0x01bf);
+ stm3210e_writereg(LCD_REG_19, 0x1000); /* VCOM */
+ up_mdelay(200);
+
+ stm3210e_writereg(LCD_REG_1, 0x0100); /* Set SS bit */
+ stm3210e_writereg(LCD_REG_2, 0x0200);
+ stm3210e_writereg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */
+ stm3210e_writereg(LCD_REG_9, 0x0001);
+ stm3210e_writereg(LCD_REG_10, 0x0008);
+ stm3210e_writereg(LCD_REG_12, 0x0000); /* RGB 18-bit System interface setting */
+ stm3210e_writereg(LCD_REG_13, 0xd000);
+ stm3210e_writereg(LCD_REG_14, 0x0030);
+ stm3210e_writereg(LCD_REG_15, 0x0000); /* RGB interface polarity, no impact */
+ stm3210e_writereg(LCD_REG_32, 0x0000); /* H Start */
+ stm3210e_writereg(LCD_REG_33, 0x0000); /* V Start */
+ stm3210e_writereg(LCD_REG_41, 0x002e);
+ stm3210e_writereg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
+ stm3210e_writereg(LCD_REG_81, 0x00ef); /* Horizontal GRAM End Address */
+ stm3210e_writereg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
+ stm3210e_writereg(LCD_REG_83, 0x013f); /* Vertical GRAM End Address */
+ stm3210e_writereg(LCD_REG_97, 0x0001); /* NDL, VLE, REV */
+ stm3210e_writereg(LCD_REG_106, 0x0000); /* set scrolling line */
+ stm3210e_writereg(LCD_REG_128, 0x0000);
+ stm3210e_writereg(LCD_REG_129, 0x0000);
+ stm3210e_writereg(LCD_REG_130, 0x005f);
+ stm3210e_writereg(LCD_REG_147, 0x0701);
+
+ stm3210e_writereg(LCD_REG_7, 0x0000); /* Display OFF */
+ }
+ else
+#endif
+ {
+#ifndef CONFIG_STM32_AM240320_DISABLE
+ /* Set the LCD type for the AM240320 */
+
+ g_lcddev.type = LCD_TYPE_AM240320;
+ lcddbg("LCD type: %d\n", g_lcddev.type);
+
+ /* Start Initial Sequence */
+
+ stm3210e_writereg(LCD_REG_229, 0x8000); /* Set the internal vcore voltage */
+ stm3210e_writereg(LCD_REG_0, 0x0001); /* Start internal OSC. */
+ stm3210e_writereg(LCD_REG_1, 0x0100); /* Set SS and SM bit */
+ stm3210e_writereg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
+ stm3210e_writereg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */
+ stm3210e_writereg(LCD_REG_4, 0x0000); /* Resize register */
+ stm3210e_writereg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
+ stm3210e_writereg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
+ stm3210e_writereg(LCD_REG_10, 0x0000); /* FMARK function */
+ stm3210e_writereg(LCD_REG_12, 0x0000); /* RGB interface setting */
+ stm3210e_writereg(LCD_REG_13, 0x0000); /* Frame marker Position */
+ stm3210e_writereg(LCD_REG_15, 0x0000); /* RGB interface polarity */
+
+ /* Power On sequence */
+
+ stm3210e_writereg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3210e_writereg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ stm3210e_writereg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
+ stm3210e_writereg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
+ up_mdelay(200); /* Dis-charge capacitor power voltage (200ms) */
+
+ stm3210e_writereg(LCD_REG_16, 0x17b0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3210e_writereg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
+ stm3210e_writereg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
+ up_mdelay(50);
+
+ stm3210e_writereg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
+ stm3210e_writereg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */
+
+ /* Adjust the Gamma Curve */
+
+ stm3210e_writereg(LCD_REG_48, 0x0006);
+ stm3210e_writereg(LCD_REG_49, 0x0101);
+ stm3210e_writereg(LCD_REG_50, 0x0003);
+ stm3210e_writereg(LCD_REG_53, 0x0106);
+ stm3210e_writereg(LCD_REG_54, 0x0b02);
+ stm3210e_writereg(LCD_REG_55, 0x0302);
+ stm3210e_writereg(LCD_REG_56, 0x0707);
+ stm3210e_writereg(LCD_REG_57, 0x0007);
+ stm3210e_writereg(LCD_REG_60, 0x0600);
+ stm3210e_writereg(LCD_REG_61, 0x020b);
+
+ /* Set GRAM area */
+
+ stm3210e_writereg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
+ stm3210e_writereg(LCD_REG_81, 0x00ef); /* Horizontal GRAM End Address */
+ stm3210e_writereg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
+ stm3210e_writereg(LCD_REG_83, 0x013f); /* Vertical GRAM End Address */
+ stm3210e_writereg(LCD_REG_96, 0x2700); /* Gate Scan Line */
+ stm3210e_writereg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
+ stm3210e_writereg(LCD_REG_106, 0x0000); /* Set scrolling line */
+
+ /* Partial Display Control */
+
+ stm3210e_writereg(LCD_REG_128, 0x0000);
+ stm3210e_writereg(LCD_REG_129, 0x0000);
+ stm3210e_writereg(LCD_REG_130, 0x0000);
+ stm3210e_writereg(LCD_REG_131, 0x0000);
+ stm3210e_writereg(LCD_REG_132, 0x0000);
+ stm3210e_writereg(LCD_REG_133, 0x0000);
+
+ /* Panel Control */
+
+ stm3210e_writereg(LCD_REG_144, 0x0010);
+ stm3210e_writereg(LCD_REG_146, 0x0000);
+ stm3210e_writereg(LCD_REG_147, 0x0003);
+ stm3210e_writereg(LCD_REG_149, 0x0110);
+ stm3210e_writereg(LCD_REG_151, 0x0000);
+ stm3210e_writereg(LCD_REG_152, 0x0000);
+
+ /* Set GRAM write direction and BGR = 1
+ *
+ * I/D=01 (Horizontal : increment, Vertical : decrement)
+ * AM=1 (address is updated in vertical writing direction)
+ */
+
+ stm3210e_writereg(LCD_REG_3, 0x1018);
+ stm3210e_writereg(LCD_REG_7, 0); /* Display off */
+#else
+ lcddbg("Unsupported LCD type\n");
+#endif
+ }
+}
+
+/**************************************************************************************
+ * Name: stm3210e_backlight
+ *
+ * Description:
+ * The LCD backlight is driven from PA8 which must be configured as TIM1
+ * CH1. TIM1 must then be configured to output a clock on PA8; the duty
+ * of the clock determineds the backlight level.
+ *
+ **************************************************************************************/
+
+#ifdef CONFIG_LCD_BACKLIGHT
+static void stm3210e_backlight(void)
+{
+#ifdef CONFIG_LCD_PWM
+ uint32_t prescaler;
+ uint32_t reload;
+ uint32_t timclk;
+ uint16_t bdtr;
+ uint16_t ccmr;
+ uint16_t ccer;
+ uint16_t cr2;
+
+ /* Calculate the TIM1 prescaler value */
+
+ prescaler = (STM32_PCLK2_FREQUENCY / CONFIG_LCD_PWMFREQUENCY + 65534) / 65535;
+ if (prescaler < 1)
+ {
+ prescaler = 1;
+ }
+ else if (prescaler > 65536)
+ {
+ prescaler = 65536;
+ }
+
+ /* Calculate the TIM1 reload value */
+
+ timclk = STM32_PCLK2_FREQUENCY / prescaler;
+ reload = timclk / CONFIG_LCD_PWMFREQUENCY;
+
+ if (reload < 1)
+ {
+ reload = 1;
+ }
+ else if (reload > 65535)
+ {
+ reload = 65535;
+ }
+
+ g_lcddev.reload = reload;
+
+ /* Configure PA8 as TIM1 CH1 output */
+
+ stm32_configgpio(GPIO_TIM1_CH1OUT);
+
+ /* Enabled timer 1 clocking */
+
+ modifyreg32(STM32_RCC_APB2ENR, 0, RCC_APB2ENR_TIM1EN);
+
+ /* Reset timer 1 */
+
+ modifyreg32(STM32_RCC_APB2RSTR, 0, RCC_APB2RSTR_TIM1RST);
+ modifyreg32(STM32_RCC_APB2RSTR, RCC_APB2RSTR_TIM1RST, 0);
+
+ /* Reset the Counter Mode and set the clock division */
+
+ putreg16(0, STM32_TIM1_CR1);
+
+ /* Set the Autoreload value */
+
+ putreg16(reload-1, STM32_TIM1_ARR);
+
+ /* Set the Prescaler value */
+
+ putreg16(prescaler-1, STM32_TIM1_PSC);
+
+ /* Generate an update event to reload the Prescaler value immediatly */
+
+ putreg16(ATIM_EGR_UG, STM32_TIM1_EGR);
+
+ /* Reset the Repetition Counter value */
+
+ putreg16(0, STM32_TIM1_RCR);
+
+ /* Set the main output enable (MOE) bit and clear the OSSI and OSSR
+ * bits in the BDTR register.
+ */
+
+ bdtr = getreg16(STM32_TIM1_BDTR);
+ bdtr &= ~(ATIM_BDTR_OSSI | ATIM_BDTR_OSSR);
+ bdtr |= ATIM_BDTR_MOE;
+ putreg16(bdtr, STM32_TIM1_BDTR);
+
+ /* Disable the Channel 1 */
+
+ ccer = getreg16(STM32_TIM1_CCER);
+ ccer &= ~ATIM_CCER_CC1E;
+ putreg16(ccer, STM32_TIM1_CCER);
+
+ /* Get the TIM1 CR2 register value */
+
+ cr2 = getreg16(STM32_TIM1_CR2);
+
+ /* Select the Output Compare Mode Bits */
+
+ ccmr = getreg16(STM32_TIM1_CCMR1);
+ ccmr &= ATIM_CCMR1_OC1M_MASK;
+ ccmr |= (ATIM_CCMR_MODE_PWM1 << ATIM_CCMR1_OC1M_SHIFT);
+ ccmr |= (ATIM_CCMR_CCS_CCOUT << ATIM_CCMR1_CC1S_SHIFT);
+
+ /* Set the power to the minimum value */
+
+ g_lcddev.power = 0;
+ putreg16(0, STM32_TIM1_CCR1);
+
+ /* Select the output polarity level == LOW and enable */
+
+ ccer |= (ATIM_CCER_CC1E );
+
+ /* Reset the Output N Polarity level */
+
+ ccer &= ~(ATIM_CCER_CC1NP|ATIM_CCER_CC1NE);
+
+ /* Reset the Ouput Compare and Output Compare N IDLE State */
+
+ cr2 &= ~(ATIM_CR2_OIS1|ATIM_CR2_OIS1N);
+
+ /* Write the timer configuration */
+
+ putreg16(cr2, STM32_TIM1_CR2);
+ putreg16(ccmr, STM32_TIM1_CCMR1);
+ putreg16(ccer, STM32_TIM1_CCER);
+
+ /* Set the auto preload enable bit */
+
+ modifyreg16(STM32_TIM1_CR1, 0, ATIM_CR1_ARPE);
+
+ /* Enable Backlight Timer */
+
+ ccer |= ATIM_CR1_CEN;
+ putreg16(ccer, STM32_TIM1_CR1);
+
+ /* Dump timer1 registers */
+
+ lcddbg("APB2ENR: %08x\n", getreg32(STM32_RCC_APB2ENR));
+ lcddbg("CR1: %04x\n", getreg32(STM32_TIM1_CR1));
+ lcddbg("CR2: %04x\n", getreg32(STM32_TIM1_CR2));
+ lcddbg("SMCR: %04x\n", getreg32(STM32_TIM1_SMCR));
+ lcddbg("DIER: %04x\n", getreg32(STM32_TIM1_DIER));
+ lcddbg("SR: %04x\n", getreg32(STM32_TIM1_SR));
+ lcddbg("BDTR: %04x\n", getreg32(STM32_TIM1_BDTR));
+ lcddbg("CCMR1: %04x\n", getreg32(STM32_TIM1_CCMR1));
+ lcddbg("CCMR2: %04x\n", getreg32(STM32_TIM1_CCMR2));
+ lcddbg("CCER: %04x\n", getreg32(STM32_TIM1_CCER));
+ lcddbg("CNT: %04x\n", getreg32(STM32_TIM1_CNT));
+ lcddbg("PSC: %04x\n", getreg32(STM32_TIM1_PSC));
+ lcddbg("ARR: %04x\n", getreg32(STM32_TIM1_ARR));
+ lcddbg("RCR: %04x\n", getreg32(STM32_TIM1_RCR));
+ lcddbg("CCR1: %04x\n", getreg32(STM32_TIM1_CCR1));
+ lcddbg("CCR2: %04x\n", getreg32(STM32_TIM1_CCR2));
+ lcddbg("CCR3: %04x\n", getreg32(STM32_TIM1_CCR3));
+ lcddbg("CCR4: %04x\n", getreg32(STM32_TIM1_CCR4));
+ lcddbg("DMAR: %04x\n", getreg32(STM32_TIM1_DMAR));
+#endif
+}
+#endif
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+#ifdef CONFIG_PM
+ int ret;
+#endif
+
+ gvdbg("Initializing\n");
+
+ /* Register to receive power management callbacks */
+
+#ifdef CONFIG_PM
+ ret = pm_register(&g_lcdcb);
+ if (ret != OK)
+ {
+ lcddbg("ERROR: pm_register failed: %d\n", ret);
+ }
+#endif
+
+ /* Configure GPIO pins and configure the FSMC to support the LCD */
+
+ stm32_selectlcd();
+
+ /* Configure and enable LCD */
+
+ up_mdelay(50);
+ stm3210e_lcdinitialize();
+
+ /* Clear the display (setting it to the color 0=black) */
+
+ stm3210e_lcdclear(0);
+
+ /* Turn the backlight off */
+
+ stm3210e_poweroff();
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return &g_lcddev.dev;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ stm3210e_poweroff();
+ stm32_deselectlcd();
+}
+
+/**************************************************************************************
+ * Name: stm3210e_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the STM3210E-EVAL board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * dispaly is cleared by simply setting all GRAM memory to the specified color.
+ *
+ **************************************************************************************/
+
+void stm3210e_lcdclear(uint16_t color)
+{
+ uint32_t i = 0;
+
+ stm3210e_setcursor(0, STM3210E_XRES-1);
+ stm3210e_gramselect();
+ for (i = 0; i < STM3210E_XRES * STM3210E_YRES; i++)
+ {
+ LCD->value = color;
+ }
+}
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_leds.c b/nuttx/configs/stm3210e-eval/src/up_leds.c
new file mode 100644
index 000000000..5a02588ab
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_leds.c
@@ -0,0 +1,401 @@
+/****************************************************************************
+ * configs/stm3210e_eval/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+#include <nuttx/power/pm.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm3210e-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define STM3210E_LED1 (1 << 0)
+#define STM3210E_LED2 (1 << 1)
+#define STM3210E_LED3 (1 << 2)
+#define STM3210E_LED4 (1 << 3)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+#define LED_STARTED_ON_SETBITS ((STM3210E_LED1) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS ((STM3210E_LED1|STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((STM3210E_LED1|STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS ((STM3210E_LED1) << OFF_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_CLRBITS ((STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_IRQSENABLED_ON_SETBITS ((STM3210E_LED1|STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS ((STM3210E_LED2) << OFF_SETBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_CLRBITS ((STM3210E_LED1|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_STACKCREATED_ON_SETBITS ((STM3210E_LED3) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((STM3210E_LED1|STM3210E_LED2|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS ((STM3210E_LED1|STM3210E_LED2) << OFF_SETBITS_SHIFT)
+#define LED_STACKCREATED_OFF_CLRBITS ((STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_INIRQ_ON_SETBITS ((STM3210E_LED1) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((STM3210E_LED1) << OFF_CLRBITS_SHIFT)
+
+#define LED_SIGNAL_ON_SETBITS ((STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((STM3210E_LED2) << OFF_CLRBITS_SHIFT)
+
+#define LED_ASSERTION_ON_SETBITS ((STM3210E_LED4) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_PANIC_ON_SETBITS ((STM3210E_LED4) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+
+/* LED State Controls */
+
+static inline void led_clrbits(unsigned int clrbits);
+static inline void led_setbits(unsigned int setbits);
+static void led_setonoff(unsigned int bits);
+
+/* LED Power Management */
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
+static int led_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
+ LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
+
+ (LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
+ LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
+
+ (LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
+ LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
+
+ (LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
+ LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
+};
+
+#ifdef CONFIG_PM
+static struct pm_callback_s g_ledscb =
+{
+ .notify = led_pm_notify,
+ .prepare = led_pm_prepare,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: led_clrbits
+ *
+ * Description:
+ * Clear all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & STM3210E_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & STM3210E_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((clrbits & STM3210E_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, false);
+ }
+
+ if ((clrbits & STM3210E_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, false);
+ }
+}
+
+/****************************************************************************
+ * Name: led_setbits
+ *
+ * Description:
+ * Set all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & STM3210E_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & STM3210E_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((setbits & STM3210E_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, true);
+ }
+
+ if ((setbits & STM3210E_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, true);
+ }
+}
+
+/****************************************************************************
+ * Name: led_setonoff
+ *
+ * Description:
+ * Set/clear all LEDs to the bit encoded state
+ *
+ ****************************************************************************/
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Name: led_pm_notify
+ *
+ * Description:
+ * Notify the driver of new power state. This callback is called after
+ * all drivers have had the opportunity to prepare for the new power state.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ switch (pmstate)
+ {
+ case(PM_NORMAL):
+ {
+ /* Restore normal LEDs operation */
+
+ }
+ break;
+
+ case(PM_IDLE):
+ {
+ /* Entering IDLE mode - Turn leds off */
+
+ }
+ break;
+
+ case(PM_STANDBY):
+ {
+ /* Entering STANDBY mode - Logic for PM_STANDBY goes here */
+
+ }
+ break;
+
+ case(PM_SLEEP):
+ {
+ /* Entering SLEEP mode - Logic for PM_SLEEP goes here */
+
+ }
+ break;
+
+ default:
+ {
+ /* Should not get here */
+
+ }
+ break;
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: led_pm_prepare
+ *
+ * Description:
+ * Request the driver to prepare for a new power state. This is a warning
+ * that the system is about to enter into a new power state. The driver
+ * should begin whatever operations that may be required to enter power
+ * state. The driver may abort the state change mode by returning a
+ * non-zero value from the callback function.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static int led_pm_prepare(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ /* No preparation to change power modes is required by the LEDs driver.
+ * We always accept the state change by returning OK.
+ */
+
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledpminitialize
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+void up_ledpminitialize(void)
+{
+ /* Register to receive power management callbacks */
+
+ int ret = pm_register(&g_ledscb);
+ if (ret != OK)
+ {
+ up_ledon(LED_ASSERTION);
+ }
+}
+#endif /* CONFIG_PM */
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3210e-eval/src/up_lm75.c b/nuttx/configs/stm3210e-eval/src/up_lm75.c
new file mode 100644
index 000000000..d1bb288ff
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_lm75.c
@@ -0,0 +1,128 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_lm75.c
+ * arch/arm/src/board/up_lm75.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+
+#include <nuttx/i2c.h>
+#include <nuttx/sensors/lm75.h>
+
+#include "stm32.h"
+#include "stm32_i2c.h"
+#include "stm3210e-internal.h"
+
+#if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75) && defined(CONFIG_STM32_I2C1)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_lm75initialize
+ *
+ * Description:
+ * Initialize and register the LM-75 Temperature Sensor driver.
+ *
+ * Input parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/temp0"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ************************************************************************************/
+
+int stm32_lm75initialize(FAR const char *devpath)
+{
+ FAR struct i2c_dev_s *i2c;
+ int ret;
+
+ /* Configure PB.5 as Input pull-up. This pin can be used as a temperature
+ * sensor interrupt (not fully implemented).
+ */
+
+ stm32_configgpio(GPIO_LM75_OSINT);
+
+ /* Get an instance of the I2C1 interface */
+
+ i2c = up_i2cinitialize(1);
+ if (!i2c)
+ {
+ return -ENODEV;
+ }
+
+ /* Then register the temperature sensor */
+
+ ret = lm75_register(devpath, i2c, 0x48);
+ if (ret < 0)
+ {
+ (void)up_i2cuninitialize(i2c);
+ }
+ return ret;
+}
+
+/************************************************************************************
+ * Name: stm32_lm75attach
+ *
+ * Description:
+ * Attach the LM-75 interrupt handler
+ *
+ * Input parameters:
+ * irqhandler - the LM-75 interrupt handler
+ *
+ * Returned Value:
+ * The previous LM-75 interrupt handler
+ *
+ ************************************************************************************/
+
+xcpt_t stm32_lm75attach(xcpt_t irqhandler)
+{
+ return stm32_gpiosetevent(GPIO_LM75_OSINT, true, true, true, irqhandler);
+}
+
+#endif /* CONFIG_I2C && CONFIG_I2C_LM75 && CONFIG_STM32_I2C1 */
diff --git a/nuttx/configs/stm3210e-eval/src/up_nsh.c b/nuttx/configs/stm3210e-eval/src/up_nsh.c
new file mode 100644
index 000000000..3e7c2013c
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_nsh.c
@@ -0,0 +1,213 @@
+/****************************************************************************
+ * config/stm3210e_eval/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_STM32_SPI1
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+#endif
+
+#ifdef CONFIG_STM32_SDIO
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "stm32_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* For now, don't build in any SPI1 support -- NSH is not using it */
+
+#undef CONFIG_STM32_SPI1
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_STM3210E_EVAL
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new STM32 boards here */
+# error "Unrecognized STM32 board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef CONFIG_STM32_SPI1
+ FAR struct spi_dev_s *spi;
+ FAR struct mtd_dev_s *mtd;
+#endif
+#ifdef NSH_HAVEMMCSD
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+#endif
+
+ /* Configure SPI-based devices */
+
+#ifdef CONFIG_STM32_SPI1
+ /* Get the SPI port */
+
+ message("nsh_archinitialize: Initializing SPI port 1\n");
+ spi = up_spiinitialize(1);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port 0\n");
+ return -ENODEV;
+ }
+ message("nsh_archinitialize: Successfully initialized SPI port 0\n");
+
+ /* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */
+
+ message("nsh_archinitialize: Bind SPI to the SPI flash driver\n");
+ mtd = m25p_initialize(spi);
+ if (!mtd)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n");
+ return -ENODEV;
+ }
+ message("nsh_archinitialize: Successfully bound SPI port 0 to the SPI FLASH driver\n");
+#warning "Now what are we going to do with this SPI FLASH driver?"
+#endif
+
+ /* Create the SPI FLASH MTD instance */
+ /* The M25Pxx is not a give media to implement a file system..
+ * its block sizes are too large
+ */
+
+ /* Mount the SDIO-based MMC/SD block driver */
+
+#ifdef NSH_HAVEMMCSD
+ /* First, get an instance of the SDIO interface */
+
+ message("nsh_archinitialize: Initializing SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/stm3210e-eval/src/up_pm.c b/nuttx/configs/stm3210e-eval/src/up_pm.c
new file mode 100644
index 000000000..3aa60bf5a
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_pm.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_pm.c
+ * arch/arm/src/board/up_pm.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/power/pm.h>
+
+#include "up_internal.h"
+#include "stm32_pm.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_PM
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_pminitialize
+ *
+ * Description:
+ * This function is called by MCU-specific logic at power-on reset in
+ * order to provide one-time initialization the power management subystem.
+ * This function must be called *very* early in the intialization sequence
+ * *before* any other device drivers are initialized (since they may
+ * attempt to register with the power management subsystem).
+ *
+ * Input parameters:
+ * None.
+ *
+ * Returned value:
+ * None.
+ *
+ ****************************************************************************/
+
+void up_pminitialize(void)
+{
+ /* Then initialize the NuttX power management subsystem proper */
+
+ pm_initialize();
+
+#if defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
+ /* Initialize the buttons to wake up the system from low power modes */
+
+ up_pmbuttons();
+#endif
+
+ /* Initialize the LED PM */
+
+ up_ledpminitialize();
+}
+
+#endif /* CONFIG_PM */
diff --git a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c
new file mode 100644
index 000000000..c0f16ee8c
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c
@@ -0,0 +1,319 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_pmbuttons.c
+ * arch/arm/src/board/up_pmbuttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <arch/board/board.h>
+#include <nuttx/config.h>
+
+#include <nuttx/power/pm.h>
+#include <arch/irq.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include "up_arch.h"
+#include "nvic.h"
+#include "stm32_pwr.h"
+#include "stm32_pm.h"
+#include "stm3210e-internal.h"
+
+#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_ARCH_BUTTONS
+# error "CONFIG_ARCH_BUTTONS is not defined in the configuration"
+#endif
+
+#define BUTTON_MIN 0
+#define BUTTON_MAX 7
+
+#ifndef CONFIG_PM_BUTTONS_MIN
+# define CONFIG_PM_BUTTONS_MIN BUTTON_MIN
+#endif
+#ifndef CONFIG_PM_BUTTONS_MAX
+# define CONFIG_PM_BUTTONS_MAX BUTTON_MAX
+#endif
+
+#if CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX
+# error "CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX"
+#endif
+#if CONFIG_PM_BUTTONS_MAX > 7
+# error "CONFIG_PM_BUTTONS_MAX > 7"
+#endif
+
+#ifndef CONFIG_ARCH_IRQBUTTONS
+# warning "CONFIG_ARCH_IRQBUTTONS is not defined in the configuration"
+#endif
+
+#ifndef CONFIG_PM_IRQBUTTONS_MIN
+# define CONFIG_PM_IRQBUTTONS_MIN CONFIG_PM_BUTTONS_MIN
+#endif
+#ifndef CONFIG_PM_IRQBUTTONS_MAX
+# define CONFIG_PM_IRQBUTTONS_MAX CONFIG_PM_BUTTONS_MAX
+#endif
+
+#if CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX
+# error "CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX"
+#endif
+#if CONFIG_PM_IRQBUTTONS_MAX > 7
+# error "CONFIG_PM_IRQBUTTONS_MAX > 7"
+#endif
+
+#ifndef CONFIG_PM_BUTTON_ACTIVITY
+# define CONFIG_PM_BUTTON_ACTIVITY 10
+#endif
+
+/* Miscellaneous Definitions ************************************************/
+
+#ifndef MIN
+# define MIN(a,b) (a < b ? a : b)
+#endif
+#ifndef MAX
+# define MAX(a,b) (a > b ? a : b)
+#endif
+
+#define MIN_BUTTON MIN(CONFIG_PM_BUTTONS_MIN, CONFIG_PM_IRQBUTTONS_MIN)
+#define MAX_BUTTON MAX(CONFIG_PM_BUTTONS_MAX, CONFIG_PM_IRQBUTTONS_MAX)
+
+#define NUM_PMBUTTONS (MAX_BUTTON - MIN_BUTTON + 1)
+#define BUTTON_INDEX(b) ((b)-MIN_BUTTON)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static void button_handler(int id, int irq);
+
+#if MIN_BUTTON < 1
+static int button0_handler(int irq, FAR void *context);
+#endif
+#if MIN_BUTTON < 2 && MAX_BUTTON > 0
+static int button1_handler(int irq, FAR void *context);
+#endif
+#if MIN_BUTTON < 3 && MAX_BUTTON > 1
+static int button2_handler(int irq, FAR void *context);
+#endif
+#if MIN_BUTTON < 4 && MAX_BUTTON > 2
+static int button3_handler(int irq, FAR void *context);
+#endif
+#if MIN_BUTTON < 5 && MAX_BUTTON > 3
+static int button4_handler(int irq, FAR void *context);
+#endif
+#if MIN_BUTTON < 6 && MAX_BUTTON > 4
+static int button5_handler(int irq, FAR void *context);
+#endif
+#if MIN_BUTTON < 7 && MAX_BUTTON > 5
+static int button6_handler(int irq, FAR void *context);
+#endif
+#if MAX_BUTTON > 6
+static int button7_handler(int irq, FAR void *context);
+#endif
+#endif /* CONFIG_ARCH_IRQBUTTONS */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Button interrupt handlers */
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static const xcpt_t g_buttonhandlers[NUM_PMBUTTONS] =
+{
+#if MIN_BUTTON < 1
+ button0_handler,
+#endif
+#if MIN_BUTTON < 2 && MAX_BUTTON > 0
+ button1_handler,
+#endif
+#if MIN_BUTTON < 3 && MAX_BUTTON > 1
+ button2_handler,
+#endif
+#if MIN_BUTTON < 4 && MAX_BUTTON > 2
+ button3_handler,
+#endif
+#if MIN_BUTTON < 5 && MAX_BUTTON > 3
+ button4_handler,
+#endif
+#if MIN_BUTTON < 6 && MAX_BUTTON > 4
+ button5_handler,
+#endif
+#if MIN_BUTTON < 7 && MAX_BUTTON > 5
+ button6_handler,
+#endif
+#if MAX_BUTTON > 6
+ button7_handler,
+#endif
+};
+#endif /* CONFIG_ARCH_IRQBUTTONS */
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: button_handler
+ *
+ * Description:
+ * Handle a button wake-up interrupt
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static void button_handler(int id, int irq)
+{
+ /* At this point the MCU should have already awakened. The state
+ * change will be handled in the IDLE loop when the system is re-awakened
+ * The button interrupt handler should be totally ignorant of the PM
+ * activities and should report button activity as if nothing
+ * special happened.
+ */
+
+ pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
+}
+
+#if MIN_BUTTON < 1
+static int button0_handler(int irq, FAR void *context)
+{
+ button_handler(0, irq);
+ return OK;
+}
+#endif
+
+#if MIN_BUTTON < 2 && MAX_BUTTON > 0
+static int button1_handler(int irq, FAR void *context)
+{
+ button_handler(1, irq);
+ return OK;
+}
+#endif
+
+#if MIN_BUTTON < 3 && MAX_BUTTON > 1
+static int button2_handler(int irq, FAR void *context)
+{
+ button_handler(2, irq);
+ return OK;
+}
+#endif
+
+#if MIN_BUTTON < 4 && MAX_BUTTON > 2
+static int button3_handler(int irq, FAR void *context)
+{
+ button_handler(3, irq);
+ return OK;
+}
+#endif
+
+#if MIN_BUTTON < 5 && MAX_BUTTON > 3
+static int button4_handler(int irq, FAR void *context)
+{
+ button_handler(4, irq);
+ return OK;
+}
+#endif
+
+#if MIN_BUTTON < 6 && MAX_BUTTON > 4
+static int button5_handler(int irq, FAR void *context)
+{
+ button_handler(5, irq);
+ return OK;
+}
+#endif
+
+#if MIN_BUTTON < 7 && MAX_BUTTON > 5
+static int button6_handler(int irq, FAR void *context)
+{
+ button_handler(6, irq);
+ return OK;
+}
+#endif
+
+#if MAX_BUTTON > 6
+static int button7_handler(int irq, FAR void *context)
+{
+ button_handler(7, irq);
+ return OK;
+}
+#endif
+#endif /* CONFIG_ARCH_IRQBUTTONS */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_pmbuttons
+ *
+ * Description:
+ * Configure all the buttons of the STM3210e-eval board as EXTI,
+ * so any button is able to wakeup the MCU from the PM_STANDBY mode
+ *
+ ****************************************************************************/
+
+void up_pmbuttons(void)
+{
+ /* Initialize the button GPIOs */
+
+ up_buttoninit();
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+ int i;
+ for (i = CONFIG_PM_IRQBUTTONS_MIN; i <= CONFIG_PM_IRQBUTTONS_MAX; i++)
+ {
+ xcpt_t oldhandler = up_irqbutton(i, g_buttonhandlers[BUTTON_INDEX(i)]);
+
+ if (oldhandler != NULL)
+ {
+ lib_lowprintf("WARNING: oldhandler:%p is not NULL! "
+ "Button events may be lost or aliased!\n",
+ oldhandler);
+ }
+ }
+#endif
+}
+
+#endif /* defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) */
diff --git a/nuttx/configs/stm3210e-eval/src/up_selectlcd.c b/nuttx/configs/stm3210e-eval/src/up_selectlcd.c
new file mode 100644
index 000000000..3afc79835
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_selectlcd.c
@@ -0,0 +1,146 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_selectlcd.c
+ * arch/arm/src/board/up_selectlcd.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* 512Kx16 SRAM is connected to bank2 of the FSMC interface and both 8- and 16-bit
+ * accesses are allowed by BLN0 and BLN1 connected to BLE and BHE of SRAM,
+ * respectively.
+ *
+ * Pin Usage (per schematic)
+ * FLASH SRAM NAND LCD
+ * D[0..15] [0..15] [0..15] [0..7] [0..15]
+ * A[0..23] [0..22] [0..18] [16,17] [0]
+ * FSMC_NBL0 PE0 OUT ~BLE --- --- ---
+ * FSMC_NBL1 PE1 OUT ~BHE --- --- ---
+ * FSMC_NE2 PG9 OUT --- ~E --- ---
+ * FSMC_NE3 PG10 OUT ~CE --- --- ---
+ * FSMC_NE4 PG12 OUT --- --- --- ~CS
+ * FSMC_NWE PD5 OUT ~WE ~W ~W ~WR/SCL
+ * FSMC_NOE PD4 OUT ~OE ~G ~R ~RD
+ * FSMC_NWAIT PD6 IN --- R~B --- ---
+ * FSMC_INT2 PG6* IN --- --- R~B ---
+ *
+ * *JP7 will switch to PD6
+ */
+
+/* GPIO configurations unique to the LCD */
+
+static const uint16_t g_lcdconfig[] =
+{
+ /* NE4 */
+
+ GPIO_NPS_NE4
+};
+#define NLCD_CONFIG (sizeof(g_lcdconfig)/sizeof(uint16_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+void stm32_selectlcd(void)
+{
+ /* Configure new GPIO state */
+
+ stm32_extmemgpios(g_commonconfig, NCOMMON_CONFIG);
+ stm32_extmemgpios(g_lcdconfig, NLCD_CONFIG);
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Bank4 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR4);
+
+ /* Bank4 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(1)|FSMC_BTR_ADDHLD(0)|FSMC_BTR_DATAST(2)|FSMC_BTR_BUSTRUN(0)|
+ FSMC_BTR_CLKDIV(0)|FSMC_BTR_DATLAT(0)|FSMC_BTR_ACCMODA, STM32_FSMC_BTR4);
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR4);
+
+ /* Enable the bank by setting the MBKEN bit */
+
+ putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR4);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_selectnor.c b/nuttx/configs/stm3210e-eval/src/up_selectnor.c
new file mode 100644
index 000000000..9ee1ad34f
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_selectnor.c
@@ -0,0 +1,140 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_selectnor.c
+ * arch/arm/src/board/up_selectnor.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* Pin Usage (per schematic)
+ *
+ * FLASH SRAM NAND LCD
+ * D[0..15] [0..15] [0..15] [0..7] [0..15]
+ * A[0..23] [0..22] [0..18] [16,17] [0]
+ * FSMC_NBL0 PE0 OUT ~BLE --- --- ---
+ * FSMC_NBL1 PE1 OUT ~BHE --- --- ---
+ * FSMC_NE2 PG9 OUT --- ~E --- ---
+ * FSMC_NE3 PG10 OUT ~CE --- --- ---
+ * FSMC_NE4 PG12 OUT --- --- --- ~CS
+ * FSMC_NWE PD5 OUT ~WE ~W ~W ~WR/SCL
+ * FSMC_NOE PD4 OUT ~OE ~G ~R ~RD
+ * FSMC_NWAIT PD6 IN --- R~B --- ---
+ * FSMC_INT2 PG6* IN --- --- R~B ---
+ *
+ * *JP7 will switch to PD6
+ */
+
+/* GPIO configurations unique to NOR Flash */
+
+static const uint16_t g_norconfig[] =
+{
+ /* A19... A22 */
+
+ GPIO_NPS_A19, GPIO_NPS_A20, GPIO_NPS_A21, GPIO_NPS_A22,
+
+ /* NE2 */
+
+ GPIO_NPS_NE2
+};
+#define NNOR_CONFIG (sizeof(g_norconfig)/sizeof(uint16_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectnor
+ *
+ * Description:
+ * Initialize to access NOR flash
+ *
+ ************************************************************************************/
+
+void stm32_selectnor(void)
+{
+ /* Configure new GPIO state */
+
+ stm32_extmemgpios(g_commonconfig, NCOMMON_CONFIG);
+ stm32_extmemgpios(g_norconfig, NNOR_CONFIG);
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Bank1 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_NOR|FSMC_BCR_FACCEN|FSMC_BCR_MWID16|FSMC_BCR_WREN, STM32_FSMC_BCR2);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(3)|FSMC_BTR_ADDHLD(1)|FSMC_BTR_DATAST(6)|FSMC_BTR_BUSTRUN(1)|
+ FSMC_BTR_CLKDIV(1)|FSMC_BTR_DATLAT(2)|FSMC_BTR_ACCMODB, STM32_FSMC_BTR2);
+
+ putreg32(0x0fffffff, STM32_FSMC_BWTR2);
+
+ /* Enable the bank */
+
+ putreg32(FSMC_BCR_MBKEN|FSMC_BCR_NOR|FSMC_BCR_FACCEN|FSMC_BCR_MWID16|FSMC_BCR_WREN, STM32_FSMC_BCR2);
+}
+#endif /* CONFIG_STM32_FSMC */
diff --git a/nuttx/configs/stm3210e-eval/src/up_selectsram.c b/nuttx/configs/stm3210e-eval/src/up_selectsram.c
new file mode 100644
index 000000000..3035110c8
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_selectsram.c
@@ -0,0 +1,146 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_selectsram.c
+ * arch/arm/src/board/up_selectsram.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* 512Kx16 SRAM is connected to bank2 of the FSMC interface and both 8- and 16-bit
+ * accesses are allowed by BLN0 and BLN1 connected to BLE and BHE of SRAM,
+ * respectively.
+ *
+ * Pin Usage (per schematic)
+ * FLASH SRAM NAND LCD
+ * D[0..15] [0..15] [0..15] [0..7] [0..15]
+ * A[0..23] [0..22] [0..18] [16,17] [0]
+ * FSMC_NBL0 PE0 OUT ~BLE --- --- ---
+ * FSMC_NBL1 PE1 OUT ~BHE --- --- ---
+ * FSMC_NE2 PG9 OUT --- ~E --- ---
+ * FSMC_NE3 PG10 OUT ~CE --- --- ---
+ * FSMC_NE4 PG12 OUT --- --- --- ~CS
+ * FSMC_NWE PD5 OUT ~WE ~W ~W ~WR/SCL
+ * FSMC_NOE PD4 OUT ~OE ~G ~R ~RD
+ * FSMC_NWAIT PD6 IN --- R~B --- ---
+ * FSMC_INT2 PG6* IN --- --- R~B ---
+ *
+ * *JP7 will switch to PD6
+ */
+
+/* GPIO configurations unique to SRAM */
+
+static const uint16_t g_sramconfig[] =
+{
+ /* NE3, NBL0, NBL1, */
+
+ GPIO_NPS_NE3, GPIO_NPS_NBL0, GPIO_NPS_NBL1
+};
+#define NSRAM_CONFIG (sizeof(g_sramconfig)/sizeof(uint16_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectsram
+ *
+ * Description:
+ * Initialize to access external SRAM
+ *
+ ************************************************************************************/
+
+void stm32_selectsram(void)
+{
+ /* Configure new GPIO state */
+
+ stm32_extmemgpios(g_commonconfig, NCOMMON_CONFIG);
+ stm32_extmemgpios(g_sramconfig, NSRAM_CONFIG);
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Bank1 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_MWID16|FSMC_BCR_WREN, STM32_FSMC_BCR3);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(1)|FSMC_BTR_ADDHLD(1)|FSMC_BTR_DATAST(3)|FSMC_BTR_BUSTRUN(1)|
+ FSMC_BTR_CLKDIV(1)|FSMC_BTR_DATLAT(2)|FSMC_BTR_ACCMODA, STM32_FSMC_BTR3);
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR3);
+
+ /* Enable the bank */
+
+ putreg32(FSMC_BCR_MBKEN|FSMC_BCR_MWID16|FSMC_BCR_WREN, STM32_FSMC_BCR3);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_spi.c b/nuttx/configs/stm3210e-eval/src/up_spi.c
new file mode 100644
index 000000000..ea8670b18
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_spi.c
@@ -0,0 +1,178 @@
+/************************************************************************************
+ * configs/stm3210e_eval/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "stm3210e-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3210E-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI1 and/or SPI2 was already provided in stm32_rcc.c.
+ * Configurations of SPI pins is performed in stm32_spi.c.
+ * Here, we only initialize chip select pins unique to the board
+ * architecture.
+ */
+
+#ifdef CONFIG_STM32_SPI1
+ /* Configure the SPI-based FLASH CS GPIO */
+
+ stm32_configgpio(GPIO_FLASH_CS);
+#endif
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ if (devid == SPIDEV_FLASH)
+ {
+ /* Set the GPIO low to select and high to de-select */
+
+ stm32_gpiowrite(GPIO_FLASH_CS, !selected);
+ }
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/stm3210e-eval/src/up_usbdev.c b/nuttx/configs/stm3210e-eval/src/up_usbdev.c
new file mode 100644
index 000000000..2ac9e50f4
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_usbdev.c
@@ -0,0 +1,116 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "stm3210e-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the STM3210E-EVAL board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* USB Soft Connect Pullup: PB.14 */
+
+ stm32_configgpio(GPIO_USB_PULLUP);
+}
+
+/************************************************************************************
+ * Name: stm32_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide stm32_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+ stm32_gpiowrite(GPIO_USB_PULLUP, !enable);
+ return OK;
+}
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+
diff --git a/nuttx/configs/stm3210e-eval/src/up_usbmsc.c b/nuttx/configs/stm3210e-eval/src/up_usbmsc.c
new file mode 100644
index 000000000..dce463abc
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_usbmsc.c
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_usbmsc.c
+ *
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the STM32 MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "stm32_internal.h"
+
+/* There is nothing to do here if SDIO support is not selected. */
+
+#ifdef CONFIG_STM32_SDIO
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_STM3210E_EVAL
+# undef STM32_MMCSDSLOTNO
+# define STM32_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new STM32 boards here */
+# error "Unrecognized STM32 board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("usbmsc_archinitialize: "
+ "Initializing SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+
+ sdio = sdio_initialize(STM32_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ message("usbmsc_archinitialize: "
+ "Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_EXAMPLES_USBMSC_DEVMINOR1);
+
+ ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, sdio);
+ if (ret != OK)
+ {
+ message("usbmsc_archinitialize: "
+ "Failed to bind SDIO to the MMC/SD driver: %d\n",
+ ret);
+ return ret;
+ }
+ message("usbmsc_archinitialize: "
+ "Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+
+#endif /* CONFIG_EXAMPLES_USBMSC_BUILTIN */
+
+ return OK;
+}
+
+#endif /* CONFIG_STM32_SDIO */
diff --git a/nuttx/configs/stm3210e-eval/src/up_watchdog.c b/nuttx/configs/stm3210e-eval/src/up_watchdog.c
new file mode 100644
index 000000000..0c09f7549
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/stm3210e-eval/tools/olimex-arm-usb-ocd.cfg b/nuttx/configs/stm3210e-eval/tools/olimex-arm-usb-ocd.cfg
new file mode 100644
index 000000000..9752dd418
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/tools/olimex-arm-usb-ocd.cfg
@@ -0,0 +1,13 @@
+#
+# Olimex ARM-USB-OCD
+#
+# http://www.olimex.com/dev/arm-usb-ocd.html
+#
+
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG"
+ft2232_layout olimex-jtag
+ft2232_vid_pid 0x15ba 0x0003
+
+#jtag_khz 600
+
diff --git a/nuttx/configs/stm3210e-eval/tools/oocd.sh b/nuttx/configs/stm3210e-eval/tools/oocd.sh
new file mode 100755
index 000000000..d2cd6ae27
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/tools/oocd.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+# Get command line parameters
+
+USAGE="USAGE: $0 [-dh] <TOPDIR>"
+ADVICE="Try '$0 -h' for more information"
+
+
+while [ ! -z "$1" ]; do
+ case $1 in
+ -d )
+ set -x
+ ;;
+ -h )
+ echo "$0 is a tool for generation of proper version files for the NuttX build"
+ echo ""
+ echo $USAGE
+ echo ""
+ echo "Where:"
+ echo " -d"
+ echo " Enable script debug"
+ echo " -h"
+ echo " show this help message and exit"
+ echo " Use the OpenOCD 0.4.0"
+ echo " <TOPDIR>"
+ echo " The full path to the top-level NuttX directory"
+ exit 0
+ ;;
+ * )
+ break;
+ ;;
+ esac
+ shift
+done
+
+TOPDIR=$1
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ echo $ADVICE
+ exit 1
+fi
+
+# This script *probably* only works with the following versions of OpenOCD:
+
+# Local search directory and configurations
+
+OPENOCD_SEARCHDIR="${TOPDIR}/configs/stm3210e-eval/tools"
+OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`"
+
+OPENOCD_PATH="/cygdrive/c/Program Files (x86)/OpenOCD/0.4.0/bin"
+OPENOCD_EXE=openocd.exe
+OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg"
+
+
+OPENOCD_TARGET="stm32.cfg"
+OPENOCD_ARGS="-s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}"
+
+echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+
+# Verify that everything is what it claims it is and is located where it claims it is.
+
+if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then
+ echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+fi
+if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}" ]; then
+ echo "OpenOCD target config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}"
+ exit 1
+fi
+if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}" ]; then
+ echo "OpenOCD interface config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}"
+ exit 1
+fi
+
+# Enable debug if so requested
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+# Okay... do it!
+
+echo "Starting OpenOCD"
+"${OPENOCD_PATH}/${OPENOCD_EXE}" ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
+
diff --git a/nuttx/configs/stm3210e-eval/tools/stm32.cfg b/nuttx/configs/stm3210e-eval/tools/stm32.cfg
new file mode 100644
index 000000000..463a85cfd
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/tools/stm32.cfg
@@ -0,0 +1,69 @@
+# script for stm32
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME stm32
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+# Work-area is a space in RAM used for flash programming
+# By default use 16kB
+if { [info exists WORKAREASIZE] } {
+ set _WORKAREASIZE $WORKAREASIZE
+} else {
+ set _WORKAREASIZE 0x4000
+}
+
+# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
+jtag_khz 1000
+
+jtag_nsrst_delay 100
+jtag_ntrst_delay 100
+
+#jtag scan chain
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ # See STM Document RM0008
+ # Section 26.6.3
+ set _CPUTAPID 0x3ba00477
+}
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+if { [info exists BSTAPID ] } {
+ # FIXME this never gets used to override defaults...
+ set _BSTAPID $BSTAPID
+} else {
+ # See STM Document RM0008
+ # Section 29.6.2
+ # Low density devices, Rev A
+ set _BSTAPID1 0x06412041
+ # Medium density devices, Rev A
+ set _BSTAPID2 0x06410041
+ # Medium density devices, Rev B and Rev Z
+ set _BSTAPID3 0x16410041
+ # High density devices, Rev A
+ set _BSTAPID4 0x06414041
+ # Connectivity line devices, Rev A and Rev Z
+ set _BSTAPID5 0x06418041
+}
+jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
+ -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
+ -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
+
+$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME stm32x 0 0 0 0 $_TARGETNAME
+
+# For more information about the configuration files, take a look at:
+# openocd.texi
diff --git a/nuttx/configs/stm3210e-eval/tools/usb-driver.txt b/nuttx/configs/stm3210e-eval/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/stm3210e-eval/usbserial/Make.defs b/nuttx/configs/stm3210e-eval/usbserial/Make.defs
new file mode 100644
index 000000000..368d73e6f
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbserial/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/usbserial/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/usbserial/appconfig b/nuttx/configs/stm3210e-eval/usbserial/appconfig
new file mode 100644
index 000000000..fecff045b
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbserial/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/usbserial/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbserial
+
diff --git a/nuttx/configs/stm3210e-eval/usbserial/defconfig b/nuttx/configs/stm3210e-eval/usbserial/defconfig
new file mode 100755
index 000000000..b3d182bde
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbserial/defconfig
@@ -0,0 +1,516 @@
+############################################################################
+# configs/stm3210e-eval/usbserial/defconfig
+#
+# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=y
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="usbserial_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=10
+CONFIG_START_DAY=23
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_COMPOSITE=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration (Prolific PL2303 Emulation)
+#
+CONFIG_PL2303=y
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_COMPOSITE=y
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_COMPOSITE=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=n
+CONFIG_EXAMPLES_USBTERM_BUFLEN=256
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/usbserial/setenv.sh b/nuttx/configs/stm3210e-eval/usbserial/setenv.sh
new file mode 100755
index 000000000..046a7f5ac
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbserial/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/stm3210e-eval/ostest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3210e-eval/usbstorage/Make.defs b/nuttx/configs/stm3210e-eval/usbstorage/Make.defs
new file mode 100644
index 000000000..9af081cd1
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbstorage/Make.defs
@@ -0,0 +1,175 @@
+############################################################################
+# configs/stm3210e-eval/usbstorage/Make.defs
+#
+# Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3210e-eval/usbstorage/appconfig b/nuttx/configs/stm3210e-eval/usbstorage/appconfig
new file mode 100644
index 000000000..646e4f4ed
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3210e-eval/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/stm3210e-eval/usbstorage/defconfig b/nuttx/configs/stm3210e-eval/usbstorage/defconfig
new file mode 100755
index 000000000..3a2a2d571
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbstorage/defconfig
@@ -0,0 +1,503 @@
+############################################################################
+# configs/stm3210e-eval/usbstorage/defconfig
+#
+# Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103ZET6=y
+CONFIG_ARCH_BOARD="stm3210e-eval"
+CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=y
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=y
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI4=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_USB=y
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_BKP=n
+CONFIG_STM32_PWR=n
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+#
+# Timer and I2C devices may need to the following to force power to be applied:
+#
+#CONFIG_STM32_FORCEPOWER=y
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM3210E-EVAL specific LCD settings
+#
+CONFIG_STM32_AM240320_DISABLE=n
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=30
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3210e-eval/usbstorage/setenv.sh b/nuttx/configs/stm3210e-eval/usbstorage/setenv.sh
new file mode 100755
index 000000000..ee33a8d21
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/usbstorage/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/stm3210e-eval/dfu/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/Kconfig b/nuttx/configs/stm3220g-eval/Kconfig
new file mode 100644
index 000000000..33e172cfc
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/Kconfig
@@ -0,0 +1,42 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_STM3220G_EVAL
+
+config STM3220G_LCD
+ bool "Select support for the STM3210E-EVAL LCD"
+ default y
+ depends on LCD && STM32_FSMC
+ ---help---
+ Enable support for the LCD on the STM3220G-EVAL board. See additional,
+ LCD-common settings in the drivers/lcd Kconfig file.
+
+config LCD_RDSHIFT
+ int "LCD data shift"
+ default 5
+ depends on STM3220G_LCD
+ ---help---
+ When reading 16-bit gram data, there appears to be a shift in the returned
+ data. This value fixes the offset. Default 5.
+
+config CONFIG_STM32_ILI9320_DISABLE
+ bool "Disable LCD_ILI9320 (and LCD_ILI9321) support"
+ default n
+ depends on STM3220G_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option.
+
+config CONFIG_STM32_ILI9325_DISABLE
+ bool "Disable LCD_ILI9325 support"
+ default n
+ depends on STM3220G_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option
+
+endif
diff --git a/nuttx/configs/stm3220g-eval/README.txt b/nuttx/configs/stm3220g-eval/README.txt
new file mode 100644
index 000000000..04585f69f
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/README.txt
@@ -0,0 +1,1015 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the
+STMicro STM3220G-EVAL development board.
+
+Contents
+========
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - STM3220G-EVAL-specific Configuration Options
+ - LEDs
+ - Ethernet
+ - PWM
+ - CAN
+ - FSMC SRAM
+ - I/O Expanders
+ - STM3220G-EVAL-specific Configuration Options
+ - Configurations
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Raisonance R-Link emulatator and some RIDE7 development tools
+ were used and those tools works only under Windows.
+
+GNU Toolchain Options
+=====================
+
+ Toolchain Configurations
+ ------------------------
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The Atollic Toolchain,
+ 3. The devkitARM GNU toolchain,
+ 4. Raisonance GNU toolchain, or
+ 5. The NuttX buildroot Toolchain (see below).
+
+ Most testing has been conducted using the CodeSourcery toolchain for Windows and
+ that is the default toolchain in most configurations. To use the Atollic
+ devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_ATOLLIC_LITE=y : The free, "Lite" version of Atollic toolchain under Windows
+ CONFIG_STM32_ATOLLIC_PRO=y : The paid, "Pro" version of Atollic toolchain under Windows
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you change the default toolchain, then you may also have to modify the PATH in
+ the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), Atollic, devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ The CodeSourcery Toolchain (2009q1)
+ -----------------------------------
+ The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ The Atollic "Pro" and "Lite" Toolchain
+ --------------------------------------
+ One problem that I had with the Atollic toolchains is that the provide a gcc.exe
+ and g++.exe in the same bin/ file as their ARM binaries. If the Atollic bin/ path
+ appears in your PATH variable before /usr/bin, then you will get the wrong gcc
+ when you try to build host executables. This will cause to strange, uninterpretable
+ errors build some host binaries in tools/ when you first make.
+
+ The Atollic "Lite" Toolchain
+ ----------------------------
+ The free, "Lite" version of the Atollic toolchain does not support C++ nor
+ does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
+ toolchain, you will have to set:
+
+ CONFIG_HAVE_CXX=n
+
+ In order to compile successfully. Otherwise, you will get errors like:
+
+ "C++ Compiler only available in TrueSTUDIO Professional"
+
+ The make may then fail in some of the post link processing because of some of
+ the other missing tools. The Make.defs file replaces the ar and nm with
+ the default system x86 tool versions and these seem to work okay. Disable all
+ of the following to avoid using objcopy:
+
+ CONFIG_RRLOAD_BINARY=n
+ CONFIG_INTELHEX_BINARY=n
+ CONFIG_MOTOROLA_SREC=n
+ CONFIG_RAW_BINARY=n
+
+ devkitARM
+ ---------
+ The devkitARM toolchain includes a version of MSYS make. Make sure that the
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh stm3220g-eval/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+Ethernet
+========
+
+The Ethernet driver is configured to use the MII interface:
+
+ Board Jumper Settings:
+
+ Jumper Description
+ JP8 To enable MII, JP8 should not be fitted.
+ JP6 2-3: Enable MII interface mode
+ JP5 2-3: Provide 25 MHz clock for MII or 50 MHz clock for RMII by MCO at PA8
+ SB1 Not used with MII
+
+LEDs
+====
+
+The STM3220G-EVAL board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
+board.. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
+defined. In that case, the usage by the board port is defined in
+include/board.h and src/up_leds.c. The LEDs are used to encode OS-related\
+events as follows:
+
+ SYMBOL Meaning LED1* LED2 LED3 LED4
+ ------------------- ----------------------- ------- ------- ------- ------
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
+ is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+*** LED2 may also flicker normally if signals are processed.
+
+PWM
+===
+
+The STM3220G-Eval has no real on-board PWM devices, but the board can be
+configured to output a pulse train using timer output pins. The following
+pins have been use to generate PWM output (see board.h for some other
+candidates):
+
+TIM4 CH2. Pin PD13 is used by the FSMC (FSMC_A18) and is also connected
+to the Motor Control Connector (CN5) just for this purpose. If FSMC is
+not enabled, then FSMC_A18 will not be used (and will be tri-stated from
+the LCD).
+
+ CONFIGURATION:
+
+ CONFIG_STM32_TIM4=y
+ CONFIG_PWM=n
+ CONFIG_PWM_PULSECOUNT=n
+ CONFIG_STM32_TIM4_PWM=y
+ CONFIG_STM32_TIM4_CHANNEL=2
+
+ ACCESS:
+
+ Daughterboard Extension Connector, CN3, pin 32
+ Ground is available on CN3, pin1
+
+ NOTE: TIM4 hardware will not support pulse counting.
+
+TIM8 CH4: Pin PC9 is used by the microSD card (MicroSDCard_D1) and I2S
+(I2S_CKIN) but can be completely disconnected from both by opening JP16.
+
+ CONFIGURATION:
+
+ CONFIG_STM32_TIM8=y
+ CONFIG_PWM=n
+ CONFIG_PWM_PULSECOUNT=y
+ CONFIG_STM32_TIM8_PWM=y
+ CONFIG_STM32_TIM8_CHANNEL=4
+
+ ACCESS:
+
+ Daughterboard Extension Connector, CN3, pin 17
+ Ground is available on CN3, pin1
+
+CAN
+===
+
+Connector 10 (CN10) is DB-9 male connector that can be used with CAN1 or CAN2.
+
+ JP10 connects CAN1_RX or CAN2_RX to the CAN transceiver
+ JP3 connects CAN1_TX or CAN2_TX to the CAN transceiver
+
+CAN signals are then available on CN10 pins:
+
+ CN10 Pin 7 = CANH
+ CN10 Pin 2 = CANL
+
+Mapping to STM32 GPIO pins:
+
+ PD0 = FSMC_D2 & CAN1_RX
+ PD1 = FSMC_D3 & CAN1_TX
+ PB13 = ULPI_D6 & CAN2_TX
+ PB5 = ULPI_D7 & CAN2_RX
+
+Configuration Options:
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+
+ CONFIG_STM32_CAN1 - Enable support for CAN1
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_STM32_CAN2 - Enable support for CAN2
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+FSMC SRAM
+=========
+
+On-board SRAM
+-------------
+
+A 16 Mbit SRAM is connected to the STM32F407IGH6 FSMC bus which shares the same
+I/Os with the CAN1 bus. Jumper settings:
+
+ JP1: Connect PE4 to SRAM as A20
+ JP2: onnect PE3 to SRAM as A19
+
+JP3 and JP10 must not be fitted for SRAM and LCD application. JP3 and JP10
+select CAN1 or CAN2 if fitted; neither if not fitted.
+
+The on-board SRAM can be configured by setting
+
+ CONFIG_STM32_FSMC=y
+ CONFIG_STM32_FSMC_SRAM=y
+ CONFIG_HEAP2_BASE=0x64000000
+ CONFIG_HEAP2_SIZE=2097152
+ CONFIG_MM_REGIONS=2
+
+Configuration Options
+---------------------
+
+Internal SRAM is available in all members of the STM32 family. In addition
+to internal SRAM, SRAM may also be available through the FSMC. In order to
+use FSMC SRAM, the following additional things need to be present in the
+NuttX configuration file:
+
+ CONFIG_STM32_FSMC=y : Enables the FSMC
+ CONFIG_STM32_FSMC_SRAM=y : Indicates that SRAM is available via the
+ FSMC (as opposed to an LCD or FLASH).
+ CONFIG_HEAP2_BASE : The base address of the SRAM in the FSMC
+ address space
+ CONFIG_HEAP2_SIZE : The size of the SRAM in the FSMC
+ address space
+ CONFIG_MM_REGIONS : Must be set to a large enough value to
+ include the FSMC SRAM
+
+SRAM Configurations
+-------------------
+There are 2 possible SRAM configurations:
+
+ Configuration 1. System SRAM (only)
+ CONFIG_MM_REGIONS == 1
+ Configuration 2. System SRAM and FSMC SRAM
+ CONFIG_MM_REGIONS == 2
+ CONFIG_STM32_FSMC_SRAM defined
+
+I/O Expanders
+=============
+
+The STM3220G-EVAL has two STMPE811QTR I/O expanders on board both connected to
+the STM32 via I2C1. They share a common interrupt line: PI2.
+
+STMPE811 U24, I2C address 0x41 (7-bit)
+------ ---- ---------------- --------------------------------------------
+STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+------ ---- ---------------- --------------------------------------------
+ Y- TouchScreen_Y- LCD Connector XL
+ X- TouchScreen_X- LCD Connector XR
+ Y+ TouchScreen_Y+ LCD Connector XD
+ X+ TouchScreen_X+ LCD Connector XU
+ IN3 EXP_IO9
+ IN2 EXP_IO10
+ IN1 EXP_IO11
+ IN0 EXP_IO12
+
+STMPE811 U29, I2C address 0x44 (7-bit)
+------ ---- ---------------- --------------------------------------------
+STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+------ ---- ---------------- --------------------------------------------
+ Y- EXP_IO1
+ X- EXP_IO2
+ Y+ EXP_IO3
+ X+ EXP_IO4
+ IN3 EXP_IO5
+ IN2 EXP_IO6
+ IN1 EXP_IO7
+ IN0 EXP_IO8
+
+STM3220G-EVAL-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F207IG=y
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=stm3220g_eval (for the STM3220G-EVAL development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ In addition to internal SRAM, SRAM may also be available through the FSMC.
+ In order to use FSMC SRAM, the following additional things need to be
+ present in the NuttX configuration file:
+
+ CONFIG_STM32_FSMC_SRAM - Indicates that SRAM is available via the
+ FSMC (as opposed to an LCD or FLASH).
+
+ CONFIG_HEAP2_BASE - The base address of the SRAM in the FSMC address space (hex)
+
+ CONFIG_HEAP2_SIZE - The size of the SRAM in the FSMC address space (decimal)
+
+ CONFIG_ARCH_IRQPRIO - The STM3220xxx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ AHB1
+ ----
+ CONFIG_STM32_CRC
+ CONFIG_STM32_BKPSRAM
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_ETHMAC
+ CONFIG_STM32_OTGHS
+
+ AHB2
+ ----
+ CONFIG_STM32_DCMI
+ CONFIG_STM32_CRYP
+ CONFIG_STM32_HASH
+ CONFIG_STM32_RNG
+ CONFIG_STM32_OTGFS
+
+ AHB3
+ ----
+ CONFIG_STM32_FSMC
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_TIM12
+ CONFIG_STM32_TIM13
+ CONFIG_STM32_TIM14
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI3
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_I2C3
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_CAN2
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_PWR -- Required for RTC
+
+ APB2
+ ----
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_USART6
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_ADC3
+ CONFIG_STM32_SDIO
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_SYSCFG
+ CONFIG_STM32_TIM9
+ CONFIG_STM32_TIM10
+ CONFIG_STM32_TIM11
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,14
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,14
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,14, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,14
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,14, m=1,..,2
+
+ For each timer that is enabled for PWM usage, we need the following additional
+ configuration settings:
+
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+
+ NOTE: The STM32 timers are each capable of generating different signals on
+ each of the four channels with different duty cycles. That capability is
+ not supported by this driver: Only one output channel per timer.
+
+ JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+
+ STM3220xxx specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+
+ CONFIG_STM32_PHYADDR - The 5-bit address of the PHY on the board
+ CONFIG_STM32_MII - Support Ethernet MII interface
+ CONFIG_STM32_MII_MCO1 - Use MCO1 to clock the MII interface
+ CONFIG_STM32_MII_MCO2 - Use MCO2 to clock the MII interface
+ CONFIG_STM32_RMII - Support Ethernet RMII interface
+ CONFIG_STM32_AUTONEG - Use PHY autonegotion to determine speed and mode
+ CONFIG_STM32_ETHFD - If CONFIG_STM32_AUTONEG is not defined, then this
+ may be defined to select full duplex mode. Default: half-duplex
+ CONFIG_STM32_ETH100MBPS - If CONFIG_STM32_AUTONEG is not defined, then this
+ may be defined to select 100 MBps speed. Default: 10 Mbps
+ CONFIG_STM32_PHYSR - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. The PHY status register address may diff from PHY to PHY. This
+ configuration sets the address of the PHY status register.
+ CONFIG_STM32_PHYSR_SPEED - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides bit mask indicating 10 or 100MBps speed.
+ CONFIG_STM32_PHYSR_100MBPS - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides the value of the speed bit(s) indicating 100MBps speed.
+ CONFIG_STM32_PHYSR_MODE - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provide bit mask indicating full or half duplex modes.
+ CONFIG_STM32_PHYSR_FULLDUPLEX - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides the value of the mode bits indicating full duplex mode.
+ CONFIG_STM32_ETH_PTP - Precision Time Protocol (PTP). Not supported
+ but some hooks are indicated with this condition.
+
+ STM3220G-EVAL CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ STM3220G-EVAL LCD Hardware Configuration
+
+ STM32 USB OTG FS Host Driver Support
+
+ Pre-requisites
+
+ CONFIG_USBHOST - Enable general USB host support
+ CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG - Needed
+
+ Options:
+
+ CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
+ Default 128 (512 bytes)
+ CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
+ in 32-bit words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
+ words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_DESCSIZE - Maximum size of a descriptor. Default: 128
+ CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
+ want to do that?
+ CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
+ debug. Depends on CONFIG_DEBUG.
+ CONFIG_STM32_USBHOST_PKTDUMP - Dump all incoming and outgoing USB
+ packets. Depends on CONFIG_DEBUG.
+
+Configurations
+==============
+
+Each STM3220G-EVAL configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh stm3220g-eval/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ dhcpd:
+ -----
+
+ This builds the DCHP server using the apps/examples/dhcpd application
+ (for execution from FLASH.) See apps/examples/README.txt for information
+ about the dhcpd example. The server address is 10.0.0.1 and it serves
+ IP addresses in the range 10.0.0.2 through 10.0.0.17 (all of which, of
+ course, are configurable).
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ nettest:
+ -------
+
+ This configuration directory may be used to verify networking performance
+ using the STM32's Ethernet controller. It uses apps/examples/nettest to excercise the
+ TCP/IP network.
+
+ CONFIG_EXAMPLE_NETTEST_SERVER=n : Target is configured as the client
+ CONFIG_EXAMPLE_NETTEST_PERFORMANCE=y : Only network performance is verified.
+ CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2) : Target side is IP: 10.0.0.2
+ CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1) : Host side is IP: 10.0.0.1
+ CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1) : Server address used by which ever is client.
+
+ nsh:
+ ---
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_NSH_DHCPC=n : DHCP is disabled
+ CONFIG_NSH_IPADDR=(192<<24|168<<16|13<<8|161) : Target IP address 192.168.8.161
+ CONFIG_NSH_DRIPADDR=(192<<24|168<<16|13<<8|1) : Host IP address 192.168.8.1
+
+ NOTES:
+ 1. This example assumes that a network is connected. During its
+ initialization, it will try to negotiate the link speed. If you have
+ no network connected when you reset the board, there will be a long
+ delay (maybe 30 seconds?) before anything happens. That is the timeout
+ before the networking finally gives up and decides that no network is
+ available.
+
+ 2. This example supports the ADC test (apps/examples/adc) but this must
+ be manually enabled by selecting:
+
+ CONFIG_ADC=y : Enable the generic ADC infrastructure
+ CONFIG_STM32_ADC3=y : Enable ADC3
+ CONFIG_STM32_TIM1=y : Enable Timer 1
+ CONFIG_STM32_TIM1_ADC=y : Indicate that timer 1 will be used to trigger an ADC
+ CONFIG_STM32_TIM1_ADC3=y : Assign timer 1 to drive ADC3 sampling
+ CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100 : Select a sampling frequency
+
+ See also apps/examples/README.txt
+
+ General debug for analog devices (ADC/DAC):
+
+ CONFIG_DEBUG_ANALOG
+
+ 3. This example supports the PWM test (apps/examples/pwm) but this must
+ be manually enabled by selecting eeither
+
+ CONFIG_PWM=y : Enable the generic PWM infrastructure
+ CONFIG_PWM_PULSECOUNT=n : Disable to support for TIM1/8 pulse counts
+ CONFIG_STM32_TIM4=y : Enable TIM4
+ CONFIG_STM32_TIM4_PWM=y : Use TIM4 to generate PWM output
+ CONFIG_STM32_TIM4_CHANNEL=2 : Select output on TIM4, channel 2
+
+ If CONFIG_STM32_FSMC is disabled, output will appear on CN3, pin 32.
+ Ground is available on CN3, pin1.
+
+ Or..
+
+ CONFIG_PWM=y : Enable the generic PWM infrastructure
+ CONFIG_PWM_PULSECOUNT=y : Enable to support for TIM1/8 pulse counts
+ CONFIG_STM32_TIM8=y : Enable TIM8
+ CONFIG_STM32_TIM8_PWM=y : Use TIM8 to generate PWM output
+ CONFIG_STM32_TIM8_CHANNEL=4 : Select output on TIM8, channel 4
+
+ If CONFIG_STM32_FSMC is disabled, output will appear on CN3, pin 17
+ Ground is available on CN23 pin1.
+
+ See also include/board.h and apps/examples/README.txt
+
+ Special PWM-only debug options:
+
+ CONFIG_DEBUG_PWM
+
+ 4. This example supports the CAN loopback test (apps/examples/can) but this
+ must be manually enabled by selecting:
+
+ CONFIG_CAN=y : Enable the generic CAN infrastructure
+ CONFIG_CAN_EXID=y or n : Enable to support extended ID frames
+ CONFIG_STM32_CAN1=y : Enable CAN1
+ CONFIG_CAN_LOOPBACK=y : Enable CAN loopback mode
+
+ See also apps/examples/README.txt
+
+ Special CAN-only debug options:
+
+ CONFIG_DEBUG_CAN
+ CONFIG_CAN_REGDEBUG
+
+ 5. This example can support an FTP client. In order to build in FTP client
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpc
+ #CONFIGURED_APPS += examples/ftpc
+
+ 6. This example can support an FTP server. In order to build in FTP server
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpd
+ #CONFIGURED_APPS += examples/ftpd
+
+ And enable poll() support in the NuttX configuration file:
+
+ CONFIG_DISABLE_POLL=n
+
+ 7. This example supports the watchdog timer test (apps/examples/watchdog)
+ but this must be manually enabled by selecting:
+
+ CONFIG_WATCHDOG=y : Enables watchdog timer driver support
+ CONFIG_STM32_WWDG=y : Enables the WWDG timer facility, OR
+ CONFIG_STM32_IWDG=y : Enables the IWDG timer facility (but not both)
+
+ The WWDG watchdog is driven off the (fast) 42MHz PCLK1 and, as result,
+ has a maximum timeout value of 49 milliseconds. For WWDG watchdog, you
+ should also add the fillowing to the configuration file:
+
+ CONFIG_EXAMPLES_WATCHDOG_PINGDELAY=20
+ CONFIG_EXAMPLES_WATCHDOG_TIMEOUT=49
+
+ The IWDG timer has a range of about 35 seconds and should not be an issue.
+
+ 7. Adding LCD and graphics support:
+
+ appconfig (apps/.config): Enable the application configurations that you
+ want to use. Asexamples:
+
+ CONFIGURED_APPS += examples/nx : Pick one or more
+ CONFIGURED_APPS += examples/nxhello :
+ CONFIGURED_APPS += examples/nximage :
+ CONFIGURED_APPS += examples/nxlines :
+
+ defconfig (nuttx/.config):
+
+ CONFIG_STM32_FSMC=y : FSMC support is required for the LCD
+ CONFIG_NX=y : Enable graphics suppport
+ CONFIG_MM_REGIONS=2 : When FSMC is enabled, so is the on-board SRAM memory region
+
+ 8. USB OTG FS Device or Host Support
+
+ CONFIG_USBDEV - Enable USB device support, OR
+ CONFIG_USBHOST - Enable USB host support (but not both)
+
+ CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG - Needed for all USB OTF FS support
+
+ CONFIG_SCHED_WORKQUEUE - Worker thread support is required for the mass
+ storage class (both host and device).
+ CONFIG_NSH_ARCHINIT - Architecture specific USB initialization
+ is needed
+
+ 9. This configuration requires that jumper JP22 be set to enable RS-232 operation.
+
+ nsh2:
+ -----
+
+ This is an alternaitve NSH configuration. One limitation of the STM3220G-EVAL
+ board is that you cannot have both a UART-based NSH console and SDIO support.
+ The nsh2 differs from the nsh configuration in the following ways:
+
+ -CONFIG_STM32_USART3=y : USART3 is disabled
+ + CONFIG_STM32_USART3=n
+
+ -CONFIG_STM32_SDIO=n : SDIO is enabled
+ +CONFIG_STM32_SDIO=y
+
+ Logically, these are the only differences: This configuration has SDIO (and
+ the SD card) enabled and the serial console disabled. There is ONLY a
+ Telnet console!.
+
+ There are some special settings to make life with only a Telnet
+
+ CONFIG_SYSLOG=y - Enables the System Logging feature.
+ CONFIG_RAMLOG=y - Enable the RAM-based logging feature.
+ CONFIG_RAMLOG_CONSOLE=y - Use the RAM logger as the default console.
+ This means that any console output from non-Telnet threads will
+ go into the circular buffer in RAM.
+ CONFIG_RAMLOG_SYSLOG - This enables the RAM-based logger as the
+ system logger. This means that (1) in addition to the console
+ output from other tasks, ALL of the debug output will also to
+ to the circular buffer in RAM, and (2) NSH will now support a
+ command called 'dmesg' that can be used to dump the RAM log.
+
+ There are a few other configuration differences as necessary to support
+ this different device configuration. Just the do the 'diff' if you are
+ curious.
+
+ NOTES:
+ 1. See the notes for the nsh configuration. Most also apply to the nsh2
+ configuration.
+
+ 2. RS-232 is disabled, but Telnet is still available for use as a console.
+ Since RS-232 and SDIO use the same pins (one controlled by JP22), RS232
+ and SDIO cannot be used concurrently.
+
+ 3. This configuration requires that jumper JP22 be set to enable SDIO
+ operation. To enable MicroSD Card, which shares same I/Os with RS-232,
+ JP22 is not fitted.
+
+ 4. In order to use SDIO without overruns, DMA must be used.
+
+ 5. Another SDIO/DMA issue. This one is probably a software bug. This is
+ the bug as stated in the TODO list:
+
+ "If you use a large I/O buffer to access the file system, then the
+ MMCSD driver will perform multiple block SD transfers. With DMA
+ ON, this seems to result in CRC errors detected by the hardware
+ during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_DISABLE=y"
+
+ For this reason, CONFIG_MMCSD_MULTIBLOCK_DISABLE=y appears in the defconfig
+ file.
+
+ 6. Another DMA-related concern. I see this statement in the reference
+ manual: "The burst configuration has to be selected in order to respect
+ the AHB protocol, where bursts must not cross the 1 KB address boundary
+ because the minimum address space that can be allocated to a single slave
+ is 1 KB. This means that the 1 KB address boundary should not be crossed
+ by a burst block transfer, otherwise an AHB error would be generated,
+ that is not reported by the DMA registers."
+
+ There is nothing in the DMA driver to prevent this now.
+
+ nxwm
+ ----
+ This is a special configuration setup for the NxWM window manager
+ UnitTest. The NxWM window manager can be found here:
+
+ trunk/NxWidgets/nxwm
+
+ The NxWM unit test can be found at:
+
+ trunk/NxWidgets/UnitTests/nxwm
+
+ Documentation for installing the NxWM unit test can be found here:
+
+ trunk/NxWidgets/UnitTests/README.txt
+
+ Here is the quick summary of the build steps:
+
+ 1. Intall the nxwm configuration
+
+ $ cd ~/nuttx/trunk/nuttx/tools
+ $ ./configure.sh stm3220g-eval/nxwm
+
+ 2. Make the build context (only)
+
+ $ cd ..
+ $ . ./setenv.sh
+ $ make context
+ ...
+
+ 3. Install the nxwm unit test
+
+ $ cd ~/nuttx/trunk/NxWidgets
+ $ tools/install.sh ~/nuttx/trunk/apps nxwm
+ Creating symbolic link
+ - To ~/nuttx/trunk/NxWidgets/UnitTests/nxwm
+ - At ~/nuttx/trunk/apps/external
+
+ 4. Build the NxWidgets library
+
+ $ cd ~/nuttx/trunk/NxWidgets/libnxwidgets
+ $ make TOPDIR=~/nuttx/trunk/nuttx
+ ...
+
+ 5. Build the NxWM library
+
+ $ cd ~/nuttx/trunk/NxWidgets/nxwm
+ $ make TOPDIR=~//nuttx/trunk/nuttx
+ ...
+
+ 6. Built NuttX with the installed unit test as the application
+
+ $ cd ~/nuttx/trunk/nuttx
+ $ make
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ telnetd:
+ --------
+
+ A simple test of the Telnet daemon(see apps/netutils/README.txt,
+ apps/examples/README.txt, and apps/examples/telnetd). This is
+ the same daemon that is used in the nsh configuration so if you
+ use NSH, then you don't care about this. This test is good for
+ testing the Telnet daemon only because it works in a simpler
+ environment than does the nsh configuration.
diff --git a/nuttx/configs/stm3220g-eval/dhcpd/Make.defs b/nuttx/configs/stm3220g-eval/dhcpd/Make.defs
new file mode 100644
index 000000000..f6ba36cf9
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/dhcpd/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/dhcpd/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/dhcpd/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/dhcpd/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/dhcpd/appconfig b/nuttx/configs/stm3220g-eval/dhcpd/appconfig
new file mode 100644
index 000000000..46c59e818
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/dhcpd/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/stm3220g-eval/dhcpd/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/dhcpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/dhcpd
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/stm3220g-eval/dhcpd/defconfig b/nuttx/configs/stm3220g-eval/dhcpd/defconfig
new file mode 100644
index 000000000..3abf0bdab
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/dhcpd/defconfig
@@ -0,0 +1,635 @@
+############################################################################
+# configs/stm3220g-eval/dhcpd/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="dhcpd_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=13
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=n
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=y
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/dhcpd
+#
+CONFIG_EXAMPLE_DHCPD_NOMAC=y
+CONFIG_EXAMPLE_DHCPD_IPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3220g-eval/dhcpd/ld.script b/nuttx/configs/stm3220g-eval/dhcpd/ld.script
new file mode 100644
index 000000000..a264f2442
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/dhcpd/ld.script
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * configs/stm3220g-eval/dhcpd/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 128Kb of SRAM. SRAM is split up into two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/dhcpd/setenv.sh b/nuttx/configs/stm3220g-eval/dhcpd/setenv.sh
new file mode 100755
index 000000000..f23056a01
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/dhcpd/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3220g-eval/dhcpd/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/include/board.h b/nuttx/configs/stm3220g-eval/include/board.h
new file mode 100644
index 000000000..c70946000
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/include/board.h
@@ -0,0 +1,536 @@
+/************************************************************************************
+ * configs/stm3220g-eval/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_STM3220G_EVAL_INCLUDE_BOARD_H
+#define __CONFIGS_STM3220G_EVAL_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Four clock sources are available on STM3220G-EVAL evaluation board for
+ * STM32F207IGH6 and RTC embedded:
+ *
+ * X1, 25 MHz crystal for ethernet PHY with socket. It can be removed when clock is
+ * provided by MCO pin of the MCU
+ * X2, 26 MHz crystal for USB OTG HS PHY
+ * X3, 32 kHz crystal for embedded RTC
+ * X4, 25 MHz crystal with socket for STM32F207IGH6 microcontroller (It can be removed
+ * from socket when internal RC clock is used.)
+ *
+ * This is the "standard" configuration as set up by arch/arm/src/stm32f40xx_rcc.c:
+ * System Clock source : PLL (HSE)
+ * SYSCLK(Hz) : 120000000 Determined by PLL configuration
+ * HCLK(Hz) : 120000000 (STM32_RCC_CFGR_HPRE)
+ * AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
+ * APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
+ * APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
+ * HSE Frequency(Hz) : 25000000 (STM32_BOARD_XTAL)
+ * PLLM : 25 (STM32_PLLCFG_PLLM)
+ * PLLN : 240 (STM32_PLLCFG_PLLN)
+ * PLLP : 2 (STM32_PLLCFG_PLLP)
+ * PLLQ : 5 (STM32_PLLCFG_PLLQ)
+ * Main regulator output voltage : Scale1 mode Needed for high speed SYSCLK
+ * Flash Latency(WS) : 5
+ * Prefetch Buffer : OFF
+ * Instruction cache : ON
+ * Data cache : ON
+ * Require 48MHz for USB OTG FS, : Enabled
+ * SDIO and RNG clock
+ */
+
+/* HSI - 16 MHz RC factory-trimmed
+ * LSI - 32 KHz RC
+ * HSE - On-board crystal frequency is 25MHz
+ * LSE - 32.768 kHz
+ */
+
+#define STM32_BOARD_XTAL 25000000ul
+
+#define STM32_HSI_FREQUENCY 16000000ul
+#define STM32_LSI_FREQUENCY 32000
+#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
+#define STM32_LSE_FREQUENCY 32768
+
+/* Main PLL Configuration.
+ *
+ * PLL source is HSE
+ * PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
+ * = (25,000,000 / 25) * 240
+ * = 240,000,000
+ * SYSCLK = PLL_VCO / PLLP
+ * = 240,000,000 / 2 = 120,000,000
+ * USB OTG FS, SDIO and RNG Clock
+ * = PLL_VCO / PLLQ
+ * = 240,000,000 / 5 = 48,000,000
+ * = 48,000,000
+ */
+
+#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(25)
+#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(240)
+#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
+#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(5)
+
+#define STM32_SYSCLK_FREQUENCY 120000000ul
+
+/* AHB clock (HCLK) is SYSCLK (120MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
+#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB1 clock (PCLK1) is HCLK/4 (30MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
+
+/* Timers driven from APB1 will be twice PCLK1 (60Mhz)*/
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
+
+/* APB2 clock (PCLK2) is HCLK/2 (60MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
+#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* Timers driven from APB2 will be twice PCLK2 (120Mhz)*/
+
+#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
+
+/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
+ * otherwise frequency is 2xAPBx.
+ * Note: TIM1,8 are on APB2, others on APB1
+ */
+
+#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode. These values have not been
+ * tuned!!!
+ *
+ * SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
+ * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)= 16 MHz
+ * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)= 12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* Ethernet *************************************************************************/
+/* We need to provide clocking to the MII PHY via MCO1 (PA8) */
+
+#if defined(CONFIG_NET) && defined(CONFIG_STM32_ETHMAC)
+
+# if !defined(CONFIG_STM32_MII)
+# warning "CONFIG_STM32_MII required for Ethernet"
+# elif !defined(CONFIG_STM32_MII_MCO1)
+# warning "CONFIG_STM32_MII_MCO1 required for Ethernet MII"
+# else
+
+ /* Output HSE clock (25MHz) on MCO1 pin (PA8) to clock the PHY */
+
+# define BOARD_CFGR_MC01_SOURCE RCC_CFGR_MCO1_HSE
+# define BOARD_CFGR_MC01_DIVIDER RCC_CFGR_MCO1PRE_NONE
+
+# endif
+#endif
+
+/* LED definitions ******************************************************************/
+/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
+ * way. The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with stm32_setled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_LED3 2
+#define BOARD_LED4 3
+#define BOARD_NLEDS 4
+
+/* LED bits for use with stm32_setleds() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+#define BOARD_LED3_BIT (1 << BOARD_LED3)
+#define BOARD_LED4_BIT (1 << BOARD_LED4)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on board the
+ * STM3220G-EVAL. The following definitions describe how NuttX controls the LEDs:
+ */
+
+#define LED_STARTED 0 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED2 */
+#define LED_IRQSENABLED 2 /* LED1 + LED2 */
+#define LED_STACKCREATED 3 /* LED3 */
+#define LED_INIRQ 4 /* LED1 + LED3 */
+#define LED_SIGNAL 5 /* LED2 + LED3 */
+#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
+#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+
+/* Button definitions ***************************************************************/
+/* The STM3220G-EVAL supports three buttons: */
+
+#define BUTTON_WAKEUP 0
+#define BUTTON_TAMPER 1
+#define BUTTON_USER 2
+
+#define NUM_BUTTONS 3
+
+#define BUTTON_WAKEUP_BIT (1 << BUTTON_WAKEUP)
+#define BUTTON_TAMPER_BIT (1 << BUTTON_TAMPER)
+#define BUTTON_USER_BIT (1 << BUTTON_USER)
+
+/* Alternate function pin selections ************************************************/
+
+/* UART3:
+ *
+ * - PC11 is MicroSDCard_D3 & RS232/IrDA_RX (JP22 open)
+ * - PC10 is MicroSDCard_D2 & RSS232/IrDA_TX
+ */
+
+#ifdef CONFIG_STM32_USART3
+# define GPIO_USART3_RX GPIO_USART3_RX_2
+# define GPIO_USART3_TX GPIO_USART3_TX_2
+#endif
+
+/* Ethernet:
+ *
+ * - PA2 is ETH_MDIO
+ * - PC1 is ETH_MDC
+ * - PB5 is ETH_PPS_OUT
+ * - PH2 is ETH_MII_CRS
+ * - PH3 is ETH_MII_COL
+ * - PI10 is ETH_MII_RX_ER
+ * - PH6 is ETH_MII_RXD2
+ * - PH7 is ETH_MII_RXD3
+ * - PC3 is ETH_MII_TX_CLK
+ * - PC2 is ETH_MII_TXD2
+ * - PB8 is ETH_MII_TXD3
+ * - PA1 is ETH_MII_RX_CLK/ETH_RMII_REF_CLK
+ * - PA7 is ETH_MII_RX_DV/ETH_RMII_CRS_DV
+ * - PC4 is ETH_MII_RXD0/ETH_RMII_RXD0
+ * - PC5 is ETH_MII_RXD1/ETH_RMII_RXD1
+ * - PG11 is ETH_MII_TX_EN/ETH_RMII_TX_EN
+ * - PG13 is ETH_MII_TXD0/ETH_RMII_TXD0
+ * - PG14 is ETH_MII_TXD1/ETH_RMII_TXD1
+ */
+
+#define GPIO_ETH_PPS_OUT GPIO_ETH_PPS_OUT_1
+#define GPIO_ETH_MII_CRS GPIO_ETH_MII_CRS_2
+#define GPIO_ETH_MII_COL GPIO_ETH_MII_COL_2
+#define GPIO_ETH_MII_RX_ER GPIO_ETH_MII_RX_ER_2
+#define GPIO_ETH_MII_RXD2 GPIO_ETH_MII_RXD2_2
+#define GPIO_ETH_MII_RXD3 GPIO_ETH_MII_RXD3_2
+#define GPIO_ETH_MII_TXD3 GPIO_ETH_MII_TXD3_1
+#define GPIO_ETH_MII_TX_EN GPIO_ETH_MII_TX_EN_2
+#define GPIO_ETH_MII_TXD0 GPIO_ETH_MII_TXD0_2
+#define GPIO_ETH_MII_TXD1 GPIO_ETH_MII_TXD1_2
+#define GPIO_ETH_RMII_TX_EN GPIO_ETH_RMII_TX_EN_2
+#define GPIO_ETH_RMII_TXD0 GPIO_ETH_RMII_TXD0_2
+#define GPIO_ETH_RMII_TXD1 GPIO_ETH_RMII_TXD1_2
+
+/* PWM
+ *
+ * The STM3220G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using the following:
+ *
+ * If FSMC is not used:
+ * TIM4 CH2OUT: PD13 FSMC_A18 / MC_TIM4_CH2OUT
+ * Daughterboard Extension Connector, CN3, pin 32
+ * Motor Control Connector CN15, pin 33 -- not available unless you bridge SB14.
+ *
+ * TIM1 CH1OUT: PE9 FSMC_D6
+ * Daughterboard Extension Connector, CN2, pin 24
+ *
+ * TIM1_CH2OUT: PE11 FSMC_D8
+ * Daughterboard Extension Connector, CN2, pin 26
+ *
+ * TIM1_CH3OUT: PE13 FSMC_D10
+ * Daughterboard Extension Connector, CN2, pin 28
+ *
+ * TIM1_CH4OUT: PE14 FSMC_D11
+ * Daughterboard Extension Connector, CN2, pin 29
+ *
+ * If OTG FS is not used
+ *
+ * TIM1_CH3OUT: PA10 OTG_FS_ID
+ * Daughterboard Extension Connector, CN3, pin 14
+ *
+ * TIM1_CH4OUT: PA11 OTG_FS_DM
+ * Daughterboard Extension Connector, CN3, pin 11
+ *
+ * If DMCI is not used
+ *
+ * TIM8 CH1OUT: PI5 DCMI_VSYNC & MC
+ * Daughterboard Extension Connector, CN4, pin 4
+ *
+ * TIM8_CH2OUT: PI6 DCMI_D6 & MC
+ * Daughterboard Extension Connector, CN4, pin 3
+ *
+ * TIM8_CH3OUT: PI7 DCMI_D7 & MC
+ * Daughterboard Extension Connector, CN4, pin 2
+ *
+ * If SDIO is not used
+ *
+ * TIM8_CH3OUT: PC8 MicroSDCard_D0 & MC
+ * Daughterboard Extension Connector, CN3, pin 18
+ *
+ * TIM8_CH4OUT: PC9 MicroSDCard_D1 & I2S_CKIN (Need JP16 open)
+ * Daughterboard Extension Connector, CN3, pin 17
+ *
+ * Others
+ *
+ * TIM8 CH1OUT: PC6 I2S_MCK & Smartcard_IO (JP21 open)
+ */
+
+#if !defined(CONFIG_STM32_FSMC)
+# define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
+# define GPIO_TIM1_CH1OUT GPIO_TIM1_CH1OUT_2
+# define GPIO_TIM1_CH2OUT GPIO_TIM1_CH2OUT_2
+# define GPIO_TIM1_CH3OUT GPIO_TIM1_CH3OUT_2
+# define GPIO_TIM1_CH4OUT GPIO_TIM1_CH4OUT_2
+#elif !defined(CONFIG_STM32_OTGFS)
+# define GPIO_TIM1_CH3OUT GPIO_TIM1_CH3OUT_1
+# define GPIO_TIM1_CH4OUT GPIO_TIM1_CH4OUT_1
+#endif
+
+#if !defined(CONFIG_STM32_DCMI)
+# define GPIO_TIM8_CH1OUT GPIO_TIM8_CH1OUT_2
+# define GPIO_TIM8_CH2OUT GPIO_TIM8_CH2OUT_2
+# define GPIO_TIM8_CH3OUT GPIO_TIM8_CH3OUT_2
+#else
+# define GPIO_TIM8_CH1OUT GPIO_TIM8_CH1OUT_1
+# if !defined(CONFIG_STM32_SDIO)
+# define GPIO_TIM8_CH3OUT GPIO_TIM8_CH3OUT_1
+# endif
+#endif
+
+#if !defined(CONFIG_STM32_SDIO)
+# define GPIO_TIM8_CH4OUT GPIO_TIM8_CH4OUT_1
+#endif
+
+/* CAN
+ *
+ * Connector 10 (CN10) is DB-9 male connector that can be used with CAN1 or CAN2.
+ *
+ * JP10 connects CAN1_RX or CAN2_RX to the CAN transceiver
+ * JP3 connects CAN1_TX or CAN2_TX to the CAN transceiver
+ *
+ * CAN signals are then available on CN10 pins:
+ *
+ * CN10 Pin 7 = CANH
+ * CN10 Pin 2 = CANL
+ *
+ * Mapping to STM32 GPIO pins:
+ *
+ * PD0 = FSMC_D2 & CAN1_RX
+ * PD1 = FSMC_D3 & CAN1_TX
+ * PB13 = ULPI_D6 & CAN2_TX
+ * PB5 = ULPI_D7 & CAN2_RX
+ */
+
+#define GPIO_CAN1_RX GPIO_CAN1_RX_3
+#define GPIO_CAN1_TX GPIO_CAN1_TX_3
+
+#define GPIO_CAN2_RX GPIO_CAN2_RX_2
+#define GPIO_CAN2_TX GPIO_CAN2_TX_1
+
+/* I2C. Only I2C1 is available on the STM3220G-EVAL. I2C1_SCL and I2C1_SDA are
+ * available on the following pins:
+ *
+ * - PB6 is I2C1_SCL
+ * - PB9 is I2C1_SDA
+ */
+
+#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
+#define GPIO_I2C1_SDA GPIO_I2C1_SDA_2
+
+/* DMA Channl/Stream Selections *****************************************************/
+/* Stream selections are arbitrary for now but might become important in the future
+ * is we set aside more DMA channels/streams.
+ *
+ * SDIO DMA
+ * DMAMAP_SDIO_1 = Channel 4, Stream 3
+ * DMAMAP_SDIO_2 = Channel 4, Stream 6
+ */
+
+#define DMAMAP_SDIO DMAMAP_SDIO_1
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_ledinit, stm32_setled, and stm32_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
+ * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * control the LEDs from user applications.
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void stm32_ledinit(void);
+EXTERN void stm32_setled(int led, bool ledon);
+EXTERN void stm32_setleds(uint8_t ledset);
+#endif
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+/************************************************************************************
+ * Name: stm3220g_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the STM3210E-EVAL board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * dispaly is cleared by simply setting all GRAM memory to the specified color.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+EXTERN void stm3220g_lcdclear(uint16_t color);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_STM3220G_EVAL_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/stm3220g-eval/nettest/Make.defs b/nuttx/configs/stm3220g-eval/nettest/Make.defs
new file mode 100644
index 000000000..e5b86254c
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nettest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/nettest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/nettest/appconfig b/nuttx/configs/stm3220g-eval/nettest/appconfig
new file mode 100644
index 000000000..404b63328
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nettest/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/stm3220g-eval/nettest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/stm3220g-eval/nettest/defconfig b/nuttx/configs/stm3220g-eval/nettest/defconfig
new file mode 100644
index 000000000..47a560f4f
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nettest/defconfig
@@ -0,0 +1,628 @@
+############################################################################
+# configs/stm3220g-eval/nettest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=y
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3220g-eval/nettest/ld.script b/nuttx/configs/stm3220g-eval/nettest/ld.script
new file mode 100644
index 000000000..893ae1d66
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nettest/ld.script
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * configs/stm3220g-eval/nettest/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 128Kb of SRAM. SRAM is split up into two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/nettest/setenv.sh b/nuttx/configs/stm3220g-eval/nettest/setenv.sh
new file mode 100755
index 000000000..67287fd74
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nettest/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3220g-eval/nettest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/nsh/Make.defs b/nuttx/configs/stm3220g-eval/nsh/Make.defs
new file mode 100644
index 000000000..c83aefd52
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/nsh/appconfig b/nuttx/configs/stm3220g-eval/nsh/appconfig
new file mode 100644
index 000000000..5f7490ccb
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh/appconfig
@@ -0,0 +1,102 @@
+############################################################################
+# configs/stm3220g-eval/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
+
+ifeq ($(CONFIG_INPUT_STMPE811),y)
+CONFIGURED_APPS += examples/touchscreen
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+# Uncomment to select a graphics example
+
+ifeq ($(CONFIG_NX),y)
+#CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nximage
+#CONFIGURED_APPS += examples/nxlines
+endif
diff --git a/nuttx/configs/stm3220g-eval/nsh/defconfig b/nuttx/configs/stm3220g-eval/nsh/defconfig
new file mode 100644
index 000000000..6e019875d
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh/defconfig
@@ -0,0 +1,850 @@
+############################################################################
+# configs/stm3220g-eval/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3220G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F207IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3220G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_INPUT=n
+CONFIG_DEBUG_DMA=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=n
+CONFIG_INPUT_TSC2007=n
+
+#
+# STMPE811 input device configuration
+#
+# Prerequisites: CONFIG_INPUT=y
+# Other settings that effect the driver: CONFIG_DISABLE_POLL
+#
+CONFIG_INPUT_STMPE811=n
+CONFIG_STMPE811_SPI=n
+CONFIG_STMPE811_I2C=y
+CONFIG_STMPE811_MULTIPLE=y
+CONFIG_STMPE811_ACTIVELOW=y
+CONFIG_STMPE811_EDGE=y
+#CONFIG_STMPE811_NPOLLWAITERS
+CONFIG_STMPE811_TSC_DISABLE=n
+CONFIG_STMPE811_ADC_DISABLE=y
+CONFIG_STMPE811_GPIO_DISABLE=y
+CONFIG_STMPE811_GPIOINT_DISABLE=y
+CONFIG_STMPE811_SWAPXY=y
+CONFIG_STMPE811_TEMP_DISABLE=y
+CONFIG_STMPE811_REGDEBUG=n
+CONFIG_STMPE811_THRESHX=26
+CONFIG_STMPE811_THRESHY=34
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3220G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+
+#
+# STM3220G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3220g-eval/nsh/ld.script b/nuttx/configs/stm3220g-eval/nsh/ld.script
new file mode 100644
index 000000000..dfa2b3ccd
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh/ld.script
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * configs/stm3220g-eval/nsh/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 128Kb of SRAM. SRAM is split up into two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/nsh/setenv.sh b/nuttx/configs/stm3220g-eval/nsh/setenv.sh
new file mode 100755
index 000000000..618daf011
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3220g-eval/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/nsh2/Make.defs b/nuttx/configs/stm3220g-eval/nsh2/Make.defs
new file mode 100644
index 000000000..d11f404bd
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh2/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/nsh2/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh2/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh2/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/nsh2/appconfig b/nuttx/configs/stm3220g-eval/nsh2/appconfig
new file mode 100644
index 000000000..23d9167fa
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh2/appconfig
@@ -0,0 +1,102 @@
+############################################################################
+# configs/stm3220g-eval/nsh2/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
+
+ifeq ($(CONFIG_INPUT_STMPE811),y)
+CONFIGURED_APPS += examples/touchscreen
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+# Uncomment to select a graphics example
+
+ifeq ($(CONFIG_NX),y)
+#CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nximage
+#CONFIGURED_APPS += examples/nxlines
+endif
diff --git a/nuttx/configs/stm3220g-eval/nsh2/defconfig b/nuttx/configs/stm3220g-eval/nsh2/defconfig
new file mode 100644
index 000000000..980fc1930
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh2/defconfig
@@ -0,0 +1,837 @@
+############################################################################
+# configs/stm3220g-eval/nsh2/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=y
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3220G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F207IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3220G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_DMA=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=y
+CONFIG_RAMLOG=y
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=y
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=16
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=n
+CONFIG_INPUT_TSC2007=n
+
+#
+# STMPE811 input device configuration
+#
+# Prerequisites: CONFIG_INPUT=y
+# Other settings that effect the driver: CONFIG_DISABLE_POLL
+#
+CONFIG_INPUT_STMPE811=n
+CONFIG_STMPE811_SPI=n
+CONFIG_STMPE811_I2C=y
+CONFIG_STMPE811_MULTIPLE=y
+CONFIG_STMPE811_ACTIVELOW=y
+CONFIG_STMPE811_EDGE=y
+#CONFIG_STMPE811_NPOLLWAITERS
+CONFIG_STMPE811_TSC_DISABLE=n
+CONFIG_STMPE811_ADC_DISABLE=y
+CONFIG_STMPE811_GPIO_DISABLE=y
+CONFIG_STMPE811_GPIOINT_DISABLE=y
+CONFIG_STMPE811_SWAPXY=y
+CONFIG_STMPE811_TEMP_DISABLE=y
+CONFIG_STMPE811_REGDEBUG=n
+CONFIG_STMPE811_THRESHX=26
+CONFIG_STMPE811_THRESHY=34
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3220G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+
+#
+# STM3220G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=n
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3220g-eval/nsh2/ld.script b/nuttx/configs/stm3220g-eval/nsh2/ld.script
new file mode 100644
index 000000000..e03a33dcb
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh2/ld.script
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * configs/stm3220g-eval/nsh2/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 128Kb of SRAM. SRAM is split up into two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/nsh2/setenv.sh b/nuttx/configs/stm3220g-eval/nsh2/setenv.sh
new file mode 100755
index 000000000..5b6405fae
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nsh2/setenv.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+# configs/stm3220g-eval/nsh2/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/nxwm/Make.defs b/nuttx/configs/stm3220g-eval/nxwm/Make.defs
new file mode 100644
index 000000000..9223fb76c
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nxwm/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/nxwm/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxwm/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxwm/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/nxwm/appconfig b/nuttx/configs/stm3220g-eval/nxwm/appconfig
new file mode 100644
index 000000000..4ebd8137c
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nxwm/appconfig
@@ -0,0 +1,53 @@
+############################################################################
+# configs/stm3220g-eval/nxwm/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# The NSH Library -- NOTE: The NxWM unit test must be installed at
+# apps/external in order to build this example. See
+# NxWidgets/UnitTests/README.txt for additional information
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
diff --git a/nuttx/configs/stm3220g-eval/nxwm/defconfig b/nuttx/configs/stm3220g-eval/nxwm/defconfig
new file mode 100644
index 000000000..4ce770bf1
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nxwm/defconfig
@@ -0,0 +1,871 @@
+############################################################################
+# configs/stm3220g-eval/nxwm/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=n
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3220G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F207IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3220G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxwm_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_INPUT=n
+CONFIG_DEBUG_DMA=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=28
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+CONFIG_SCHED_ONEXIT=y
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=48
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_TSC2007=n
+
+#
+# STMPE811 input device configuration
+#
+# Prerequisites: CONFIG_INPUT=y
+# Other settings that effect the driver: CONFIG_DISABLE_POLL
+#
+CONFIG_INPUT_STMPE811=y
+CONFIG_STMPE811_SPI=n
+CONFIG_STMPE811_I2C=y
+CONFIG_STMPE811_MULTIPLE=y
+CONFIG_STMPE811_ACTIVELOW=y
+CONFIG_STMPE811_EDGE=y
+#CONFIG_STMPE811_NPOLLWAITERS
+CONFIG_STMPE811_TSC_DISABLE=n
+CONFIG_STMPE811_ADC_DISABLE=y
+CONFIG_STMPE811_GPIO_DISABLE=y
+CONFIG_STMPE811_GPIOINT_DISABLE=y
+CONFIG_STMPE811_SWAPXY=n
+CONFIG_STMPE811_TEMP_DISABLE=y
+CONFIG_STMPE811_REGDEBUG=n
+CONFIG_STMPE811_THRESHX=39
+CONFIG_STMPE811_THRESHY=51
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=y
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0x5cb7
+CONFIG_NXTK_BORDERCOLOR2=0x21c9
+CONFIG_NXTK_BORDERCOLOR3=0xffdf
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=n
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=n
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxWidgets / NxWM
+#
+# Use all defaults except
+# 1. 16 bits-per-pixel
+# 2. Make the NxWidgets background color match the NxWM back color
+# 3. Build in support for keyboard input in NxConsole
+# 4. Taskbar on the left
+# 5. We do have a touchscreen
+# 6. We do want the NxWM keybard listener
+# 7. Use a larger font with the calculator
+#
+CONFIG_NXWIDGETS_BPP=16
+CONFIG_NXWIDGETS_SERVERSTACK=2048
+CONFIG_NXWIDGETS_LISTENERSTACK=2048
+CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215)
+CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241)
+CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73)
+
+CONFIG_NXCONSOLE_NXKBDIN=y
+
+CONFIG_NXWM_TASKBAR_LEFT=y
+CONFIG_NXWM_NXCONSOLE_STACKSIZE=2048
+CONFIG_NXWM_TASKBAR_VSPACING=4
+CONFIG_NXWM_UNITTEST=y
+CONFIG_NXWM_TOUCHSCREEN=y
+CONFIG_NXWM_KEYBOARD=y
+CONFIG_NXWM_HEXCALCULATOR_FONTID=5
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=y
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=325
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3220G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=y
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=n
+
+#
+# STM3220G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=y
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=n
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3220g-eval/nxwm/ld.script b/nuttx/configs/stm3220g-eval/nxwm/ld.script
new file mode 100644
index 000000000..409ecc3af
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nxwm/ld.script
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * configs/stm3220g-eval/nxwm/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 128Kb of SRAM. SRAM is split up into two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/nxwm/setenv.sh b/nuttx/configs/stm3220g-eval/nxwm/setenv.sh
new file mode 100755
index 000000000..95c73a722
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/nxwm/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3220g-eval/nxwm/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/ostest/Make.defs b/nuttx/configs/stm3220g-eval/ostest/Make.defs
new file mode 100644
index 000000000..f02aa927a
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/ostest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/ostest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/ostest/appconfig b/nuttx/configs/stm3220g-eval/ostest/appconfig
new file mode 100644
index 000000000..0db2edf80
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3220g-eval/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/stm3220g-eval/ostest/defconfig b/nuttx/configs/stm3220g-eval/ostest/defconfig
new file mode 100644
index 000000000..b2d36c9cd
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/ostest/defconfig
@@ -0,0 +1,729 @@
+############################################################################
+# configs/stm3220g-eval/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=n
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=n
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxWidgets
+CONFIG_NXWIDGETS_BPP=16
+CONFIG_NXWIDGETS_DEFAULT_FONTID=5
+
+#
+# STM3220G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+
+#
+# STM3220G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=2
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=2
+CONFIG_EXAMPLE_BUTTONS_NAME0="Key/Select"
+CONFIG_EXAMPLE_BUTTONS_NAME1="Left/Right"
+CONFIG_EXAMPLE_BUTTONS_NAME2="Up/Down"
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3220g-eval/ostest/ld.script b/nuttx/configs/stm3220g-eval/ostest/ld.script
new file mode 100644
index 000000000..17428ea85
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/ostest/ld.script
@@ -0,0 +1,120 @@
+/****************************************************************************
+ * configs/stm3220g-eval/ostest/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/ostest/setenv.sh b/nuttx/configs/stm3220g-eval/ostest/setenv.sh
new file mode 100755
index 000000000..2b8e7daa7
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/ostest/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3220g-eval/ostest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH variable
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/src/Makefile b/nuttx/configs/stm3220g-eval/src/Makefile
new file mode 100644
index 000000000..0aeb872d6
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/Makefile
@@ -0,0 +1,131 @@
+############################################################################
+# configs/stm3220g-eval/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_spi.c
+
+ifeq ($(CONFIG_HAVE_CXX),y)
+CSRCS += up_cxxinitialize.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_autoleds.c
+else
+CSRCS += up_userleds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_STM32_OTGFS),y)
+CSRCS += up_usb.c
+endif
+
+ifeq ($(CONFIG_STM32_FSMC),y)
+CSRCS += up_lcd.c up_selectlcd.c up_deselectlcd.c up_selectsram.c up_deselectsram.c up_extmem.c
+endif
+
+ifeq ($(CONFIG_ADC),y)
+CSRCS += up_adc.c
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CSRCS += up_pwm.c
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CSRCS += up_can.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+ifeq ($(CONFIG_INPUT_STMPE811),y)
+CSRCS += up_stmpe811.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/stm3220g-eval/src/stm3220g-internal.h b/nuttx/configs/stm3220g-eval/src/stm3220g-internal.h
new file mode 100644
index 000000000..27f0a004c
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/stm3220g-internal.h
@@ -0,0 +1,374 @@
+/****************************************************************************************************
+ * configs/stm3220g_eval/src/stm3220g_internal.h
+ * arch/arm/src/board/stm3220g_internal.n
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************************************/
+
+#ifndef __CONFIGS_STM3220G_EVAL_SRC_STM3220G_INTERNAL_H
+#define __CONFIGS_STM3220G_EVAL_SRC_STM3220G_INTERNAL_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************************************
+ * Definitions
+ ****************************************************************************************************/
+/* Configuration ************************************************************************************/
+/* How many SPI modules does this chip support? */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 3
+# undef CONFIG_STM32_SPI3
+#endif
+
+/* You can use either CAN1 or CAN2, but you can't use both because they share the same transceiver */
+
+#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2)
+# warning "The STM3250G-EVAL will only support one of CAN1 and CAN2"
+#endif
+
+/* You can't use CAN1 with FSMC:
+ *
+ * PD0 = FSMC_D2 & CAN1_RX
+ * PD1 = FSMC_D3 & CAN1_TX
+ */
+
+#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_FSMC)
+# warning "The STM3250G-EVAL will only support one of CAN1 and FSMC"
+#endif
+
+/* The USB OTG HS ULPI bus is shared with CAN2 bus:
+ *
+ * PB13 = ULPI_D6 & CAN2_TX
+ * PB5 = ULPI_D7 & CAN2_RX
+ */
+
+#if defined(CONFIG_STM32_CAN2) && defined(CONFIG_STM32_OTGHS)
+# warning "The STM3250G-EVAL will only support one of CAN2 and USB OTG HS"
+#endif
+
+/* STM3220G-EVAL GPIOs ******************************************************************************/
+/* LEDs */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN6)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN8)
+#define GPIO_LED3 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTI|GPIO_PIN9)
+#define GPIO_LED4 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN7)
+
+/* BUTTONS -- NOTE that all have EXTI interrupts configured */
+
+#define MIN_IRQBUTTON BUTTON_WAKEUP
+#define MAX_IRQBUTTON BUTTON_USER
+#define NUM_IRQBUTTONS (BUTTON_USER - BUTTON_WAKEUP + 1)
+
+#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN0)
+#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTC|GPIO_PIN13)
+#define GPIO_BTN_USER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTG|GPIO_PIN15)
+
+/* PWM
+ *
+ * The STM3220G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using TIM4, TIM1, or TIM8 (see board.h).
+ * Let's figure out which the user has configured.
+ */
+
+#ifdef CONFIG_PWM
+# if defined(CONFIG_STM32_TIM1_PWM)
+# define STM3220G_EVAL_PWMTIMER 1
+# elif defined(CONFIG_STM32_TIM4_PWM)
+# define STM3220G_EVAL_PWMTIMER 4
+# elif defined(CONFIG_STM32_TIM8_PWM)
+# define STM3220G_EVAL_PWMTIMER 8
+# endif
+#endif
+
+/* USB OTG FS
+ *
+ * PA9 VBUS_FS
+ * PH5 OTG_FS_PowerSwitchOn
+ * PF11 OTG_FS_Overcurrent
+ */
+
+#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
+#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_OUTPUT_SET|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN5)
+
+#ifdef CONFIG_USBHOST
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN11)
+#else
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN11)
+#endif
+
+/* The STM3220G-EVAL has two STMPE811QTR I/O expanders on board both connected
+ * to the STM32 via I2C1. They share a common interrupt line: PI2.
+ *
+ * STMPE811 U24, I2C address 0x41 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- TouchScreen_Y- LCD Connector XL
+ * X- TouchScreen_X- LCD Connector XR
+ * Y+ TouchScreen_Y+ LCD Connector XD
+ * X+ TouchScreen_X+ LCD Connector XU
+ * IN3 EXP_IO9
+ * IN2 EXP_IO10
+ * IN1 EXP_IO11
+ * IN0 EXP_IO12
+ *
+ * STMPE811 U29, I2C address 0x44 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- EXP_IO1
+ * X- EXP_IO2
+ * Y+ EXP_IO3
+ * X+ EXP_IO4
+ * IN3 EXP_IO5
+ * IN2 EXP_IO6
+ * IN1 EXP_IO7
+ * IN0 EXP_IO8
+ */
+
+#define STMPE811_ADDR1 0x41
+#define STMPE811_ADDR2 0x44
+
+#define GPIO_IO_EXPANDER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTI|GPIO_PIN2)
+
+/* GPIO settings that will be altered when external memory is selected:
+ *
+ * ----- ------- -------- ------------ ------- ------------ -------- ----------- -------- -------------
+ * PB7: FSMC NL PD0-1: FSMC D2-D3 PE0: FSMC NBL0 PF0-5: FSMC A0-A5 PG0-5: FSMC A10-A15
+ * PD3: FSMC CLK PE1: FSMC BLN1 PF6: FSMC NIORD PG6-7: FSMC INT2-3
+ * PD4: FSMC NOE PE2: FSMC A23 PF7: FSMC NREG PG9: FSMC NCE3
+ * PD5: FSMC NWE PE3-6: FSMC A19-A22 PF8: FSMC NIOWR PG9-10: FSMC NE2-3
+ * PD6: FSMC NWAIT PE7-15: FSMC D4-D12 PF9: FSMC CD PG10: FSMC NCE4 (1)
+ * PD7: FSMC NE1 PF10: FSMC INTR PG11: FSMC NCE4 (2)
+ * PD7: FSMC NCE2 PF12-15: FSMC A6-A9 PG12: FSMC NE4
+ * PD8-10: FSMC D13-D15 PG13-14: FSMC A24-A25
+ * PD11-13: FSMC_A16-A18
+ * PD14-15: FSMC D0-D1
+ */
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public data
+ ****************************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3220G-EVAL board.
+ *
+ ****************************************************************************************************/
+
+void weak_function stm32_spiinitialize(void);
+
+/****************************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related GPIO pins for
+ * the STM3220G-EVAL board.
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_OTGFS
+void weak_function stm32_usbinitialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality. This function will
+ * start a thread that will monitor for device connection/disconnection events.
+ *
+ ****************************************************************************************************/
+
+#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
+int stm32_usbhost_initialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for external memory usage
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemgpios(const uint32_t *gpios, int ngpios);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemaddr
+ *
+ * Description:
+ * Initialize adress line GPIOs for external memory access
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemaddr(int naddrs);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemdata
+ *
+ * Description:
+ * Initialize data line GPIOs for external memory access
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemdata(int ndata);
+#endif
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_enablefsmc(void);
+#endif
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_disablefsmc(void);
+#endif
+
+/************************************************************************************
+ * Name: stm32_selectsram
+ *
+ * Description:
+ * Initialize to access external SRAM. SRAM will be visible at the FSMC Bank
+ * NOR/SRAM2 base address (0x64000000)
+ *
+ * General transaction rules. The requested AHB transaction data size can be 8-,
+ * 16- or 32-bit wide whereas the SRAM has a fixed 16-bit data width. Some simple
+ * transaction rules must be followed:
+ *
+ * Case 1: AHB transaction width and SRAM data width are equal
+ * There is no issue in this case.
+ * Case 2: AHB transaction size is greater than the memory size
+ * In this case, the FSMC splits the AHB transaction into smaller consecutive
+ * memory accesses in order to meet the external data width.
+ * Case 3: AHB transaction size is smaller than the memory size.
+ * SRAM supports the byte select feature.
+ * a) FSMC allows write transactions accessing the right data through its
+ * byte lanes (NBL[1:0])
+ * b) Read transactions are allowed (the controller reads the entire memory
+ * word and uses the needed byte only). The NBL[1:0] are always kept low
+ * during read transactions.
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_selectsram(void);
+#endif
+
+/************************************************************************************
+ * Name: stm32_deselectsram
+ *
+ * Description:
+ * Disable SRAM
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_deselectsram(void);
+#endif
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_selectlcd(void);
+#endif
+
+/************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_deselectlcd(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_STM3220G_EVAL_SRC_STM3220G_INTERNAL_H */
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_adc.c b/nuttx/configs/stm3220g-eval/src/up_adc.c
new file mode 100644
index 000000000..0b4d1e48c
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_adc.c
@@ -0,0 +1,168 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_adc.c
+ * arch/arm/src/board/up_adc.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/analog/adc.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_pwm.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_ADC
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Configuration ************************************************************/
+/* Up to 3 ADC interfaces are supported */
+
+#if STM32_NADC < 3
+# undef CONFIG_STM32_ADC3
+#endif
+
+#if STM32_NADC < 2
+# undef CONFIG_STM32_ADC2
+#endif
+
+#if STM32_NADC < 1
+# undef CONFIG_STM32_ADC1
+#endif
+
+#if defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2) || defined(CONFIG_STM32_ADC3)
+#ifndef CONFIG_STM32_ADC3
+# warning "Channel information only available for ADC3"
+#endif
+
+/* The number of ADC channels in the conversion list */
+
+#define ADC3_NCHANNELS 1
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+/* The STM3220G-EVAL has a 10 Kohm potentiometer RV1 connected to PF9 of
+ * STM32F207IGH6 on the board: TIM14_CH1/FSMC_CD/ADC3_IN7
+ */
+
+/* Identifying number of each ADC channel: Variable Resistor. */
+
+#ifdef CONFIG_STM32_ADC3
+static const uint8_t g_chanlist[ADC3_NCHANNELS] = {7};
+
+/* Configurations of pins used byte each ADC channels */
+
+static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: adc_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/adc.
+ *
+ ************************************************************************************/
+
+int adc_devinit(void)
+{
+#ifdef CONFIG_STM32_ADC3
+ static bool initialized = false;
+ struct adc_dev_s *adc;
+ int ret;
+ int i;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Configure the pins as analog inputs for the selected channels */
+
+ for (i = 0; i < ADC3_NCHANNELS; i++)
+ {
+ stm32_configgpio(g_pinlist[i]);
+ }
+
+ /* Call stm32_adcinitialize() to get an instance of the ADC interface */
+
+ adc = stm32_adcinitialize(3, g_chanlist, ADC3_NCHANNELS);
+ if (adc == NULL)
+ {
+ adbg("ERROR: Failed to get ADC interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the ADC driver at "/dev/adc0" */
+
+ ret = adc_register("/dev/adc0", adc);
+ if (ret < 0)
+ {
+ adbg("adc_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+#else
+ return -ENOSYS;
+#endif
+}
+
+#endif /* CONFIG_STM32_ADC1 || CONFIG_STM32_ADC2 || CONFIG_STM32_ADC3 */
+#endif /* CONFIG_ADC */ \ No newline at end of file
diff --git a/nuttx/configs/stm3220g-eval/src/up_autoleds.c b/nuttx/configs/stm3220g-eval/src/up_autoleds.c
new file mode 100644
index 000000000..f77f1d08a
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_autoleds.c
@@ -0,0 +1,260 @@
+/****************************************************************************
+ * configs/stm3220g_eval/src/up_autoleds.c
+ * arch/arm/src/board/up_autoleds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define STM3210E_LED1 (1 << 0)
+#define STM3210E_LED2 (1 << 1)
+#define STM3210E_LED3 (1 << 2)
+#define STM3210E_LED4 (1 << 3)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+#define LED_STARTED_ON_SETBITS ((STM3210E_LED1) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS ((STM3210E_LED1|STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((STM3210E_LED1|STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS ((STM3210E_LED1) << OFF_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_CLRBITS ((STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_IRQSENABLED_ON_SETBITS ((STM3210E_LED1|STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS ((STM3210E_LED2) << OFF_SETBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_CLRBITS ((STM3210E_LED1|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_STACKCREATED_ON_SETBITS ((STM3210E_LED3) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((STM3210E_LED1|STM3210E_LED2|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS ((STM3210E_LED1|STM3210E_LED2) << OFF_SETBITS_SHIFT)
+#define LED_STACKCREATED_OFF_CLRBITS ((STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_INIRQ_ON_SETBITS ((STM3210E_LED1) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((STM3210E_LED1) << OFF_CLRBITS_SHIFT)
+
+#define LED_SIGNAL_ON_SETBITS ((STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((STM3210E_LED2) << OFF_CLRBITS_SHIFT)
+
+#define LED_ASSERTION_ON_SETBITS ((STM3210E_LED4) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_PANIC_ON_SETBITS ((STM3210E_LED4) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
+ LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
+
+ (LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
+ LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
+
+ (LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
+ LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
+
+ (LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
+ LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & STM3210E_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & STM3210E_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((clrbits & STM3210E_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, false);
+ }
+
+ if ((clrbits & STM3210E_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, false);
+ }
+}
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & STM3210E_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & STM3210E_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((setbits & STM3210E_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, true);
+ }
+
+ if ((setbits & STM3210E_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, true);
+ }
+}
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3220g-eval/src/up_boot.c b/nuttx/configs/stm3220g-eval/src/up_boot.c
new file mode 100644
index 000000000..fa24a86b4
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_boot.c
@@ -0,0 +1,108 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm3220g-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* If the FSMC is enabled, then enable SRAM access */
+
+#ifdef CONFIG_STM32_FSMC
+ stm32_selectsram();
+#endif
+
+ /* Initialize USB if the 1) OTG FS controller is in the configuration and 2)
+ * the weak function stm32_usbinitialize() has been brought into the build.
+ * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected.
+ */
+
+#ifdef CONFIG_STM32_OTGFS
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/stm3220g-eval/src/up_buttons.c b/nuttx/configs/stm3220g-eval/src/up_buttons.c
new file mode 100644
index 000000000..4847aaa7c
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_buttons.c
@@ -0,0 +1,170 @@
+/****************************************************************************
+ * configs/stm3220g-eval/src/up_buttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
+ * the BUTTON_* and JOYSTICK_* definitions in board.h
+ */
+
+static const uint16_t g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_USER
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for all pins.
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed for most keys. The exception
+ * is the WAKEUP button.
+ */
+
+ bool released = stm32_gpioread(g_buttons[i]);
+ if (i == BUTTON_WAKEUP)
+ {
+ released = !released;
+ }
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ /* The following should be atomic */
+
+ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
+ {
+ oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/stm3220g-eval/src/up_can.c b/nuttx/configs/stm3220g-eval/src/up_can.c
new file mode 100644
index 000000000..72c8f67a1
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_can.c
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_can.c
+ * arch/arm/src/board/up_can.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/can.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm32_can.h"
+#include "stm3220g-internal.h"
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+
+#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2)
+# warning "Both CAN1 and CAN2 are enabled. Assuming only CAN1."
+# undef CONFIG_STM32_CAN2
+#endif
+
+#ifdef CONFIG_STM32_CAN1
+# define CAN_PORT 1
+#else
+# define CAN_PORT 2
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: can_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/can.
+ *
+ ************************************************************************************/
+
+int can_devinit(void)
+{
+ static bool initialized = false;
+ struct can_dev_s *can;
+ int ret;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Call stm32_caninitialize() to get an instance of the CAN interface */
+
+ can = stm32_caninitialize(CAN_PORT);
+ if (can == NULL)
+ {
+ candbg("ERROR: Failed to get CAN interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the CAN driver at "/dev/can0" */
+
+ ret = can_register("/dev/can0", can);
+ if (ret < 0)
+ {
+ candbg("ERROR: can_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_CAN && (CONFIG_STM32_CAN1 || CONFIG_STM32_CAN2) */
diff --git a/nuttx/configs/stm3220g-eval/src/up_cxxinitialize.c b/nuttx/configs/stm3220g-eval/src/up_cxxinitialize.c
new file mode 100644
index 000000000..ad226f486
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_cxxinitialize.c
@@ -0,0 +1,155 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_cxxinitialize.c
+ * arch/arm/src/board/up_cxxinitialize.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include <arch/stm32/chip.h>
+#include "chip.h"
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Debug ****************************************************************************/
+/* Non-standard debug that may be enabled just for testing the static constructors */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_CXX
+#endif
+
+#ifdef CONFIG_DEBUG_CXX
+# define cxxdbg dbg
+# define cxxlldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define cxxvdbg vdbg
+# define cxxllvdbg llvdbg
+# else
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+# endif
+#else
+# define cxxdbg(x...)
+# define cxxlldbg(x...)
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This type defines one entry in initialization array */
+
+typedef void (*initializer_t)(void);
+
+/************************************************************************************
+ * External references
+ ************************************************************************************/
+/* _sinit and _einit are symbols exported by the linker script that mark the
+ * beginning and the end of the C++ initialization section.
+ */
+
+extern initializer_t _sinit;
+extern initializer_t _einit;
+
+/* _stext and _etext are symbols exported by the linker script that mark the
+ * beginning and the end of text.
+ */
+
+extern uint32_t _stext;
+extern uint32_t _etext;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_cxxinitialize
+ *
+ * Description:
+ * If C++ and C++ static constructors are supported, then this function
+ * must be provided by board-specific logic in order to perform
+ * initialization of the static C++ class instances.
+ *
+ * This function should then be called in the application-specific
+ * user_start logic in order to perform the C++ initialization. NOTE
+ * that no component of the core NuttX RTOS logic is involved; This
+ * function defintion only provides the 'contract' between application
+ * specific C++ code and platform-specific toolchain support
+ *
+ ***************************************************************************/
+
+void up_cxxinitialize(void)
+{
+ initializer_t *initp;
+
+ cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
+ &_sinit, &_einit, &_stext, &_etext);
+
+ /* Visit each entry in the initialzation table */
+
+ for (initp = &_sinit; initp != &_einit; initp++)
+ {
+ initializer_t initializer = *initp;
+ cxxdbg("initp: %p initializer: %p\n", initp, initializer);
+
+ /* Make sure that the address is non-NULL and lies in the text region
+ * defined by the linker script. Some toolchains may put NULL values
+ * or counts in the initialization table
+ */
+
+ if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
+ {
+ cxxdbg("Calling %p\n", initializer);
+ initializer();
+ }
+ }
+}
+
+#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_deselectlcd.c b/nuttx/configs/stm3220g-eval/src/up_deselectlcd.c
new file mode 100644
index 000000000..d1befac71
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_deselectlcd.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_deselectlcd.c
+ * arch/arm/src/board/up_deselectlcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ************************************************************************************/
+
+void stm32_deselectlcd(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(0xffffffff, STM32_FSMC_BCR4);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(0x0fffffff, STM32_FSMC_BTR4);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_deselectsram.c b/nuttx/configs/stm3220g-eval/src/up_deselectsram.c
new file mode 100644
index 000000000..3dd59ab41
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_deselectsram.c
@@ -0,0 +1,97 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_deselectsram.c
+ * arch/arm/src/board/up_deselectsram.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectsram
+ *
+ * Description:
+ * Disable SRAM
+ *
+ ************************************************************************************/
+
+void stm32_deselectsram(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(FSMC_BCR_RSTVALUE, STM32_FSMC_BCR2);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_RSTVALUE, STM32_FSMC_BTR2);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_extmem.c b/nuttx/configs/stm3220g-eval/src/up_extmem.c
new file mode 100644
index 000000000..179d28f11
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_extmem.c
@@ -0,0 +1,188 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_extmem.c
+ * arch/arm/src/board/up_extmem.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_fsmc.h"
+#include "stm32_gpio.h"
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# warning "FSMC is not enabled"
+#endif
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+#define STM32_FSMC_NADDRCONFIGS 26
+#define STM32_FSMC_NDATACONFIGS 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/* GPIO configurations common to most external memories */
+
+static const uint32_t g_addressconfig[STM32_FSMC_NADDRCONFIGS] =
+{
+ GPIO_FSMC_A0, GPIO_FSMC_A1 , GPIO_FSMC_A2, GPIO_FSMC_A3, GPIO_FSMC_A4 , GPIO_FSMC_A5,
+ GPIO_FSMC_A6, GPIO_FSMC_A7, GPIO_FSMC_A8, GPIO_FSMC_A9, GPIO_FSMC_A10, GPIO_FSMC_A11,
+ GPIO_FSMC_A12, GPIO_FSMC_A13, GPIO_FSMC_A14, GPIO_FSMC_A15, GPIO_FSMC_A16, GPIO_FSMC_A17,
+ GPIO_FSMC_A18, GPIO_FSMC_A19, GPIO_FSMC_A20, GPIO_FSMC_A21, GPIO_FSMC_A22, GPIO_FSMC_A23,
+ GPIO_FSMC_A24, GPIO_FSMC_A25
+};
+
+static const uint32_t g_dataconfig[STM32_FSMC_NDATACONFIGS] =
+{
+ GPIO_FSMC_D0, GPIO_FSMC_D1 , GPIO_FSMC_D2, GPIO_FSMC_D3, GPIO_FSMC_D4 , GPIO_FSMC_D5,
+ GPIO_FSMC_D6, GPIO_FSMC_D7, GPIO_FSMC_D8, GPIO_FSMC_D9, GPIO_FSMC_D10, GPIO_FSMC_D11,
+ GPIO_FSMC_D12, GPIO_FSMC_D13, GPIO_FSMC_D14, GPIO_FSMC_D15
+};
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for external memory usage
+ *
+ ************************************************************************************/
+
+void stm32_extmemgpios(const uint32_t *gpios, int ngpios)
+{
+ int i;
+
+ /* Configure GPIOs */
+
+ for (i = 0; i < ngpios; i++)
+ {
+ stm32_configgpio(gpios[i]);
+ }
+}
+
+/************************************************************************************
+ * Name: stm32_extmemaddr
+ *
+ * Description:
+ * Initialize adress line GPIOs for external memory access
+ *
+ ************************************************************************************/
+
+void stm32_extmemaddr(int naddrs)
+{
+ stm32_extmemgpios(g_addressconfig, naddrs);
+}
+
+/************************************************************************************
+ * Name: stm32_extmemdata
+ *
+ * Description:
+ * Initialize data line GPIOs for external memory access
+ *
+ ************************************************************************************/
+
+void stm32_extmemdata(int ndata)
+{
+ stm32_extmemgpios(g_dataconfig, ndata);
+}
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_enablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHB3ENR);
+ regval |= RCC_AHB3ENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHB3ENR);
+}
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_disablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Disable AHB clocking to the FSMC */
+
+ regval = getreg32(STM32_RCC_AHB3ENR);
+ regval &= ~RCC_AHB3ENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHB3ENR);
+}
diff --git a/nuttx/configs/stm3220g-eval/src/up_lcd.c b/nuttx/configs/stm3220g-eval/src/up_lcd.c
new file mode 100644
index 000000000..a1fcceef7
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_lcd.c
@@ -0,0 +1,1210 @@
+/**************************************************************************************
+ * configs/stm3220g-eval/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+/* This driver supports the following LCDs on the STM324xG_EVAL board:
+ *
+ * AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) OR
+ * AM-240320D5TOQW01H (LCD_ILI9325)
+ */
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE) || !defined(CONFIG_STM32_ILI9325_DISABLE)
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+/* Configuration **********************************************************************/
+/* CONFIG_STM32_ILI9320_DISABLE may be defined to disabled the AM-240320L8TNQW00H
+ * (LCD_ILI9320 or LCD_ILI9321)
+ * CONFIG_STM32_ILI9325_DISABLE may be defined to disabled the AM-240320D5TOQW01H
+ * (LCD_ILI9325)
+ */
+
+/* Check contrast selection */
+
+#if !defined(CONFIG_LCD_MAXCONTRAST)
+# define CONFIG_LCD_MAXCONTRAST 1
+#endif
+
+/* Check power setting */
+
+#if !defined(CONFIG_LCD_MAXPOWER) || CONFIG_LCD_MAXPOWER < 1
+# define CONFIG_LCD_MAXPOWER 1
+#endif
+
+#if CONFIG_LCD_MAXPOWER > 255
+# error "CONFIG_LCD_MAXPOWER must be less than 256 to fit in uint8_t"
+#endif
+
+/* Check orientation */
+
+#if defined(CONFIG_LCD_PORTRAIT)
+# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) || defined(CONFIG_LCD_RPORTRAIT)
+# error "Cannot define both portrait and any other orientations"
+# endif
+#elif defined(CONFIG_LCD_RPORTRAIT)
+# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
+# error "Cannot define both rportrait and any other orientations"
+# endif
+#elif defined(CONFIG_LCD_LANDSCAPE)
+# ifdef CONFIG_LCD_RLANDSCAPE
+# error "Cannot define both landscape and any other orientations"
+# endif
+#elif !defined(CONFIG_LCD_RLANDSCAPE)
+# define CONFIG_LCD_LANDSCAPE 1
+#endif
+
+/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must
+ * also be enabled.
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+# undef CONFIG_DEBUG_LCD
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_LCD
+#endif
+
+/* Display/Color Properties ***********************************************************/
+/* Display Resolution */
+
+#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
+# define STM3220G_XRES 320
+# define STM3220G_YRES 240
+#else
+# define STM3220G_XRES 240
+# define STM3220G_YRES 320
+#endif
+
+/* Color depth and format */
+
+#define STM3220G_BPP 16
+#define STM3220G_COLORFMT FB_FMT_RGB16_565
+
+/* STM3220G-EVAL LCD Hardware Definitions *********************************************/
+/* LCD /CS is CE4, Bank 3 of NOR/SRAM Bank 1~4 */
+
+#define STM3220G_LCDBASE ((uintptr_t)(0x60000000 | 0x08000000))
+#define LCD ((struct lcd_regs_s *)STM3220G_LCDBASE)
+
+#define LCD_REG_0 0x00
+#define LCD_REG_1 0x01
+#define LCD_REG_2 0x02
+#define LCD_REG_3 0x03
+#define LCD_REG_4 0x04
+#define LCD_REG_5 0x05
+#define LCD_REG_6 0x06
+#define LCD_REG_7 0x07
+#define LCD_REG_8 0x08
+#define LCD_REG_9 0x09
+#define LCD_REG_10 0x0a
+#define LCD_REG_12 0x0c
+#define LCD_REG_13 0x0d
+#define LCD_REG_14 0x0e
+#define LCD_REG_15 0x0f
+#define LCD_REG_16 0x10
+#define LCD_REG_17 0x11
+#define LCD_REG_18 0x12
+#define LCD_REG_19 0x13
+#define LCD_REG_20 0x14
+#define LCD_REG_21 0x15
+#define LCD_REG_22 0x16
+#define LCD_REG_23 0x17
+#define LCD_REG_24 0x18
+#define LCD_REG_25 0x19
+#define LCD_REG_26 0x1a
+#define LCD_REG_27 0x1b
+#define LCD_REG_28 0x1c
+#define LCD_REG_29 0x1d
+#define LCD_REG_30 0x1e
+#define LCD_REG_31 0x1f
+#define LCD_REG_32 0x20
+#define LCD_REG_33 0x21
+#define LCD_REG_34 0x22
+#define LCD_REG_36 0x24
+#define LCD_REG_37 0x25
+#define LCD_REG_40 0x28
+#define LCD_REG_41 0x29
+#define LCD_REG_43 0x2b
+#define LCD_REG_45 0x2d
+#define LCD_REG_48 0x30
+#define LCD_REG_49 0x31
+#define LCD_REG_50 0x32
+#define LCD_REG_51 0x33
+#define LCD_REG_52 0x34
+#define LCD_REG_53 0x35
+#define LCD_REG_54 0x36
+#define LCD_REG_55 0x37
+#define LCD_REG_56 0x38
+#define LCD_REG_57 0x39
+#define LCD_REG_58 0x3a
+#define LCD_REG_59 0x3b
+#define LCD_REG_60 0x3c
+#define LCD_REG_61 0x3d
+#define LCD_REG_62 0x3e
+#define LCD_REG_63 0x3f
+#define LCD_REG_64 0x40
+#define LCD_REG_65 0x41
+#define LCD_REG_66 0x42
+#define LCD_REG_67 0x43
+#define LCD_REG_68 0x44
+#define LCD_REG_69 0x45
+#define LCD_REG_70 0x46
+#define LCD_REG_71 0x47
+#define LCD_REG_72 0x48
+#define LCD_REG_73 0x49
+#define LCD_REG_74 0x4a
+#define LCD_REG_75 0x4b
+#define LCD_REG_76 0x4c
+#define LCD_REG_77 0x4d
+#define LCD_REG_78 0x4e
+#define LCD_REG_79 0x4f
+#define LCD_REG_80 0x50
+#define LCD_REG_81 0x51
+#define LCD_REG_82 0x52
+#define LCD_REG_83 0x53
+#define LCD_REG_96 0x60
+#define LCD_REG_97 0x61
+#define LCD_REG_106 0x6a
+#define LCD_REG_118 0x76
+#define LCD_REG_128 0x80
+#define LCD_REG_129 0x81
+#define LCD_REG_130 0x82
+#define LCD_REG_131 0x83
+#define LCD_REG_132 0x84
+#define LCD_REG_133 0x85
+#define LCD_REG_134 0x86
+#define LCD_REG_135 0x87
+#define LCD_REG_136 0x88
+#define LCD_REG_137 0x89
+#define LCD_REG_139 0x8b
+#define LCD_REG_140 0x8c
+#define LCD_REG_141 0x8d
+#define LCD_REG_143 0x8f
+#define LCD_REG_144 0x90
+#define LCD_REG_145 0x91
+#define LCD_REG_146 0x92
+#define LCD_REG_147 0x93
+#define LCD_REG_148 0x94
+#define LCD_REG_149 0x95
+#define LCD_REG_150 0x96
+#define LCD_REG_151 0x97
+#define LCD_REG_152 0x98
+#define LCD_REG_153 0x99
+#define LCD_REG_154 0x9a
+#define LCD_REG_157 0x9d
+#define LCD_REG_164 0xa4
+#define LCD_REG_192 0xc0
+#define LCD_REG_193 0xc1
+#define LCD_REG_229 0xe5
+
+/* LCD IDs */
+
+#define ILI9320_ID 0x9320
+#define ILI9321_ID 0x9321
+#define ILI9325_ID 0x9325
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg dbg
+# define lcdvdbg vdbg
+#else
+# define lcddbg(x...)
+# define lcdvdbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/* LCD type */
+
+enum lcd_type_e
+{
+ LCD_TYPE_UNKNOWN = 0,
+ LCD_TYPE_ILI9320,
+ LCD_TYPE_ILI9325
+};
+
+/* This structure describes the LCD registers */
+
+struct lcd_regs_s
+{
+ volatile uint16_t address;
+ volatile uint16_t value;
+};
+
+/* This structure describes the state of this driver */
+
+struct stm3220g_dev_s
+{
+ /* Publically visible device structure */
+
+ struct lcd_dev_s dev;
+
+ /* Private LCD-specific information follows */
+
+ uint8_t type; /* LCD type. See enum lcd_type_e */
+ uint8_t power; /* Current power setting */
+};
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+/* Low Level LCD access */
+
+static void stm3220g_writereg(uint8_t regaddr, uint16_t regval);
+static uint16_t stm3220g_readreg(uint8_t regaddr);
+static inline void stm3220g_gramselect(void);
+static inline void stm3220g_writegram(uint16_t rgbval);
+static void stm3220g_readnosetup(FAR uint16_t *accum);
+static uint16_t stm3220g_readnoshift(FAR uint16_t *accum);
+static void stm3220g_setcursor(uint16_t col, uint16_t row);
+
+/* LCD Data Transfer Methods */
+
+static int stm3220g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels);
+static int stm3220g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels);
+
+/* LCD Configuration */
+
+static int stm3220g_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo);
+static int stm3220g_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo);
+
+/* LCD RGB Mapping */
+
+#ifdef CONFIG_FB_CMAP
+# error "RGB color mapping not supported by this driver"
+#endif
+
+/* Cursor Controls */
+
+#ifdef CONFIG_FB_HWCURSOR
+# error "Cursor control not supported by this driver"
+#endif
+
+/* LCD Specific Controls */
+
+static int stm3220g_getpower(struct lcd_dev_s *dev);
+static int stm3220g_setpower(struct lcd_dev_s *dev, int power);
+static int stm3220g_getcontrast(struct lcd_dev_s *dev);
+static int stm3220g_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
+
+/* Initialization */
+
+static inline void stm3220g_lcdinitialize(void);
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is working memory allocated by the LCD driver for each LCD device
+ * and for each color plane. This memory will hold one raster line of data.
+ * The size of the allocated run buffer must therefore be at least
+ * (bpp * xres / 8). Actual alignment of the buffer must conform to the
+ * bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
+ */
+
+static uint16_t g_runbuffer[STM3220G_XRES];
+
+/* This structure describes the overall LCD video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{
+ .fmt = STM3220G_COLORFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */
+ .xres = STM3220G_XRES, /* Horizontal resolution in pixel columns */
+ .yres = STM3220G_YRES, /* Vertical resolution in pixel rows */
+ .nplanes = 1, /* Number of color planes supported */
+};
+
+/* This is the standard, NuttX Plane information object */
+
+static const struct lcd_planeinfo_s g_planeinfo =
+{
+ .putrun = stm3220g_putrun, /* Put a run into LCD memory */
+ .getrun = stm3220g_getrun, /* Get a run from LCD memory */
+ .buffer = (uint8_t*)g_runbuffer, /* Run scratch buffer */
+ .bpp = STM3220G_BPP, /* Bits-per-pixel */
+};
+
+/* This is the standard, NuttX LCD driver object */
+
+static struct stm3220g_dev_s g_lcddev =
+{
+ .dev =
+ {
+ /* LCD Configuration */
+
+ .getvideoinfo = stm3220g_getvideoinfo,
+ .getplaneinfo = stm3220g_getplaneinfo,
+
+ /* LCD RGB Mapping -- Not supported */
+ /* Cursor Controls -- Not supported */
+
+ /* LCD Specific Controls */
+
+ .getpower = stm3220g_getpower,
+ .setpower = stm3220g_setpower,
+ .getcontrast = stm3220g_getcontrast,
+ .setcontrast = stm3220g_setcontrast,
+ },
+};
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: stm3220g_writereg
+ *
+ * Description:
+ * Write to an LCD register
+ *
+ **************************************************************************************/
+
+static void stm3220g_writereg(uint8_t regaddr, uint16_t regval)
+{
+ /* Write the register address then write the register value */
+
+ LCD->address = regaddr;
+ LCD->value = regval;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_readreg
+ *
+ * Description:
+ * Read from an LCD register
+ *
+ **************************************************************************************/
+
+static uint16_t stm3220g_readreg(uint8_t regaddr)
+{
+ /* Write the register address then read the register value */
+
+ LCD->address = regaddr;
+ return LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_gramselect
+ *
+ * Description:
+ * Setup to read or write multiple pixels to the GRAM memory
+ *
+ **************************************************************************************/
+
+static inline void stm3220g_gramselect(void)
+{
+ LCD->address = LCD_REG_34;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_writegram
+ *
+ * Description:
+ * Write one pixel to the GRAM memory
+ *
+ **************************************************************************************/
+
+static inline void stm3220g_writegram(uint16_t rgbval)
+{
+ /* Write the value (GRAM register already selected) */
+
+ LCD->value = rgbval;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_readnosetup
+ *
+ * Description:
+ * Prime the operation by reading one pixel from the GRAM memory if necessary for
+ * this LCD type. When reading 16-bit gram data, there may be some shifts in the
+ * returned data:
+ *
+ * - ILI932x: Discard first dummy read; no shift in the return data
+ *
+ **************************************************************************************/
+
+static void stm3220g_readnosetup(FAR uint16_t *accum)
+{
+ /* Read-ahead one pixel */
+
+ *accum = LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_readnoshift
+ *
+ * Description:
+ * Read one correctly aligned pixel from the GRAM memory. Possibly shifting the
+ * data and possibly swapping red and green components.
+ *
+ * - ILI932x: Unknown -- assuming colors are in the color order
+ *
+ **************************************************************************************/
+
+static uint16_t stm3220g_readnoshift(FAR uint16_t *accum)
+{
+ /* Read the value (GRAM register already selected) */
+
+ return LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_setcursor
+ *
+ * Description:
+ * Set the cursor position. In landscape mode, the "column" is actually the physical
+ * Y position and the "row" is the physical X position.
+ *
+ **************************************************************************************/
+
+static void stm3220g_setcursor(uint16_t col, uint16_t row)
+{
+ stm3220g_writereg(LCD_REG_32, row); /* GRAM horizontal address */
+ stm3220g_writereg(LCD_REG_33, col); /* GRAM vertical address */
+}
+
+/**************************************************************************************
+ * Name: stm3220g_dumprun
+ *
+ * Description:
+ * Dump the contexts of the run buffer:
+ *
+ * run - The buffer in containing the run read to be dumped
+ * npixels - The number of pixels to dump
+ *
+ **************************************************************************************/
+
+#if 0 /* Sometimes useful */
+static void stm3220g_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels)
+{
+ int i, j;
+
+ lib_rawprintf("\n%s:\n", msg);
+ for (i = 0; i < npixels; i += 16)
+ {
+ up_putc(' ');
+ lib_rawprintf(" ");
+ for (j = 0; j < 16; j++)
+ {
+ lib_rawprintf(" %04x", *run++);
+ }
+ up_putc('\n');
+ }
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm3220g_putrun
+ *
+ * Description:
+ * This method can be used to write a partial raster line to the LCD:
+ *
+ * row - Starting row to write to (range: 0 <= row < yres)
+ * col - Starting column to write to (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer containing the run to be written to the LCD
+ * npixels - The number of pixels to write to the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int stm3220g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels)
+{
+ FAR const uint16_t *src = (FAR const uint16_t*)buffer;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Write the run to GRAM. */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+ /* Convert coordinates -- Here the edge away from the row of buttons on
+ * the STM3220G-EVAL is used as the top.
+ */
+
+ /* Write the GRAM data, manually incrementing X */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3220g_setcursor(col, row);
+ stm3220g_gramselect();
+ stm3220g_writegram(*src++);
+
+ /* Increment to next column */
+
+ col++;
+ }
+#elif defined(CONFIG_LCD_RLANDSCAPE)
+ /* Convert coordinates -- Here the edge next to the row of buttons on
+ * the STM3220G-EVAL is used as the top.
+ */
+
+ col = (STM3220G_XRES-1) - col;
+ row = (STM3220G_YRES-1) - row;
+
+ /* Set the cursor position */
+
+ stm3220g_setcursor(col, row);
+
+ /* Then write the GRAM data, auto-decrementing X */
+
+ stm3220g_gramselect();
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position (auto-decrements to the next column) */
+
+ stm3220g_writegram(*src++);
+ }
+#elif defined(CONFIG_LCD_PORTRAIT)
+ /* Convert coordinates. In this configuration, the top of the display is to the left
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ col = (STM3220G_XRES-1) - col;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3220g_setcursor(row, col);
+ stm3220g_gramselect();
+ stm3220g_writegram(*src++);
+
+ /* Increment to next column */
+
+ col--;
+ }
+#else /* CONFIG_LCD_RPORTRAIT */
+ /* Convert coordinates. In this configuration, the top of the display is to the right
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ row = (STM3220G_YRES-1) - row;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3220g_setcursor(row, col);
+ stm3220g_gramselect();
+ stm3220g_writegram(*src++);
+
+ /* Decrement to next column */
+
+ col++;
+ }
+#endif
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_getrun
+ *
+ * Description:
+ * This method can be used to read a partial raster line from the LCD:
+ *
+ * row - Starting row to read from (range: 0 <= row < yres)
+ * col - Starting column to read read (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer in which to return the run read from the LCD
+ * npixels - The number of pixels to read from the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int stm3220g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels)
+{
+ FAR uint16_t *dest = (FAR uint16_t*)buffer;
+ void (*readsetup)(FAR uint16_t *accum);
+ uint16_t (*readgram)(FAR uint16_t *accum);
+ uint16_t accum;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Configure according to the LCD type. Kind of silly with only one LCD type. */
+
+ switch (g_lcddev.type)
+ {
+ case LCD_TYPE_ILI9320:
+ case LCD_TYPE_ILI9325:
+ readsetup = stm3220g_readnosetup;
+ readgram = stm3220g_readnoshift;
+ break;
+
+ default: /* Shouldn't happen */
+ return -ENOSYS;
+ }
+
+ /* Read the run from GRAM. */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+ /* Convert coordinates -- Here the edge away from the row of buttons on
+ * the STM3220G-EVAL is used as the top.
+ */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position */
+
+ stm3220g_setcursor(row, col);
+ stm3220g_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Increment to next column */
+
+ col++;
+ }
+#elif defined(CONFIG_LCD_RLANDSCAPE)
+ /* Convert coordinates -- Here the edge next to the row of buttons on
+ * the STM3220G-EVAL is used as the top.
+ */
+
+ col = (STM3220G_XRES-1) - col;
+ row = (STM3220G_YRES-1) - row;
+
+ /* Set the cursor position */
+
+ stm3220g_setcursor(col, row);
+
+ /* Then read the GRAM data, auto-decrementing Y */
+
+ stm3220g_gramselect();
+
+ /* Prime the pump for unaligned read data */
+
+ readsetup(&accum);
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position (autoincrements to the next row) */
+
+ *dest++ = readgram(&accum);
+ }
+#elif defined(CONFIG_LCD_PORTRAIT)
+ /* Convert coordinates. In this configuration, the top of the display is to the left
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ col = (STM3220G_XRES-1) - col;
+
+ /* Then read the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position */
+
+ stm3220g_setcursor(row, col);
+ stm3220g_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Increment to next column */
+
+ col--;
+ }
+#else /* CONFIG_LCD_RPORTRAIT */
+ /* Convert coordinates. In this configuration, the top of the display is to the right
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ row = (STM3220G_YRES-1) - row;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3220g_setcursor(row, col);
+ stm3220g_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Decrement to next column */
+
+ col++;
+ }
+#endif
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_getvideoinfo
+ *
+ * Description:
+ * Get information about the LCD video controller configuration.
+ *
+ **************************************************************************************/
+
+static int stm3220g_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ DEBUGASSERT(dev && vinfo);
+ lcdvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
+ g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_getplaneinfo
+ *
+ * Description:
+ * Get information about the configuration of each LCD color plane.
+ *
+ **************************************************************************************/
+
+static int stm3220g_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo)
+{
+ DEBUGASSERT(dev && pinfo && planeno == 0);
+ lcdvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
+ memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_getpower
+ *
+ * Description:
+ * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3220g_getpower(struct lcd_dev_s *dev)
+{
+ lcdvdbg("power: %d\n", 0);
+ return g_lcddev.power;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_poweroff
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3220g_poweroff(void)
+{
+ /* Turn the display off */
+
+ stm3220g_writereg(LCD_REG_7, 0);
+
+ /* Remember the power off state */
+
+ g_lcddev.power = 0;
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_setpower
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3220g_setpower(struct lcd_dev_s *dev, int power)
+{
+ lcdvdbg("power: %d\n", power);
+ DEBUGASSERT((unsigned)power <= CONFIG_LCD_MAXPOWER);
+
+ /* Set new power level */
+
+ if (power > 0)
+ {
+ /* Then turn the display on */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE) || !defined(CONFIG_STM32_ILI9325_DISABLE)
+ stm3220g_writereg(LCD_REG_7, 0x0173);
+#endif
+ g_lcddev.power = power;
+ }
+ else
+ {
+ /* Turn the display off */
+
+ stm3220g_poweroff();
+ }
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_getcontrast
+ *
+ * Description:
+ * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int stm3220g_getcontrast(struct lcd_dev_s *dev)
+{
+ lcdvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_setcontrast
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int stm3220g_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
+{
+ lcdvdbg("contrast: %d\n", contrast);
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: stm3220g_lcdinitialize
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static inline void stm3220g_lcdinitialize(void)
+{
+ uint16_t id;
+
+ /* Check LCD ID */
+
+ id = stm3220g_readreg(LCD_REG_0);
+ lcddbg("LCD ID: %04x\n", id);
+
+ /* Check if the ID is for the STM32_ILI9320 (or ILI9321) or STM32_ILI9325 */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE) && !defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (id == ILI9320_ID || id == ILI9321_ID || id == ILI9325_ID)
+#elif !defined(CONFIG_STM32_ILI9320_DISABLE) && defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (id == ILI9320_ID || id == ILI9321_ID)
+#else /* if defined(CONFIG_STM32_ILI9320_DISABLE) && !defined(CONFIG_STM32_ILI9325_DISABLE)) */
+ if (id == ILI9325_ID)
+#endif
+ {
+ /* Save the LCD type (not actually used at for anything important) */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE)
+# if !defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (id == ILI9325_ID)
+ {
+ g_lcddev.type = LCD_TYPE_ILI9325;
+ }
+ else
+# endif
+ {
+ g_lcddev.type = LCD_TYPE_ILI9320;
+ stm3220g_writereg(LCD_REG_229, 0x8000); /* Set the internal vcore voltage */
+ }
+#else /* if !defined(CONFIG_STM32_ILI9325_DISABLE) */
+ g_lcddev.type = LCD_TYPE_ILI9325;
+#endif
+ lcddbg("LCD type: %d\n", g_lcddev.type);
+
+ /* Start Initial Sequence */
+
+ stm3220g_writereg(LCD_REG_0, 0x0001); /* Start internal OSC. */
+ stm3220g_writereg(LCD_REG_1, 0x0100); /* Set SS and SM bit */
+ stm3220g_writereg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
+ stm3220g_writereg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */
+ //stm3220g_writereg(LCD_REG_3, 0x1018); /* Set GRAM write direction and BGR=1. */
+ stm3220g_writereg(LCD_REG_4, 0x0000); /* Resize register */
+ stm3220g_writereg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
+ stm3220g_writereg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
+ stm3220g_writereg(LCD_REG_10, 0x0000); /* FMARK function */
+ stm3220g_writereg(LCD_REG_12, 0x0000); /* RGB interface setting */
+ stm3220g_writereg(LCD_REG_13, 0x0000); /* Frame marker Position */
+ stm3220g_writereg(LCD_REG_15, 0x0000); /* RGB interface polarity */
+
+ /* Power On sequence */
+
+ stm3220g_writereg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3220g_writereg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ stm3220g_writereg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
+ stm3220g_writereg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
+ up_mdelay(200); /* Dis-charge capacitor power voltage (200ms) */
+
+ stm3220g_writereg(LCD_REG_16, 0x17b0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3220g_writereg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ up_mdelay(50);
+
+ stm3220g_writereg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
+ up_mdelay(50);
+
+ stm3220g_writereg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
+ stm3220g_writereg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
+ up_mdelay(50);
+
+ stm3220g_writereg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
+ stm3220g_writereg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */
+
+ /* Adjust the Gamma Curve (ILI9320/1) */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE)
+# if !defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (g_lcddev.type == LCD_TYPE_ILI9320)
+# endif
+ {
+ stm3220g_writereg(LCD_REG_48, 0x0006);
+ stm3220g_writereg(LCD_REG_49, 0x0101);
+ stm3220g_writereg(LCD_REG_50, 0x0003);
+ stm3220g_writereg(LCD_REG_53, 0x0106);
+ stm3220g_writereg(LCD_REG_54, 0x0b02);
+ stm3220g_writereg(LCD_REG_55, 0x0302);
+ stm3220g_writereg(LCD_REG_56, 0x0707);
+ stm3220g_writereg(LCD_REG_57, 0x0007);
+ stm3220g_writereg(LCD_REG_60, 0x0600);
+ stm3220g_writereg(LCD_REG_61, 0x020b);
+ }
+#endif
+ /* Adjust the Gamma Curve (ILI9325) */
+
+#if !defined(CONFIG_STM32_ILI9325_DISABLE)
+# if !defined(CONFIG_STM32_ILI9320_DISABLE)
+ else
+# endif
+ {
+ stm3220g_writereg(LCD_REG_48, 0x0007);
+ stm3220g_writereg(LCD_REG_49, 0x0302);
+ stm3220g_writereg(LCD_REG_50, 0x0105);
+ stm3220g_writereg(LCD_REG_53, 0x0206);
+ stm3220g_writereg(LCD_REG_54, 0x0808);
+ stm3220g_writereg(LCD_REG_55, 0x0206);
+ stm3220g_writereg(LCD_REG_56, 0x0504);
+ stm3220g_writereg(LCD_REG_57, 0x0007);
+ stm3220g_writereg(LCD_REG_60, 0x0105);
+ stm3220g_writereg(LCD_REG_61, 0x0808);
+ }
+#endif
+
+ /* Set GRAM area */
+
+ stm3220g_writereg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
+ stm3220g_writereg(LCD_REG_81, 0x00ef); /* Horizontal GRAM End Address */
+ stm3220g_writereg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
+ stm3220g_writereg(LCD_REG_83, 0x013f); /* Vertical GRAM End Address */
+ stm3220g_writereg(LCD_REG_96, 0x2700); /* Gate Scan Line */
+ //stm3220g_writereg(LCD_REG_96, 0xa700); /* Gate Scan Line(GS=1, scan direction is G320~G1) */
+ stm3220g_writereg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
+ stm3220g_writereg(LCD_REG_106, 0x0000); /* Set scrolling line */
+
+ /* Partial Display Control */
+
+ stm3220g_writereg(LCD_REG_128, 0x0000);
+ stm3220g_writereg(LCD_REG_129, 0x0000);
+ stm3220g_writereg(LCD_REG_130, 0x0000);
+ stm3220g_writereg(LCD_REG_131, 0x0000);
+ stm3220g_writereg(LCD_REG_132, 0x0000);
+ stm3220g_writereg(LCD_REG_133, 0x0000);
+
+ /* Panel Control */
+
+ stm3220g_writereg(LCD_REG_144, 0x0010);
+ stm3220g_writereg(LCD_REG_146, 0x0000);
+ stm3220g_writereg(LCD_REG_147, 0x0003);
+ stm3220g_writereg(LCD_REG_149, 0x0110);
+ stm3220g_writereg(LCD_REG_151, 0x0000);
+ stm3220g_writereg(LCD_REG_152, 0x0000);
+
+ /* Set GRAM write direction and BGR = 1
+ *
+ * I/D=01 (Horizontal : increment, Vertical : decrement)
+ * AM=1 (address is updated in vertical writing direction)
+ */
+
+ stm3220g_writereg(LCD_REG_3, 0x1018);
+ stm3220g_writereg(LCD_REG_7, 0); /* Display off */
+ }
+ else
+ {
+ lcddbg("Unsupported LCD type\n");
+ }
+}
+
+ /**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ lcdvdbg("Initializing\n");
+
+ /* Configure GPIO pins and configure the FSMC to support the LCD */
+
+ stm32_selectlcd();
+
+ /* Configure and enable LCD */
+
+ up_mdelay(50);
+ stm3220g_lcdinitialize();
+
+ /* Clear the display (setting it to the color 0=black) */
+
+ stm3220g_lcdclear(0);
+
+ /* Turn the display off */
+
+ stm3220g_poweroff();
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return &g_lcddev.dev;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ stm3220g_poweroff();
+ stm32_deselectlcd();
+}
+
+/**************************************************************************************
+ * Name: stm3220g_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the stm3220g-EVAL board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * display is cleared by simply setting all GRAM memory to the specified color.
+ *
+ **************************************************************************************/
+
+void stm3220g_lcdclear(uint16_t color)
+{
+ uint32_t i = 0;
+
+ stm3220g_setcursor(0, STM3220G_XRES-1);
+ stm3220g_gramselect();
+ for (i = 0; i < STM3220G_XRES * STM3220G_YRES; i++)
+ {
+ LCD->value = color;
+ }
+}
+
+#endif /* !CONFIG_STM32_ILI9320_DISABLE || !CONFIG_STM32_ILI9325_DISABLE */
diff --git a/nuttx/configs/stm3220g-eval/src/up_nsh.c b/nuttx/configs/stm3220g-eval/src/up_nsh.c
new file mode 100644
index 000000000..e1359de96
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_nsh.c
@@ -0,0 +1,232 @@
+/****************************************************************************
+ * config/stm3220g_eval/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_STM32_SPI1
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+#endif
+
+#ifdef CONFIG_STM32_SDIO
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#ifdef CONFIG_STM32_OTGFS
+# include "stm32_usbhost.h"
+#endif
+
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* For now, don't build in any SPI1 support -- NSH is not using it */
+
+#undef CONFIG_STM32_SPI1
+
+/* MMCSD PORT and SLOT number probably depend on the board configuration */
+
+#define HAVE_USBDEV 1
+#define HAVE_MMCSD 1
+#define HAVE_USBHOST 1
+
+#if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+#endif
+
+#ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
+# undef HAVE_MMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* Can't support USB host or device features if USB OTG FS is not enabled */
+
+#ifndef CONFIG_STM32_OTGFS
+# undef HAVE_USBDEV
+# undef HAVE_USBHOST
+#endif
+
+/* Can't support USB device is USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef HAVE_USBDEV
+#endif
+
+/* Can't support USB host is USB host is not enabled */
+
+#ifndef CONFIG_USBHOST
+# undef HAVE_USBHOST
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef CONFIG_STM32_SPI1
+ FAR struct spi_dev_s *spi;
+ FAR struct mtd_dev_s *mtd;
+#endif
+#ifdef HAVE_MMCSD
+ FAR struct sdio_dev_s *sdio;
+#endif
+#if defined(HAVE_MMCSD) || defined (HAVE_USBHOST)
+ int ret;
+#endif
+
+ /* Configure SPI-based devices */
+
+#ifdef CONFIG_STM32_SPI1
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(1);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port 0\n");
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */
+
+ mtd = m25p_initialize(spi);
+ if (!mtd)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n");
+ return -ENODEV;
+ }
+
+#warning "Now what are we going to do with this SPI FLASH driver?"
+#endif
+
+ /* Mount the SDIO-based MMC/SD block driver */
+
+#ifdef HAVE_MMCSD
+ /* First, get an instance of the SDIO interface */
+
+ message("nsh_archinitialize: Initializing SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the STM3220G-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+#endif
+
+ /* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
+ * will monitor for USB connection and disconnection events.
+ */
+
+#ifdef HAVE_USBHOST
+ ret = stm32_usbhost_initialize();
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret);
+ return ret;
+ }
+#endif
+
+ return OK;
+}
diff --git a/nuttx/configs/stm3220g-eval/src/up_pwm.c b/nuttx/configs/stm3220g-eval/src/up_pwm.c
new file mode 100644
index 000000000..dff732037
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_pwm.c
@@ -0,0 +1,120 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_pwm.c
+ * arch/arm/src/board/up_pwm.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/pwm.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "stm32_pwm.h"
+#include "stm3220g-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* PWM
+ *
+ * The STM3220G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using variously unused pins on the board for
+ * PWM output (see board.h for details of pins).
+ */
+
+#ifdef CONFIG_PWM
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pwm_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/pwm.
+ *
+ ************************************************************************************/
+
+int pwm_devinit(void)
+{
+ static bool initialized = false;
+ struct pwm_lowerhalf_s *pwm;
+ int ret;
+
+ /* Have we already initialized? */
+
+ if (!initialized)
+ {
+ /* Call stm32_pwminitialize() to get an instance of the PWM interface */
+
+ pwm = stm32_pwminitialize(STM3220G_EVAL_PWMTIMER);
+ if (!pwm)
+ {
+ dbg("Failed to get the STM32 PWM lower half\n");
+ return -ENODEV;
+ }
+
+ /* Register the PWM driver at "/dev/pwm0" */
+
+ ret = pwm_register("/dev/pwm0", pwm);
+ if (ret < 0)
+ {
+ adbg("pwm_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_PWM */
diff --git a/nuttx/configs/stm3220g-eval/src/up_selectlcd.c b/nuttx/configs/stm3220g-eval/src/up_selectlcd.c
new file mode 100644
index 000000000..f6c531270
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_selectlcd.c
@@ -0,0 +1,169 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_selectlcd.c
+ * arch/arm/src/board/up_selectlcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/* SRAM pin definitions */
+
+#define LCD_NADDRLINES 1
+#define LCD_NDATALINES 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* Pin Usage (per schematic)
+ * SRAM LCD
+ * D[0..15] [0..15] [0..15]
+ * A[0..25] [0..22] [0] RS
+ * FSMC_NBL0 PE0 OUT --- ---
+ * FSMC_NBL1 PE1 OUT --- ---
+ * FSMC_NE2 PG9 OUT --- ---
+ * FSMC_NE3 PG10 OUT --- ~CS
+ * FSMC_NE4 PG12 OUT --- ---
+ * FSMC_NWE PD5 OUT --- ~WR/SCL
+ * FSMC_NOE PD4 OUT --- ~RD
+ * FSMC_NWAIT PD6 IN --- ---
+ * FSMC_INT2 PG6* IN --- ---
+ * FSMC_INT3
+ * FSMC_INTR
+ * FSMC_CD
+ * FSMC_CLK
+ * FSMC_NCE2
+ * FSMC_NCE3
+ * FSMC_NCE4_1
+ * FSMC_NCE4_2
+ * FSMC_NIORD
+ * FSMC_NIOWR
+ * FSMC_NL
+ * FSMC_NREG
+ */
+
+/* GPIO configurations unique to the LCD */
+
+static const uint32_t g_lcdconfig[] =
+{
+ /* NOE, NWE, and NE3 */
+
+ GPIO_FSMC_NOE, GPIO_FSMC_NWE, GPIO_FSMC_NE3
+};
+#define NLCD_CONFIG (sizeof(g_lcdconfig)/sizeof(uint32_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+void stm32_selectlcd(void)
+{
+ /* Configure new GPIO pins */
+
+ stm32_extmemaddr(LCD_NADDRLINES); /* Common address lines: A0 */
+ stm32_extmemdata(LCD_NDATALINES); /* Common data lines: D0-D15 */
+ stm32_extmemgpios(g_lcdconfig, NLCD_CONFIG); /* LCD-specific control lines */
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Color LCD configuration (LCD configured as follow):
+ *
+ * - Data/Address MUX = Disable "FSMC_BCR_MUXEN" just not enable it.
+ * - Extended Mode = Disable "FSMC_BCR_EXTMOD"
+ * - Memory Type = SRAM "FSMC_BCR_SRAM"
+ * - Data Width = 16bit "FSMC_BCR_MWID16"
+ * - Write Operation = Enable "FSMC_BCR_WREN"
+ * - Asynchronous Wait = Disable
+ */
+
+ /* Bank3 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR3);
+
+ /* Bank3 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(5) | FSMC_BTR_ADDHLD(0) | FSMC_BTR_DATAST(9) | FSMC_BTR_BUSTRUN(0) |
+ FSMC_BTR_CLKDIV(0) | FSMC_BTR_DATLAT(0) | FSMC_BTR_ACCMODA, STM32_FSMC_BTR3);
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR3);
+
+ /* Enable the bank by setting the MBKEN bit */
+
+ putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR3);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_selectsram.c b/nuttx/configs/stm3220g-eval/src/up_selectsram.c
new file mode 100644
index 000000000..8f351223d
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_selectsram.c
@@ -0,0 +1,194 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_selectsram.c
+ * arch/arm/src/board/up_selectsram.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/* SRAM Timing */
+
+#define SRAM_ADDRESS_SETUP_TIME 3
+#define SRAM_ADDRESS_HOLD_TIME 0
+#define SRAM_DATA_SETUP_TIME 6
+#define SRAM_BUS_TURNAROUND_DURATION 1
+#define SRAM_CLK_DIVISION 0
+#define SRAM_DATA_LATENCY 0
+
+/* SRAM pin definitions */
+
+#define SRAM_NADDRLINES 21
+#define SRAM_NDATALINES 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+/* GPIOs Configuration **************************************************************
+ * PD0 <-> FSMC_D2 PE0 <-> FSMC_NBL0 PF0 <-> FSMC_A0 PG0 <-> FSMC_A10
+ * PD1 <-> FSMC_D3 PE1 <-> FSMC_NBL1 PF1 <-> FSMC_A1 PG1 <-> FSMC_A11
+ * PD4 <-> FSMC_NOE PE3 <-> FSMC_A19 PF2 <-> FSMC_A2 PG2 <-> FSMC_A12
+ * PD5 <-> FSMC_NWE PE4 <-> FSMC_A20 PF3 <-> FSMC_A3 PG3 <-> FSMC_A13
+ * PD8 <-> FSMC_D13 PE7 <-> FSMC_D4 PF4 <-> FSMC_A4 PG4 <-> FSMC_A14
+ * PD9 <-> FSMC_D14 PE8 <-> FSMC_D5 PF5 <-> FSMC_A5 PG5 <-> FSMC_A15
+ * PD10 <-> FSMC_D15 PE9 <-> FSMC_D6 PF12 <-> FSMC_A6 PG9 <-> FSMC_NE2
+ * PD11 <-> FSMC_A16 PE10 <-> FSMC_D7 PF13 <-> FSMC_A7
+ * PD12 <-> FSMC_A17 PE11 <-> FSMC_D8 PF14 <-> FSMC_A8
+ * PD13 <-> FSMC_A18 PE12 <-> FSMC_D9 PF15 <-> FSMC_A9
+ * PD14 <-> FSMC_D0 PE13 <-> FSMC_D10
+ * PD15 <-> FSMC_D1 PE14 <-> FSMC_D11
+ * PE15 <-> FSMC_D12
+ */
+
+/* GPIO configurations unique to SRAM */
+
+static const uint32_t g_sramconfig[] =
+{
+ /* NE3, NBL0, NBL1, */
+
+ GPIO_FSMC_NOE, GPIO_FSMC_NWE, GPIO_FSMC_NBL0, GPIO_FSMC_NBL1, GPIO_FSMC_NE2
+};
+#define NSRAM_CONFIG (sizeof(g_sramconfig)/sizeof(uint32_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectsram
+ *
+ * Description:
+ * Initialize to access external SRAM. SRAM will be visible at the FSMC Bank
+ * NOR/SRAM2 base address (0x64000000)
+ *
+ * General transaction rules. The requested AHB transaction data size can be 8-,
+ * 16- or 32-bit wide whereas the SRAM has a fixed 16-bit data width. Some simple
+ * transaction rules must be followed:
+ *
+ * Case 1: AHB transaction width and SRAM data width are equal
+ * There is no issue in this case.
+ * Case 2: AHB transaction size is greater than the memory size
+ * In this case, the FSMC splits the AHB transaction into smaller consecutive
+ * memory accesses in order to meet the external data width.
+ * Case 3: AHB transaction size is smaller than the memory size.
+ * SRAM supports the byte select feature.
+ * a) FSMC allows write transactions accessing the right data through its
+ * byte lanes (NBL[1:0])
+ * b) Read transactions are allowed (the controller reads the entire memory
+ * word and uses the needed byte only). The NBL[1:0] are always kept low
+ * during read transactions.
+ *
+ ************************************************************************************/
+
+void stm32_selectsram(void)
+{
+ /* Configure new GPIO pins */
+
+ stm32_extmemaddr(SRAM_NADDRLINES); /* Common address lines: A0-A20 */
+ stm32_extmemdata(SRAM_NDATALINES); /* Common data lines: D0-D15 */
+ stm32_extmemgpios(g_sramconfig, NSRAM_CONFIG); /* SRAM-specific control lines */
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Bank1 NOR/SRAM control register configuration
+ *
+ * Bank enable : Not yet
+ * Data address mux : Disabled
+ * Memory Type : PSRAM
+ * Data bus width : 16-bits
+ * Flash access : Disabled
+ * Burst access mode : Disabled
+ * Polarity : Low
+ * Wrapped burst mode : Disabled
+ * Write timing : Before state
+ * Write enable : Yes
+ * Wait signal : Disabled
+ * Extended mode : Disabled
+ * Asynchronous wait : Disabled
+ * Write burst : Disabled
+ */
+
+ putreg32((FSMC_BCR_PSRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN), STM32_FSMC_BCR2);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32((FSMC_BTR_ADDSET(SRAM_ADDRESS_SETUP_TIME) | FSMC_BTR_ADDHLD(SRAM_ADDRESS_HOLD_TIME) |
+ FSMC_BTR_DATAST(SRAM_DATA_SETUP_TIME) | FSMC_BTR_BUSTRUN(SRAM_BUS_TURNAROUND_DURATION) |
+ FSMC_BTR_CLKDIV(SRAM_CLK_DIVISION) | FSMC_BTR_DATLAT(SRAM_DATA_LATENCY) |
+ FSMC_BTR_ACCMODA),
+ STM32_FSMC_BTR2);
+
+ /* Bank1 NOR/SRAM timing register for write configuration, if extended mode is used */
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR2); /* Extended mode not used */
+
+ /* Enable the bank */
+
+ putreg32((FSMC_BCR_MBKEN | FSMC_BCR_PSRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN), STM32_FSMC_BCR2);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_spi.c b/nuttx/configs/stm3220g-eval/src/up_spi.c
new file mode 100644
index 000000000..47ed8d230
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_spi.c
@@ -0,0 +1,161 @@
+/************************************************************************************
+ * configs/stm3220g_eval/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3220G-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void)
+{
+#warning "Missing logic"
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/stm3220g-eval/src/up_stmpe811.c b/nuttx/configs/stm3220g-eval/src/up_stmpe811.c
new file mode 100644
index 000000000..a15e69506
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_stmpe811.c
@@ -0,0 +1,353 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_touchscreen.c
+ * arch/arm/src/board/up_touchscreen.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/i2c.h>
+#include <nuttx/input/touchscreen.h>
+#include <nuttx/input/stmpe811.h>
+
+#include <arch/irq.h>
+
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifdef CONFIG_INPUT_STMPE811
+#ifndef CONFIG_INPUT
+# error "STMPE811 support requires CONFIG_INPUT"
+#endif
+
+#ifndef CONFIG_STM32_I2C1
+# error "STMPE811 support requires CONFIG_STM32_I2C1"
+#endif
+
+#ifndef CONFIG_STMPE811_I2C
+# error "Only the STMPE811 I2C interface is supported"
+#endif
+
+#ifdef CONFIG_STMPE811_SPI
+# error "Only the STMPE811 SPI interface is supported"
+#endif
+
+#ifndef CONFIG_STMPE811_FREQUENCY
+# define CONFIG_STMPE811_FREQUENCY 100000
+#endif
+
+#ifndef CONFIG_STMPE811_I2CDEV
+# define CONFIG_STMPE811_I2CDEV 1
+#endif
+
+#if CONFIG_STMPE811_I2CDEV != 1
+# error "CONFIG_STMPE811_I2CDEV must be one"
+#endif
+
+#ifndef CONFIG_STMPE811_DEVMINOR
+# define CONFIG_STMPE811_DEVMINOR 0
+#endif
+
+/* Board definitions ********************************************************/
+/* The STM3220G-EVAL has two STMPE811QTR I/O expanders on board both connected
+ * to the STM32 via I2C1. They share a common interrupt line: PI2.
+ *
+ * STMPE811 U24, I2C address 0x41 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- TouchScreen_Y- LCD Connector XL
+ * X- TouchScreen_X- LCD Connector XR
+ * Y+ TouchScreen_Y+ LCD Connector XD
+ * X+ TouchScreen_X+ LCD Connector XU
+ * IN3 EXP_IO9
+ * IN2 EXP_IO10
+ * IN1 EXP_IO11
+ * IN0 EXP_IO12
+ *
+ * STMPE811 U29, I2C address 0x44 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- EXP_IO1
+ * X- EXP_IO2
+ * Y+ EXP_IO3
+ * X+ EXP_IO4
+ * IN3 EXP_IO5
+ * IN2 EXP_IO6
+ * IN1 EXP_IO7
+ * IN0 EXP_IO8
+ */
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct stm32_stmpe811config_s
+{
+ /* Configuration structure as seen by the STMPE811 driver */
+
+ struct stmpe811_config_s config;
+
+ /* Additional private definitions only known to this driver */
+
+ STMPE811_HANDLE handle; /* The STMPE811 driver handle */
+ xcpt_t handler; /* The STMPE811 interrupt handler */
+};
+
+/****************************************************************************
+ * Static Function Prototypes
+ ****************************************************************************/
+
+/* IRQ/GPIO access callbacks. These operations all hidden behind callbacks
+ * to isolate the STMPE811 driver from differences in GPIO
+ * interrupt handling by varying boards and MCUs.* so that contact and loss-of-contact events can be detected.
+ *
+ * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt
+ * enable - Enable or disable the GPIO interrupt
+ * clear - Acknowledge/clear any pending GPIO interrupt
+ */
+
+static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr);
+static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable);
+static void stmpe811_clear(FAR struct stmpe811_config_s *state);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* A reference to a structure of this type must be passed to the STMPE811
+ * driver. This structure provides information about the configuration
+ * of the STMPE811 and provides some board-specific hooks.
+ *
+ * Memory for this structure is provided by the caller. It is not copied
+ * by the driver and is presumed to persist while the driver is active. The
+ * memory must be writable because, under certain circumstances, the driver
+ * may modify frequency or X plate resistance values.
+ */
+
+#ifndef CONFIG_STMPE811_TSC_DISABLE
+static struct stm32_stmpe811config_s g_stmpe811config =
+{
+ .config =
+ {
+#ifdef CONFIG_STMPE811_I2C
+ .address = STMPE811_ADDR1,
+#endif
+ .frequency = CONFIG_STMPE811_FREQUENCY,
+
+#ifdef CONFIG_STMPE811_MULTIPLE
+ .irq = STM32_IRQ_EXTI2,
+#endif
+ .ctrl1 = (ADC_CTRL1_SAMPLE_TIME_80 | ADC_CTRL1_MOD_12B),
+ .ctrl2 = ADC_CTRL2_ADC_FREQ_3p25,
+
+ .attach = stmpe811_attach,
+ .enable = stmpe811_enable,
+ .clear = stmpe811_clear,
+ },
+ .handler = NULL,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* IRQ/GPIO access callbacks. These operations all hidden behind
+ * callbacks to isolate the STMPE811 driver from differences in GPIO
+ * interrupt handling by varying boards and MCUs.
+ *
+ * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt
+ * enable - Enable or disable the GPIO interrupt
+ * clear - Acknowledge/clear any pending GPIO interrupt
+ */
+
+static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr)
+{
+ FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state;
+
+ ivdbg("Saving handler %p\n", isr);
+ DEBUGASSERT(priv);
+
+ /* Just save the handler. We will use it when EXTI interruptsare enabled */
+
+ priv->handler = isr;
+ return OK;
+}
+
+static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable)
+{
+ FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state;
+ irqstate_t flags;
+
+ /* Attach and enable, or detach and disable. Enabling and disabling GPIO
+ * interrupts is a multi-step process so the safest thing is to keep
+ * interrupts disabled during the reconfiguratino.
+ */
+
+ flags = irqsave();
+ if (enable)
+ {
+ /* Configure the EXTI interrupt using the SAVED handler */
+
+ (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, priv->handler);
+ }
+ else
+ {
+ /* Configure the EXTI interrupt with a NULL handler to disable it */
+
+ (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL);
+ }
+ irqrestore(flags);
+}
+
+static void stmpe811_clear(FAR struct stmpe811_config_s *state)
+{
+ /* Does nothing */
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: arch_tcinitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * configure the touchscreen device. This function will register the driver
+ * as /dev/inputN where N is the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int arch_tcinitialize(int minor)
+{
+#ifndef CONFIG_STMPE811_TSC_DISABLE
+ FAR struct i2c_dev_s *dev;
+ int ret;
+
+ idbg("minor %d\n", minor);
+ DEBUGASSERT(minor == 0);
+
+ /* Check if we are already initialized */
+
+ if (!g_stmpe811config.handle)
+ {
+ ivdbg("Initializing\n");
+
+ /* Configure the STMPE811 interrupt pin as an input */
+
+ (void)stm32_configgpio(GPIO_IO_EXPANDER);
+
+ /* Get an instance of the I2C interface */
+
+ dev = up_i2cinitialize(CONFIG_STMPE811_I2CDEV);
+ if (!dev)
+ {
+ idbg("Failed to initialize I2C bus %d\n", CONFIG_STMPE811_I2CDEV);
+ return -ENODEV;
+ }
+
+ /* Instantiate the STMPE811 driver */
+
+ g_stmpe811config.handle =
+ stmpe811_instantiate(dev, (FAR struct stmpe811_config_s *)&g_stmpe811config);
+ if (!g_stmpe811config.handle)
+ {
+ idbg("Failed to instantiate the STMPE811 driver\n");
+ return -ENODEV;
+ }
+
+ /* Initialize and register the I2C touchscreen device */
+
+ ret = stmpe811_register(g_stmpe811config.handle, CONFIG_STMPE811_DEVMINOR);
+ if (ret < 0)
+ {
+ idbg("Failed to register STMPE driver: %d\n", ret);
+ /* up_i2cuninitialize(dev); */
+ return -ENODEV;
+ }
+ }
+
+ return OK;
+#else
+ return -ENOSYS;
+#endif
+}
+
+/****************************************************************************
+ * Name: arch_tcuninitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * uninitialize the touchscreen device.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None.
+ *
+ ****************************************************************************/
+
+void arch_tcuninitialize(void)
+{
+ /* No support for un-initializing the touchscreen STMPE811 device yet */
+}
+
+#endif /* CONFIG_INPUT_STMPE811 */
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_usb.c b/nuttx/configs/stm3220g-eval/src/up_usb.c
new file mode 100644
index 000000000..64fdda6f8
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_usb.c
@@ -0,0 +1,292 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_usb.c
+ * arch/arm/src/board/up_usb.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sched.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbhost.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+#ifdef CONFIG_STM32_OTGFS
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
+# define HAVE_USB 1
+#else
+# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
+# undef HAVE_USB
+#endif
+
+#ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+#endif
+
+#ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: usbhost_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static int usbhost_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ uvdbg("Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ uvdbg("%s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related
+ * GPIO pins for the STM3220G-EVAL board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+#ifdef HAVE_USB
+ /* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
+
+ /* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
+
+ stm32_configgpio(GPIO_OTGFS_VBUS);
+ stm32_configgpio(GPIO_OTGFS_PWRON);
+ stm32_configgpio(GPIO_OTGFS_OVER);
+#endif
+}
+
+/***********************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality.
+ * This function will start a thread that will monitor for device
+ * connection/disconnection events.
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_usbhost_initialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ uvdbg("Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ udbg("Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ uvdbg("Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ uvdbg("Start usbhost_waiter\n");
+
+ pid = TASK_CREATE("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)usbhost_waiter, (const char **)NULL);
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+
+ return -ENODEV;
+}
+#endif
+
+/***********************************************************************************
+ * Name: stm32_usbhost_vbusdrive
+ *
+ * Description:
+ * Enable/disable driving of VBUS 5V output. This function must be provided be
+ * each platform that implements the STM32 OTG FS host interface
+ *
+ * "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
+ * or, if 5 V are available on the application board, a basic power switch, must
+ * be added externally to drive the 5 V VBUS line. The external charge pump can
+ * be driven by any GPIO output. When the application decides to power on VBUS
+ * using the chosen GPIO, it must also set the port power bit in the host port
+ * control and status register (PPWR bit in OTG_FS_HPRT).
+ *
+ * "The application uses this field to control power to this port, and the core
+ * clears this bit on an overcurrent condition."
+ *
+ * Input Parameters:
+ * iface - For future growth to handle multiple USB host interface. Should be zero.
+ * enable - true: enable VBUS power; false: disable VBUS power
+ *
+ * Returned Value:
+ * None
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+void stm32_usbhost_vbusdrive(int iface, bool enable)
+{
+ DEBUGASSERT(iface == 0);
+
+ if (enable)
+ {
+ /* Enable the Power Switch by driving the enable pin low */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, false);
+ }
+ else
+ {
+ /* Disable the Power Switch by driving the enable pin high */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, true);
+ }
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_setup_overcurrent
+ *
+ * Description:
+ * Setup to receive an interrupt-level callback if an overcurrent condition is
+ * detected.
+ *
+ * Input paramter:
+ * handler - New overcurrent interrupt handler
+ *
+ * Returned value:
+ * Old overcurrent interrupt handler
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+xcpt_t stm32_setup_overcurrent(xcpt_t handler)
+{
+ return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBDEV
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+#endif
+
+#endif /* CONFIG_STM32_OTGFS */
+
diff --git a/nuttx/configs/stm3220g-eval/src/up_userleds.c b/nuttx/configs/stm3220g-eval/src/up_userleds.c
new file mode 100644
index 000000000..6dc3db135
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_userleds.c
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * configs/stm3220g_eval/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm3220g-internal.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* This array maps an LED number to GPIO pin configuration */
+
+static uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ledinit
+ ****************************************************************************/
+
+void stm32_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: stm32_setled
+ ****************************************************************************/
+
+void stm32_setled(int led, bool ledon)
+{
+ if ((unsigned)led < BOARD_NLEDS)
+ {
+ stm32_gpiowrite(g_ledcfg[led], ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: stm32_setleds
+ ****************************************************************************/
+
+void stm32_setleds(uint8_t ledset)
+{
+ stm32_gpiowrite(BOARD_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED2, (ledset & BOARD_LED2_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED3, (ledset & BOARD_LED3_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED4, (ledset & BOARD_LED4_BIT) == 0);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3220g-eval/src/up_watchdog.c b/nuttx/configs/stm3220g-eval/src/up_watchdog.c
new file mode 100644
index 000000000..d8b635982
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/stm3220g-eval/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/stm3220g-eval/telnetd/Make.defs b/nuttx/configs/stm3220g-eval/telnetd/Make.defs
new file mode 100644
index 000000000..a57ff5509
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/telnetd/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3220g-eval/telnetd/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/telnetd/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/telnetd/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3220g-eval/telnetd/appconfig b/nuttx/configs/stm3220g-eval/telnetd/appconfig
new file mode 100644
index 000000000..70cdf7771
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/telnetd/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/stm3220g-eval/telnetd/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/telnetd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/telnetd
+
diff --git a/nuttx/configs/stm3220g-eval/telnetd/defconfig b/nuttx/configs/stm3220g-eval/telnetd/defconfig
new file mode 100644
index 000000000..024b4d1a5
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/telnetd/defconfig
@@ -0,0 +1,644 @@
+############################################################################
+# configs/stm3220g-eval/telnetd/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F207IG=y
+CONFIG_ARCH_BOARD="stm3220g-eval"
+CONFIG_ARCH_BOARD_STM3220G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=10926
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F20xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F20xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F20xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="shell_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=128
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=y
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/telnetd
+#
+CONFIG_EXAMPLES_TELNETD_DAEMONPRIO=128
+CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE=2048
+CONFIG_EXAMPLES_TELNETD_CLIENTPRIO=128
+CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE=2048
+CONFIG_EXAMPLE_TELNETD_NOMAC=y
+CONFIG_EXAMPLE_TELNETD_IPADDR=0x0a000002
+CONFIG_EXAMPLE_TELNETD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_TELNETD_NETMASK=0xffffff00
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+# Application configuration
+
+CONFIG_APPS_DIR="../apps"
diff --git a/nuttx/configs/stm3220g-eval/telnetd/ld.script b/nuttx/configs/stm3220g-eval/telnetd/ld.script
new file mode 100644
index 000000000..f4ecb084a
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/telnetd/ld.script
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * configs/stm3220g-eval/telnetd/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F207IGH6U has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 128Kb of SRAM. SRAM is split up into two blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3220g-eval/telnetd/setenv.sh b/nuttx/configs/stm3220g-eval/telnetd/setenv.sh
new file mode 100755
index 000000000..68903d175
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/telnetd/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3220g-eval/telnetd/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3220g-eval/tools/olimex-arm-usb-ocd.cfg b/nuttx/configs/stm3220g-eval/tools/olimex-arm-usb-ocd.cfg
new file mode 100644
index 000000000..9752dd418
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/tools/olimex-arm-usb-ocd.cfg
@@ -0,0 +1,13 @@
+#
+# Olimex ARM-USB-OCD
+#
+# http://www.olimex.com/dev/arm-usb-ocd.html
+#
+
+interface ft2232
+ft2232_device_desc "Olimex OpenOCD JTAG"
+ft2232_layout olimex-jtag
+ft2232_vid_pid 0x15ba 0x0003
+
+#jtag_khz 600
+
diff --git a/nuttx/configs/stm3220g-eval/tools/oocd.sh b/nuttx/configs/stm3220g-eval/tools/oocd.sh
new file mode 100644
index 000000000..d2cd6ae27
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/tools/oocd.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+# Get command line parameters
+
+USAGE="USAGE: $0 [-dh] <TOPDIR>"
+ADVICE="Try '$0 -h' for more information"
+
+
+while [ ! -z "$1" ]; do
+ case $1 in
+ -d )
+ set -x
+ ;;
+ -h )
+ echo "$0 is a tool for generation of proper version files for the NuttX build"
+ echo ""
+ echo $USAGE
+ echo ""
+ echo "Where:"
+ echo " -d"
+ echo " Enable script debug"
+ echo " -h"
+ echo " show this help message and exit"
+ echo " Use the OpenOCD 0.4.0"
+ echo " <TOPDIR>"
+ echo " The full path to the top-level NuttX directory"
+ exit 0
+ ;;
+ * )
+ break;
+ ;;
+ esac
+ shift
+done
+
+TOPDIR=$1
+if [ -z "${TOPDIR}" ]; then
+ echo "Missing argument"
+ echo $USAGE
+ echo $ADVICE
+ exit 1
+fi
+
+# This script *probably* only works with the following versions of OpenOCD:
+
+# Local search directory and configurations
+
+OPENOCD_SEARCHDIR="${TOPDIR}/configs/stm3210e-eval/tools"
+OPENOCD_WSEARCHDIR="`cygpath -w ${OPENOCD_SEARCHDIR}`"
+
+OPENOCD_PATH="/cygdrive/c/Program Files (x86)/OpenOCD/0.4.0/bin"
+OPENOCD_EXE=openocd.exe
+OPENOCD_INTERFACE="olimex-arm-usb-ocd.cfg"
+
+
+OPENOCD_TARGET="stm32.cfg"
+OPENOCD_ARGS="-s ${OPENOCD_WSEARCHDIR} -f ${OPENOCD_INTERFACE} -f ${OPENOCD_TARGET}"
+
+echo "Trying OpenOCD 0.4.0 path: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+
+# Verify that everything is what it claims it is and is located where it claims it is.
+
+if [ ! -x "${OPENOCD_PATH}/${OPENOCD_EXE}" ]; then
+ echo "OpenOCD executable does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
+ exit 1
+fi
+if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}" ]; then
+ echo "OpenOCD target config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_TARGET}"
+ exit 1
+fi
+if [ ! -f "${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}" ]; then
+ echo "OpenOCD interface config file does not exist: ${OPENOCD_SEARCHDIR}/${OPENOCD_INTERFACE}"
+ exit 1
+fi
+
+# Enable debug if so requested
+
+if [ "X$2" = "X-d" ]; then
+ OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
+ set -x
+fi
+
+# Okay... do it!
+
+echo "Starting OpenOCD"
+"${OPENOCD_PATH}/${OPENOCD_EXE}" ${OPENOCD_ARGS} &
+echo "OpenOCD daemon started"
+ps -ef | grep openocd
+echo "In GDB: target remote localhost:3333"
+
diff --git a/nuttx/configs/stm3220g-eval/tools/stm32.cfg b/nuttx/configs/stm3220g-eval/tools/stm32.cfg
new file mode 100644
index 000000000..463a85cfd
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/tools/stm32.cfg
@@ -0,0 +1,69 @@
+# script for stm32
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME stm32
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+# Work-area is a space in RAM used for flash programming
+# By default use 16kB
+if { [info exists WORKAREASIZE] } {
+ set _WORKAREASIZE $WORKAREASIZE
+} else {
+ set _WORKAREASIZE 0x4000
+}
+
+# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
+jtag_khz 1000
+
+jtag_nsrst_delay 100
+jtag_ntrst_delay 100
+
+#jtag scan chain
+if { [info exists CPUTAPID ] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ # See STM Document RM0008
+ # Section 26.6.3
+ set _CPUTAPID 0x3ba00477
+}
+jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+
+if { [info exists BSTAPID ] } {
+ # FIXME this never gets used to override defaults...
+ set _BSTAPID $BSTAPID
+} else {
+ # See STM Document RM0008
+ # Section 29.6.2
+ # Low density devices, Rev A
+ set _BSTAPID1 0x06412041
+ # Medium density devices, Rev A
+ set _BSTAPID2 0x06410041
+ # Medium density devices, Rev B and Rev Z
+ set _BSTAPID3 0x16410041
+ # High density devices, Rev A
+ set _BSTAPID4 0x06414041
+ # Connectivity line devices, Rev A and Rev Z
+ set _BSTAPID5 0x06418041
+}
+jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
+ -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
+ -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
+
+$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
+
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME stm32x 0 0 0 0 $_TARGETNAME
+
+# For more information about the configuration files, take a look at:
+# openocd.texi
diff --git a/nuttx/configs/stm3220g-eval/tools/usb-driver.txt b/nuttx/configs/stm3220g-eval/tools/usb-driver.txt
new file mode 100644
index 000000000..83d7598a5
--- /dev/null
+++ b/nuttx/configs/stm3220g-eval/tools/usb-driver.txt
@@ -0,0 +1,25 @@
+https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf
+
+Repair procedure for ARM-USB-OCD drivers
+
+1. Uninstalling ARM-USB-OCD drivers
+-------------------------------------
+1.1. Connect your programmer/debugger to your computer, open Device Manager
+ and uninstall the drivers for ARM-USB-OCD.
+1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager,
+ disconnect the programmer from your computer.
+1.3. Now you should download FTClean.exe from here:
+ http://www.ftdichip.com/Support/Utilities/FTClean.zip.
+1.4. After download is complete extract the "*.zip" file, open folder FTClean,
+ and run FTClean.exe
+1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba
+ and "PID (Hex)" with 0004.
+1.6. Press "Clean System" button. Make sure that all FTDI devices are
+ disconnected. (My require administrator privileges).
+
+2. Re-installing the ARM-USB-OCD driver
+---------------------------------------
+2.1 Connect the programmer/debugger to the computer.
+2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER
+ directory and install. (A different driver is required for OpenOCD
+ 0.4.0. That driver is available from the olimex.com web site).
diff --git a/nuttx/configs/stm3240g-eval/Kconfig b/nuttx/configs/stm3240g-eval/Kconfig
new file mode 100644
index 000000000..ae73d21e4
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/Kconfig
@@ -0,0 +1,42 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_STM3240G_EVAL
+
+config STM3240G_LCD
+ bool "Select support for the STM3210E-EVAL LCD"
+ default y
+ depends on LCD && STM32_FSMC
+ ---help---
+ Enable support for the LCD on the STM3240G-EVAL board. See additional,
+ LCD-common settings in the drivers/lcd Kconfig file.
+
+config LCD_RDSHIFT
+ int "LCD data shift"
+ default 5
+ depends on STM3240G_LCD
+ ---help---
+ When reading 16-bit gram data, there appears to be a shift in the returned
+ data. This value fixes the offset. Default 5.
+
+config CONFIG_STM32_ILI9320_DISABLE
+ bool "Disable LCD_ILI9320 (and LCD_ILI9321) support"
+ default n
+ depends on STM3240G_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option.
+
+config CONFIG_STM32_ILI9325_DISABLE
+ bool "Disable LCD_ILI9325 support"
+ default n
+ depends on STM3240G_LCD
+ ---help---
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using this option
+
+endif
diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt
new file mode 100644
index 000000000..9193b9450
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/README.txt
@@ -0,0 +1,1330 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the
+STMicro STM32140G-EVAL development board.
+
+Contents
+========
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - STM3240G-EVAL-specific Configuration Options
+ - LEDs
+ - Ethernet
+ - PWM
+ - CAN
+ - FPU
+ - FSMC SRAM
+ - I/O Expanders
+ - STM3240G-EVAL-specific Configuration Options
+ - Configurations
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Raisonance R-Link emulatator and some RIDE7 development tools
+ were used and those tools works only under Windows.
+
+GNU Toolchain Options
+=====================
+
+ Toolchain Configurations
+ ------------------------
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The Atollic Toolchain,
+ 3. The devkitARM GNU toolchain,
+ 4. Raisonance GNU toolchain, or
+ 5. The NuttX buildroot Toolchain (see below).
+
+ Most testing has been conducted using the CodeSourcery toolchain for Windows and
+ that is the default toolchain in most configurations (FPU-related testing has
+ been performed with the Atolloc toolchain for windows. To use the Atollic,
+ devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_ATOLLIC_LITE=y : The free, "Lite" version of Atollic toolchain under Windows
+ CONFIG_STM32_ATOLLIC_PRO=y : The paid, "Pro" version of Atollic toolchain under Windows
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you change the default toolchain, then you may also have to modify the PATH in
+ the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), Atollic, devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcery (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ The CodeSourcery Toolchain (2009q1)
+ -----------------------------------
+ The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ The Atollic "Pro" and "Lite" Toolchain
+ --------------------------------------
+ One problem that I had with the Atollic toolchains is that the provide a gcc.exe
+ and g++.exe in the same bin/ file as their ARM binaries. If the Atollic bin/ path
+ appears in your PATH variable before /usr/bin, then you will get the wrong gcc
+ when you try to build host executables. This will cause to strange, uninterpretable
+ errors build some host binaries in tools/ when you first make.
+
+ Also, the Atollic toolchains are the only toolchains that have built-in support for
+ the FPU in these configurations. If you plan to use the Cortex-M4 FPU, you will
+ need to use the Atollic toolchain for now. See the FPU section below for more
+ information.
+
+ The Atollic "Lite" Toolchain
+ ----------------------------
+ The free, "Lite" version of the Atollic toolchain does not support C++ nor
+ does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
+ toolchain, you will have to set:
+
+ CONFIG_HAVE_CXX=n
+
+ In order to compile successfully. Otherwise, you will get errors like:
+
+ "C++ Compiler only available in TrueSTUDIO Professional"
+
+ The make may then fail in some of the post link processing because of some of
+ the other missing tools. The Make.defs file replaces the ar and nm with
+ the default system x86 tool versions and these seem to work okay. Disable all
+ of the following to avoid using objcopy:
+
+ CONFIG_RRLOAD_BINARY=n
+ CONFIG_INTELHEX_BINARY=n
+ CONFIG_MOTOROLA_SREC=n
+ CONFIG_RAW_BINARY=n
+
+ devkitARM
+ ---------
+ The devkitARM toolchain includes a version of MSYS make. Make sure that the
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh stm3240g-eval/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+Ethernet
+========
+
+The Ethernet driver is configured to use the MII interface:
+
+ Board Jumper Settings:
+
+ Jumper Description
+ JP8 To enable MII, JP8 should not be fitted.
+ JP6 2-3: Enable MII interface mode
+ JP5 2-3: Provide 25 MHz clock for MII or 50 MHz clock for RMII by MCO at PA8
+ SB1 Not used with MII
+
+LEDs
+====
+
+The STM3240G-EVAL board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
+board.. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
+defined. In that case, the usage by the board port is defined in
+include/board.h and src/up_leds.c. The LEDs are used to encode OS-related\
+events as follows:
+
+ SYMBOL Meaning LED1* LED2 LED3 LED4
+ ------------------- ----------------------- ------- ------- ------- ------
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
+ is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+*** LED2 may also flicker normally if signals are processed.
+
+PWM
+===
+
+The STM3240G-Eval has no real on-board PWM devices, but the board can be
+configured to output a pulse train using timer output pins. The following
+pins have been use to generate PWM output (see board.h for some other
+candidates):
+
+TIM4 CH2. Pin PD13 is used by the FSMC (FSMC_A18) and is also connected
+to the Motor Control Connector (CN5) just for this purpose. If FSMC is
+not enabled, then FSMC_A18 will not be used (and will be tri-stated from
+the LCD).
+
+ CONFIGURATION:
+
+ CONFIG_STM32_TIM4=y
+ CONFIG_PWM=n
+ CONFIG_PWM_PULSECOUNT=n
+ CONFIG_STM32_TIM4_PWM=y
+ CONFIG_STM32_TIM4_CHANNEL=2
+
+ ACCESS:
+
+ Daughterboard Extension Connector, CN3, pin 32
+ Ground is available on CN3, pin1
+
+ NOTE: TIM4 hardware will not support pulse counting.
+
+TIM8 CH4: Pin PC9 is used by the microSD card (MicroSDCard_D1) and I2S
+(I2S_CKIN) but can be completely disconnected from both by opening JP16.
+
+ CONFIGURATION:
+
+ CONFIG_STM32_TIM8=y
+ CONFIG_PWM=n
+ CONFIG_PWM_PULSECOUNT=y
+ CONFIG_STM32_TIM8_PWM=y
+ CONFIG_STM32_TIM8_CHANNEL=4
+
+ ACCESS:
+
+ Daughterboard Extension Connector, CN3, pin 17
+ Ground is available on CN3, pin1
+
+CAN
+===
+
+Connector 10 (CN10) is DB-9 male connector that can be used with CAN1 or CAN2.
+
+ JP10 connects CAN1_RX or CAN2_RX to the CAN transceiver
+ JP3 connects CAN1_TX or CAN2_TX to the CAN transceiver
+
+CAN signals are then available on CN10 pins:
+
+ CN10 Pin 7 = CANH
+ CN10 Pin 2 = CANL
+
+Mapping to STM32 GPIO pins:
+
+ PD0 = FSMC_D2 & CAN1_RX
+ PD1 = FSMC_D3 & CAN1_TX
+ PB13 = ULPI_D6 & CAN2_TX
+ PB5 = ULPI_D7 & CAN2_RX
+
+Configuration Options:
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+
+ CONFIG_STM32_CAN1 - Enable support for CAN1
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_STM32_CAN2 - Enable support for CAN2
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+FPU
+===
+
+FPU Configuration Options
+-------------------------
+
+There are two version of the FPU support built into the STM32 port.
+
+1. Lazy Floating Point Register Save.
+
+ This is an untested implementation that saves and restores FPU registers
+ only on context switches. This means: (1) floating point registers are
+ not stored on each context switch and, hence, possibly better interrupt
+ performance. But, (2) since floating point registers are not saved,
+ you cannot use floating point operations within interrupt handlers.
+
+ This logic can be enabled by simply adding the following to your .config
+ file:
+
+ CONFIG_ARCH_FPU=y
+
+2. Non-Lazy Floating Point Register Save
+
+ Mike Smith has contributed an extensive re-write of the ARMv7-M exception
+ handling logic. This includes verified support for the FPU. These changes
+ have not yet been incorporated into the mainline and are still considered
+ experimental. These FPU logic can be enabled with:
+
+ CONFIG_ARCH_FPU=y
+ CONFIG_ARMV7M_CMNVECTOR=y
+
+ You will probably also changes to the scripts/ld.script in if this option is selected.
+ This should work:
+
+ -ENTRY(_stext)
+ +ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
+ +EXTERN(_vectors) /* Force the vectors to be included in the output */
+
+CFLAGS
+------
+
+Only the Atollic toolchain has built-in support for the Cortex-M4 FPU. You will see
+the following lines in each Make.defs file:
+
+ ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ ...
+ ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+ else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ endif
+ endif
+
+If you are using a toolchain other than the Atollic toolchain, then to use the FPU
+you will also have to modify the CFLAGS to enable compiler support for the ARMv7-M
+FPU. As of this writing, there are not many GCC toolchains that will support the
+ARMv7-M FPU.
+
+As a minimum you will need to add CFLAG options to (1) enable hardware floating point
+code generation, and to (2) select the FPU implementation. You might try the same
+options as used with the Atollic toolchain in the Make.defs file:
+
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+
+Configuration Changes
+---------------------
+
+Below are all of the configuration changes that I had to make to configs/stm3240g-eval/nsh2
+in order to successfully build NuttX using the Atollic toolchain WITH FPU support:
+
+ -CONFIG_ARCH_FPU=n : Enable FPU support
+ +CONFIG_ARCH_FPU=y
+
+ -CONFIG_STM32_CODESOURCERYW=y : Disable the CodeSourcery toolchain
+ +CONFIG_STM32_CODESOURCERYW=n
+
+ -CONFIG_STM32_ATOLLIC_LITE=n : Enable *one* the Atollic toolchains
+ CONFIG_STM32_ATOLLIC_PRO=n
+ -CONFIG_STM32_ATOLLIC_LITE=y : The "Lite" version, OR
+ CONFIG_STM32_ATOLLIC_PRO=y : The "Pro" version (not both)
+
+ -CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
+ +CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_HAVE_CXX=y : Suppress generation of C++ code
+ +CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
+
+See the section above on Toolchains, NOTE 2, for explanations for some of
+the configuration settings. Some of the usual settings are just not supported
+by the "Lite" version of the Atollic toolchain.
+
+FSMC SRAM
+=========
+
+On-board SRAM
+-------------
+
+A 16 Mbit SRAM is connected to the STM32F407IGH6 FSMC bus which shares the same
+I/Os with the CAN1 bus. Jumper settings:
+
+ JP1: Connect PE4 to SRAM as A20
+ JP2: onnect PE3 to SRAM as A19
+
+JP3 and JP10 must not be fitted for SRAM and LCD application. JP3 and JP10
+select CAN1 or CAN2 if fitted; neither if not fitted.
+
+The on-board SRAM can be configured by setting
+
+ CONFIG_STM32_FSMC=y
+ CONFIG_STM32_FSMC_SRAM=y
+ CONFIG_HEAP2_BASE=0x64000000
+ CONFIG_HEAP2_SIZE=2097152
+ CONFIG_MM_REGIONS=2 (or =3, see below)
+
+Configuration Options
+---------------------
+Internal SRAM is available in all members of the STM32 family. The F4 family
+also contains internal CCM SRAM. This SRAM is different because it cannot
+be used for DMA. So if DMA needed, then the following should be defined
+to exclude CCM SRAM from the heap:
+
+ CONFIG_STM32_CCMEXCLUDE : Exclude CCM SRAM from the HEAP
+
+In addition to internal SRAM, SRAM may also be available through the FSMC.
+In order to use FSMC SRAM, the following additional things need to be
+present in the NuttX configuration file:
+
+ CONFIG_STM32_FSMC=y : Enables the FSMC
+ CONFIG_STM32_FSMC_SRAM=y : Indicates that SRAM is available via the
+ FSMC (as opposed to an LCD or FLASH).
+ CONFIG_HEAP2_BASE : The base address of the SRAM in the FSMC
+ address space
+ CONFIG_HEAP2_SIZE : The size of the SRAM in the FSMC
+ address space
+ CONFIG_MM_REGIONS : Must be set to a large enough value to
+ include the FSMC SRAM
+
+SRAM Configurations
+-------------------
+There are 4 possible SRAM configurations:
+
+ Configuration 1. System SRAM (only)
+ CONFIG_MM_REGIONS == 1
+ CONFIG_STM32_FSMC_SRAM NOT defined
+ CONFIG_STM32_CCMEXCLUDE defined
+ Configuration 2. System SRAM and CCM SRAM
+ CONFIG_MM_REGIONS == 2
+ CONFIG_STM32_FSMC_SRAM NOT defined
+ CONFIG_STM32_CCMEXCLUDE NOT defined
+ Configuration 3. System SRAM and FSMC SRAM
+ CONFIG_MM_REGIONS == 2
+ CONFIG_STM32_FSMC_SRAM defined
+ CONFIG_STM32_CCMEXCLUDE defined
+ Configuration 4. System SRAM, CCM SRAM, and FSMC SRAM
+ CONFIG_MM_REGIONS == 3
+ CONFIG_STM32_FSMC_SRAM defined
+ CONFIG_STM32_CCMEXCLUDE NOT defined
+I/O Expanders
+=============
+
+The STM3240G-EVAL has two STMPE811QTR I/O expanders on board both connected to
+the STM32 via I2C1. They share a common interrupt line: PI2.
+
+STMPE811 U24, I2C address 0x41 (7-bit)
+------ ---- ---------------- --------------------------------------------
+STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+------ ---- ---------------- --------------------------------------------
+ Y- TouchScreen_Y- LCD Connector XL
+ X- TouchScreen_X- LCD Connector XR
+ Y+ TouchScreen_Y+ LCD Connector XD
+ X+ TouchScreen_X+ LCD Connector XU
+ IN3 EXP_IO9
+ IN2 EXP_IO10
+ IN1 EXP_IO11
+ IN0 EXP_IO12
+
+STMPE811 U29, I2C address 0x44 (7-bit)
+------ ---- ---------------- --------------------------------------------
+STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+------ ---- ---------------- --------------------------------------------
+ Y- EXP_IO1
+ X- EXP_IO2
+ Y+ EXP_IO3
+ X+ EXP_IO4
+ IN3 EXP_IO5
+ IN2 EXP_IO6
+ IN1 EXP_IO7
+ IN0 EXP_IO8
+
+STM3240G-EVAL-specific Configuration Options
+============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM4=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F407IG=y
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=stm3240g_eval (for the STM3240G-EVAL development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_STM32_CCMEXCLUDE - Exclude CCM SRAM from the HEAP
+
+ In addition to internal SRAM, SRAM may also be available through the FSMC.
+ In order to use FSMC SRAM, the following additional things need to be
+ present in the NuttX configuration file:
+
+ CONFIG_STM32_FSMC_SRAM - Indicates that SRAM is available via the
+ FSMC (as opposed to an LCD or FLASH).
+
+ CONFIG_HEAP2_BASE - The base address of the SRAM in the FSMC address space (hex)
+
+ CONFIG_HEAP2_END - The size of the SRAM in the FSMC address space (decimal)
+
+ CONFIG_ARCH_IRQPRIO - The STM3240xxx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_FPU - The STM3240xxx supports a floating point unit (FPU)
+
+ CONFIG_ARCH_FPU=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ AHB1
+ ----
+ CONFIG_STM32_CRC
+ CONFIG_STM32_BKPSRAM
+ CONFIG_STM32_CCMDATARAM
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_ETHMAC
+ CONFIG_STM32_OTGHS
+
+ AHB2
+ ----
+ CONFIG_STM32_DCMI
+ CONFIG_STM32_CRYP
+ CONFIG_STM32_HASH
+ CONFIG_STM32_RNG
+ CONFIG_STM32_OTGFS
+
+ AHB3
+ ----
+ CONFIG_STM32_FSMC
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_TIM12
+ CONFIG_STM32_TIM13
+ CONFIG_STM32_TIM14
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI3
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_I2C3
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_CAN2
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_PWR -- Required for RTC
+
+ APB2
+ ----
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_USART6
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_ADC3
+ CONFIG_STM32_SDIO
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_SYSCFG
+ CONFIG_STM32_TIM9
+ CONFIG_STM32_TIM10
+ CONFIG_STM32_TIM11
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,14
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,14
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,14, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,14
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,14, m=1,..,2
+
+ For each timer that is enabled for PWM usage, we need the following additional
+ configuration settings:
+
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+
+ NOTE: The STM32 timers are each capable of generating different signals on
+ each of the four channels with different duty cycles. That capability is
+ not supported by this driver: Only one output channel per timer.
+
+ JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+
+ STM3240xxx specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+
+ CONFIG_STM32_PHYADDR - The 5-bit address of the PHY on the board
+ CONFIG_STM32_MII - Support Ethernet MII interface
+ CONFIG_STM32_MII_MCO1 - Use MCO1 to clock the MII interface
+ CONFIG_STM32_MII_MCO2 - Use MCO2 to clock the MII interface
+ CONFIG_STM32_RMII - Support Ethernet RMII interface
+ CONFIG_STM32_AUTONEG - Use PHY autonegotion to determine speed and mode
+ CONFIG_STM32_ETHFD - If CONFIG_STM32_AUTONEG is not defined, then this
+ may be defined to select full duplex mode. Default: half-duplex
+ CONFIG_STM32_ETH100MBPS - If CONFIG_STM32_AUTONEG is not defined, then this
+ may be defined to select 100 MBps speed. Default: 10 Mbps
+ CONFIG_STM32_PHYSR - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. The PHY status register address may diff from PHY to PHY. This
+ configuration sets the address of the PHY status register.
+ CONFIG_STM32_PHYSR_SPEED - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides bit mask indicating 10 or 100MBps speed.
+ CONFIG_STM32_PHYSR_100MBPS - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides the value of the speed bit(s) indicating 100MBps speed.
+ CONFIG_STM32_PHYSR_MODE - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provide bit mask indicating full or half duplex modes.
+ CONFIG_STM32_PHYSR_FULLDUPLEX - This must be provided if CONFIG_STM32_AUTONEG is
+ defined. This provides the value of the mode bits indicating full duplex mode.
+ CONFIG_STM32_ETH_PTP - Precision Time Protocol (PTP). Not supported
+ but some hooks are indicated with this condition.
+
+ STM3240G-EVAL CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ STM3240G-EVAL LCD Hardware Configuration
+
+ The LCD driver supports the following LCDs on the STM324xG_EVAL board:
+
+ AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) OR
+ AM-240320D5TOQW01H (LCD_ILI9325)
+
+ Configuration options.
+
+ CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
+ support. Default is this 320x240 "landscape" orientation
+ For the STM3240G-EVAL board, the edge opposite from the row of buttons
+ is used as the top of the display in this orientation.
+ CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
+ landscape" support. Default is this 320x240 "landscape"
+ orientation
+ For the STM3240G-EVAL board, the edge next to the row of buttons
+ is used as the top of the display in this orientation.
+ CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
+ orientation support. In this orientation, the STM3210E-EVAL's
+ LCD ribbon cable is at the bottom of the display. Default is
+ 320x240 "landscape" orientation.
+ In this orientation, the top of the display is to the left
+ of the buttons (if the board is held so that the buttons are at the
+ botton of the board).
+ CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
+ portrait" orientation support. In this orientation, the
+ STM3210E-EVAL's LCD ribbon cable is at the top of the display.
+ Default is 320x240 "landscape" orientation.
+ In this orientation, the top of the display is to the right
+ of the buttons (if the board is held so that the buttons are at the
+ botton of the board).
+ CONFIG_LCD_RDSHIFT - When reading 16-bit gram data, there appears
+ to be a shift in the returned data. This value fixes the offset.
+ Default 5.
+
+ The LCD driver dynamically selects the LCD based on the reported LCD
+ ID value. However, code size can be reduced by suppressing support for
+ individual LCDs using:
+
+ CONFIG_STM32_ILI9320_DISABLE (includes ILI9321)
+ CONFIG_STM32_ILI9325_DISABLE
+
+ STM32 USB OTG FS Host Driver Support
+
+ Pre-requisites
+
+ CONFIG_USBHOST - Enable USB host support
+ CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG - Needed
+ CONFIG_SCHED_WORKQUEUE - Worker thread support is required
+
+ Options:
+
+ CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
+ Default 128 (512 bytes)
+ CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
+ in 32-bit words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
+ words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_DESCSIZE - Maximum size of a descriptor. Default: 128
+ CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
+ want to do that?
+ CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
+ debug. Depends on CONFIG_DEBUG.
+ CONFIG_STM32_USBHOST_PKTDUMP - Dump all incoming and outgoing USB
+ packets. Depends on CONFIG_DEBUG.
+
+Configurations
+==============
+
+Each STM3240G-EVAL configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh stm3240g-eval/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ dhcpd:
+ -----
+
+ This builds the DCHP server using the apps/examples/dhcpd application
+ (for execution from FLASH.) See apps/examples/README.txt for information
+ about the dhcpd example. The server address is 10.0.0.1 and it serves
+ IP addresses in the range 10.0.0.2 through 10.0.0.17 (all of which, of
+ course, are configurable).
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ discover:
+ --------
+ This configuration exercises netutils/discover utility using
+ apps/exmaples/discover. This example initializes and starts the UDP
+ discover daemon. This daemon is useful for discovering devices in
+ local networks, especially with DHCP configured devices. It listens
+ for UDP broadcasts which also can include a device class so that
+ groups of devices can be discovered. It is also possible to address all
+ classes with a kind of broadcast discover.
+
+ Configuration settings that you may need to change for your
+ environment:
+
+ CONFIG_STM32_CODESOURCERYL=y - CodeSourcery for Linux
+ CONFIG_EXAMPLE_DISCOVER_DHCPC=y - DHCP Client
+ CONFIG_EXAMPLE_DISCOVER_IPADDR - (not defined)
+ CONFIG_EXAMPLE_DISCOVER_DRIPADDR - Router IP address
+
+ NOTE: This configuration uses to the mconf configuration tool to control
+ the configuration. See the section entitled "NuttX Configuration Tool"
+ in the top-level README.txt file.
+
+ nettest:
+ -------
+
+ This configuration directory may be used to verify networking performance
+ using the STM32's Ethernet controller. It uses apps/examples/nettest to excercise the
+ TCP/IP network.
+
+ CONFIG_EXAMPLE_NETTEST_SERVER=n : Target is configured as the client
+ CONFIG_EXAMPLE_NETTEST_PERFORMANCE=y : Only network performance is verified.
+ CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2) : Target side is IP: 10.0.0.2
+ CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1) : Host side is IP: 10.0.0.1
+ CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1) : Server address used by which ever is client.
+
+ nsh:
+ ---
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_NSH_DHCPC=n : DHCP is disabled
+ CONFIG_NSH_IPADDR=(10<<24|0<<16|0<<8|2) : Target IP address 10.0.0.2
+ CONFIG_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) : Host IP address 10.0.0.1
+
+ NOTES:
+ 1. This example assumes that a network is connected. During its
+ initialization, it will try to negotiate the link speed. If you have
+ no network connected when you reset the board, there will be a long
+ delay (maybe 30 seconds?) before anything happens. That is the timeout
+ before the networking finally gives up and decides that no network is
+ available.
+
+ 2. This example supports the ADC test (apps/examples/adc) but this must
+ be manually enabled by selecting:
+
+ CONFIG_ADC=y : Enable the generic ADC infrastructure
+ CONFIG_STM32_ADC3=y : Enable ADC3
+ CONFIG_STM32_TIM1=y : Enable Timer 1
+ CONFIG_STM32_TIM1_ADC=y : Indicate that timer 1 will be used to trigger an ADC
+ CONFIG_STM32_TIM1_ADC3=y : Assign timer 1 to drive ADC3 sampling
+ CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100 : Select a sampling frequency
+
+ See also apps/examples/README.txt
+
+ General debug for analog devices (ADC/DAC):
+
+ CONFIG_DEBUG_ANALOG
+
+ 3. This example supports the PWM test (apps/examples/pwm) but this must
+ be manually enabled by selecting eeither
+
+ CONFIG_PWM=y : Enable the generic PWM infrastructure
+ CONFIG_PWM_PULSECOUNT=n : Disable to support for TIM1/8 pulse counts
+ CONFIG_STM32_TIM4=y : Enable TIM4
+ CONFIG_STM32_TIM4_PWM=y : Use TIM4 to generate PWM output
+ CONFIG_STM32_TIM4_CHANNEL=2 : Select output on TIM4, channel 2
+
+ If CONFIG_STM32_FSMC is disabled, output will appear on CN3, pin 32.
+ Ground is available on CN3, pin1.
+
+ Or..
+
+ CONFIG_PWM=y : Enable the generic PWM infrastructure
+ CONFIG_PWM_PULSECOUNT=y : Enable to support for TIM1/8 pulse counts
+ CONFIG_STM32_TIM8=y : Enable TIM8
+ CONFIG_STM32_TIM8_PWM=y : Use TIM8 to generate PWM output
+ CONFIG_STM32_TIM8_CHANNEL=4 : Select output on TIM8, channel 4
+
+ If CONFIG_STM32_FSMC is disabled, output will appear on CN3, pin 17
+ Ground is available on CN23 pin1.
+
+ See also include/board.h and apps/examples/README.txt
+
+ Special PWM-only debug options:
+
+ CONFIG_DEBUG_PWM
+
+ 4. This example supports the CAN loopback test (apps/examples/can) but this
+ must be manually enabled by selecting:
+
+ CONFIG_CAN=y : Enable the generic CAN infrastructure
+ CONFIG_CAN_EXID=y or n : Enable to support extended ID frames
+ CONFIG_STM32_CAN1=y : Enable CAN1
+ CONFIG_CAN_LOOPBACK=y : Enable CAN loopback mode
+
+ See also apps/examples/README.txt
+
+ Special CAN-only debug options:
+
+ CONFIG_DEBUG_CAN
+ CONFIG_CAN_REGDEBUG
+
+ 5. This example can support an FTP client. In order to build in FTP client
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpc
+ #CONFIGURED_APPS += examples/ftpc
+
+ 6. This example can support an FTP server. In order to build in FTP server
+ support simply uncomment the following lines in the appconfig file (before
+ configuring) or in the apps/.config file (after configuring):
+
+ #CONFIGURED_APPS += netutils/ftpd
+ #CONFIGURED_APPS += examples/ftpd
+
+ And enable poll() support in the NuttX configuration file:
+
+ CONFIG_DISABLE_POLL=n
+
+ 7. This example supports the watchdog timer test (apps/examples/watchdog)
+ but this must be manually enabled by selecting:
+
+ CONFIG_WATCHDOG=y : Enables watchdog timer driver support
+ CONFIG_STM32_WWDG=y : Enables the WWDG timer facility, OR
+ CONFIG_STM32_IWDG=y : Enables the IWDG timer facility (but not both)
+
+ The WWDG watchdog is driven off the (fast) 42MHz PCLK1 and, as result,
+ has a maximum timeout value of 49 milliseconds. For WWDG watchdog, you
+ should also add the fillowing to the configuration file:
+
+ CONFIG_EXAMPLES_WATCHDOG_PINGDELAY=20
+ CONFIG_EXAMPLES_WATCHDOG_TIMEOUT=49
+
+ The IWDG timer has a range of about 35 seconds and should not be an issue.
+
+ 7. Adding LCD and graphics support:
+
+ appconfig (apps/.config): Enable the application configurations that you
+ want to use. Asexamples:
+
+ CONFIGURED_APPS += examples/nx : Pick one or more
+ CONFIGURED_APPS += examples/nxhello :
+ CONFIGURED_APPS += examples/nximage :
+ CONFIGURED_APPS += examples/nxlines :
+
+ defconfig (nuttx/.config):
+
+ CONFIG_STM32_FSMC=y : FSMC support is required for the LCD
+ CONFIG_NX=y : Enable graphics suppport
+ CONFIG_MM_REGIONS=3 : When FSMC is enabled, so is the on-board SRAM memory region
+
+ 8. USB OTG FS Device or Host Support
+
+ CONFIG_USBDEV - Enable USB device support, OR
+ CONFIG_USBHOST - Enable USB host support
+ CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG - Needed
+ CONFIG_SCHED_WORKQUEUE - Worker thread support is required
+
+ 9. USB OTG FS Host Support. The following changes will enable support for
+ a USB host on the STM32F4Discovery, including support for a mass storage
+ class driver:
+
+ CONFIG_USBDEV=n - Make sure tht USB device support is disabled
+ CONFIG_USBHOST=y - Enable USB host support
+ CONFIG_STM32_OTGFS=y - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG=y - Needed for all USB OTF FS support
+ CONFIG_SCHED_WORKQUEUE=y - Worker thread support is required for the mass
+ storage class driver.
+ CONFIG_NSH_ARCHINIT=y - Architecture specific USB initialization
+ is needed for NSH
+ CONFIG_FS_FAT=y - Needed by the USB host mass storage class.
+
+ With those changes, you can use NSH with a FLASH pen driver as shown
+ belong. Here NSH is started with nothing in the USB host slot:
+
+ NuttShell (NSH) NuttX-x.yy
+ nsh> ls /dev
+ /dev:
+ console
+ null
+ ttyS0
+
+ After inserting the FLASH drive, the /dev/sda appears and can be
+ mounted like this:
+
+ nsh> ls /dev
+ /dev:
+ console
+ null
+ sda
+ ttyS0
+ nsh> mount -t vfat /dev/sda /mnt/stuff
+ nsh> ls /mnt/stuff
+ /mnt/stuff:
+ -rw-rw-rw- 16236 filea.c
+
+ And files on the FLASH can be manipulated to standard interfaces:
+
+ nsh> echo "This is a test" >/mnt/stuff/atest.txt
+ nsh> ls /mnt/stuff
+ /mnt/stuff:
+ -rw-rw-rw- 16236 filea.c
+ -rw-rw-rw- 16 atest.txt
+ nsh> cat /mnt/stuff/atest.txt
+ This is a test
+ nsh> cp /mnt/stuff/filea.c fileb.c
+ nsh> ls /mnt/stuff
+ /mnt/stuff:
+ -rw-rw-rw- 16236 filea.c
+ -rw-rw-rw- 16 atest.txt
+ -rw-rw-rw- 16236 fileb.c
+
+ To prevent data loss, don't forget to un-mount the FLASH drive
+ before removing it:
+
+ nsh> umount /mnt/stuff
+
+ 11. This configuration requires that jumper JP22 be set to enable RS-232
+ operation.
+
+ nsh2:
+ -----
+
+ This is an alternative NSH configuration. One limitation of the STM3240G-EVAL
+ board is that you cannot have both a UART-based NSH console and SDIO support.
+ The nsh2 differs from the nsh configuration in the following ways:
+
+ -CONFIG_STM32_USART3=y : USART3 is disabled
+ +CONFIG_STM32_USART3=n
+
+ -CONFIG_STM32_SDIO=n : SDIO is enabled
+ +CONFIG_STM32_SDIO=y
+
+ Logically, these are the only differences: This configuration has SDIO (and
+ the SD card) enabled and the serial console disabled. There is ONLY a
+ Telnet console!.
+
+ There are some special settings to make life with only a Telnet
+
+ CONFIG_SYSLOG=y - Enables the System Logging feature.
+ CONFIG_RAMLOG=y - Enable the RAM-based logging feature.
+ CONFIG_RAMLOG_CONSOLE=y - Use the RAM logger as the default console.
+ This means that any console output from non-Telnet threads will
+ go into the circular buffer in RAM.
+ CONFIG_RAMLOG_SYSLOG - This enables the RAM-based logger as the
+ system logger. This means that (1) in addition to the console
+ output from other tasks, ALL of the debug output will also to
+ to the circular buffer in RAM, and (2) NSH will now support a
+ command called 'dmesg' that can be used to dump the RAM log.
+
+ There are a few other configuration differences as necessary to support
+ this different device configuration. Just the do the 'diff' if you are
+ curious.
+
+ NOTES:
+ 1. See the notes for the nsh configuration. Most also apply to the nsh2
+ configuration. Like the nsh configuration, this configuration can
+ be modified to support a variety of additional tests.
+
+ 2. RS-232 is disabled, but Telnet is still available for use as a console.
+ Since RS-232 and SDIO use the same pins (one controlled by JP22), RS232
+ and SDIO cannot be used concurrently.
+
+ 3. This configuration requires that jumper JP22 be set to enable SDIO
+ operation. To enable MicroSD Card, which shares same I/Os with RS-232,
+ JP22 is not fitted.
+
+ 4. In order to use SDIO without overruns, DMA must be used. The STM32 F4
+ has 192Kb of SRAM in two banks: 112Kb of "system" SRAM located at
+ 0x2000:0000 and 64Kb of "CCM" SRAM located at 0x1000:0000. It appears
+ that you cannot perform DMA from CCM SRAM. The work around that I have now
+ is simply to omit the 64Kb of CCM SRAM from the heap so that all memory is
+ allocated from System SRAM. This is done by setting:
+
+ CONFIG_MM_REGIONS=1
+
+ Then DMA works fine. The downside is, of course, is that we lose 64Kb
+ of precious SRAM.
+
+ 5. Another SDIO/DMA issue. This one is probably a software bug. This is
+ the bug as stated in the TODO list:
+
+ "If you use a large I/O buffer to access the file system, then the
+ MMCSD driver will perform multiple block SD transfers. With DMA
+ ON, this seems to result in CRC errors detected by the hardware
+ during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_DISABLE=y"
+
+ For this reason, CONFIG_MMCSD_MULTIBLOCK_DISABLE=y appears in the defconfig
+ file.
+
+ 6. Another DMA-related concern. I see this statement in the reference
+ manual: "The burst configuration has to be selected in order to respect
+ the AHB protocol, where bursts must not cross the 1 KB address boundary
+ because the minimum address space that can be allocated to a single slave
+ is 1 KB. This means that the 1 KB address boundary should not be crossed
+ by a burst block transfer, otherwise an AHB error would be generated,
+ that is not reported by the DMA registers."
+
+ There is nothing in the DMA driver to prevent this now.
+
+ nxconsole:
+ ----------
+ This is yet another NSH configuration. This NSH configuration differs
+ from the others, however, in that it uses the NxConsole driver to host
+ the NSH shell.
+
+ Some of the differences in this configuration and the normal nsh configuration
+ include these settings in the defconfig file:
+
+ These select NX Multi-User mode:
+
+ CONFG_NX_MULTIUSER=y
+ CONFIG_DISABLE_MQUEUE=n
+
+ The following definition in the defconfig file to enables the NxConsole
+ driver:
+
+ CONFIG_NXCONSOLE=y
+
+ The appconfig file selects examples/nxconsole instead of examples/nsh:
+
+ CONFIGURED_APPS += examples/nxconsole
+
+ Other configuration settings:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LCD_LANDSCAPE=y : 320x240 landscape
+
+ nxwm
+ ----
+ This is a special configuration setup for the NxWM window manager
+ UnitTest. The NxWM window manager can be found here:
+
+ trunk/NxWidgets/nxwm
+
+ The NxWM unit test can be found at:
+
+ trunk/NxWidgets/UnitTests/nxwm
+
+ Documentation for installing the NxWM unit test can be found here:
+
+ trunk/NxWidgets/UnitTests/README.txt
+
+ Here is the quick summary of the build steps:
+
+ 1. Intall the nxwm configuration
+
+ $ cd ~/nuttx/trunk/nuttx/tools
+ $ ./configure.sh stm3240g-eval/nxwm
+
+ 2. Make the build context (only)
+
+ $ cd ..
+ $ . ./setenv.sh
+ $ make context
+ ...
+
+ 3. Install the nxwm unit test
+
+ $ cd ~/nuttx/trunk/NxWidgets
+ $ tools/install.sh ~/nuttx/trunk/apps nxwm
+ Creating symbolic link
+ - To ~/nuttx/trunk/NxWidgets/UnitTests/nxwm
+ - At ~/nuttx/trunk/apps/external
+
+ 4. Build the NxWidgets library
+
+ $ cd ~/nuttx/trunk/NxWidgets/libnxwidgets
+ $ make TOPDIR=~/nuttx/trunk/nuttx
+ ...
+
+ 5. Build the NxWM library
+
+ $ cd ~/nuttx/trunk/NxWidgets/nxwm
+ $ make TOPDIR=~//nuttx/trunk/nuttx
+ ...
+
+ 6. Built NuttX with the installed unit test as the application
+
+ $ cd ~/nuttx/trunk/nuttx
+ $ make
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ If you use the Atollic toolchain, then the FPU test can be enabled in the
+ examples/ostest by adding the following your NuttX configuration file:
+
+ -CONFIG_ARCH_FPU=n : Enable FPU support
+ +CONFIG_ARCH_FPU=y
+
+ -CONFIG_STM32_CODESOURCERYW=y : Disable the CodeSourcery toolchain
+ +CONFIG_STM32_CODESOURCERYW=n
+
+ -CONFIG_STM32_ATOLLIC_LITE=n : Enable *one* the Atollic toolchains
+ CONFIG_STM32_ATOLLIC_PRO=n
+ -CONFIG_STM32_ATOLLIC_LITE=y : The "Lite" version, OR
+ CONFIG_STM32_ATOLLIC_PRO=n : The "Pro" version (only one)
+
+ -CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
+ +CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_HAVE_CXX=y : Suppress generation of C++ code
+ +CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_SCHED_WAITPID=y : Enable the waitpid() API needed by the FPU test
+ +CONFIG_SCHED_WAITPID=n
+
+ The FPU test also needs to know the size of the FPU registers save area in
+ bytes (see arch/arm/include/armv7-m/irq_lazyfpu.h):
+
+ +CONFIG_EXAMPLES_OSTEST_FPUSIZE=(4*33)
+
+ telnetd:
+ --------
+
+ A simple test of the Telnet daemon(see apps/netutils/README.txt,
+ apps/examples/README.txt, and apps/examples/telnetd). This is
+ the same daemon that is used in the nsh configuration so if you
+ use NSH, then you don't care about this. This test is good for
+ testing the Telnet daemon only because it works in a simpler
+ environment than does the nsh configuration.
+
+ xmlrpc
+ ------
+
+ An example configuration for the Embeddable Lightweight XML-RPC
+ Server at apps/examples/xmlrpc. See http://www.drdobbs.com/web-development/\
+ an-embeddable-lightweight-xml-rpc-server/184405364 for more info.
+ Contributed by Max Holtzberg. \ No newline at end of file
diff --git a/nuttx/configs/stm3240g-eval/dhcpd/Make.defs b/nuttx/configs/stm3240g-eval/dhcpd/Make.defs
new file mode 100644
index 000000000..8ce21b7bc
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/dhcpd/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/dhcpd/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/dhcpd/appconfig b/nuttx/configs/stm3240g-eval/dhcpd/appconfig
new file mode 100644
index 000000000..d6f0fd920
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/dhcpd/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/stm3240g-eval/dhcpd/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/dhcpd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/dhcpd
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/stm3240g-eval/dhcpd/defconfig b/nuttx/configs/stm3240g-eval/dhcpd/defconfig
new file mode 100644
index 000000000..83678b12a
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/dhcpd/defconfig
@@ -0,0 +1,641 @@
+############################################################################
+# configs/stm3240g-eval/dhcpd/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="dhcpd_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=13
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=n
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=y
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/dhcpd
+#
+CONFIG_EXAMPLE_DHCPD_NOMAC=y
+CONFIG_EXAMPLE_DHCPD_IPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_DHCPD_NETMASK=0xffffff00
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/dhcpd/setenv.sh b/nuttx/configs/stm3240g-eval/dhcpd/setenv.sh
new file mode 100755
index 000000000..9fcb08906
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/dhcpd/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/dhcpd/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/discover/Make.defs b/nuttx/configs/stm3240g-eval/discover/Make.defs
new file mode 100644
index 000000000..5509a14f4
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/discover/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/discover/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/discover/defconfig b/nuttx/configs/stm3240g-eval/discover/defconfig
new file mode 100644
index 000000000..81a5b3c91
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/discover/defconfig
@@ -0,0 +1,866 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+# CONFIG_INTELHEX_BINARY is not set
+# CONFIG_MOTOROLA_SREC is not set
+CONFIG_RAW_BINARY=y
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_VERBOSE is not set
+# CONFIG_DEBUG_ENABLE is not set
+# CONFIG_DEBUG_SCHED is not set
+# CONFIG_DEBUG_MM is not set
+CONFIG_DEBUG_NET=y
+# CONFIG_DEBUG_USB is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_DEBUG_LIB is not set
+# CONFIG_DEBUG_BINFMT is not set
+# CONFIG_DEBUG_GRAPHICS is not set
+# CONFIG_DEBUG_I2C is not set
+# CONFIG_DEBUG_SPI is not set
+# CONFIG_DEBUG_WATCHDOG is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+CONFIG_ARCH_ARM=y
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="arm"
+# CONFIG_ARCH_CHIP_C5471 is not set
+# CONFIG_ARCH_CHIP_CALYPSO is not set
+# CONFIG_ARCH_CHIP_DM320 is not set
+# CONFIG_ARCH_CHIP_IMX is not set
+# CONFIG_ARCH_CHIP_KINETIS is not set
+# CONFIG_ARCH_CHIP_LM3S is not set
+# CONFIG_ARCH_CHIP_LPC17XX is not set
+# CONFIG_ARCH_CHIP_LPC214X is not set
+# CONFIG_ARCH_CHIP_LPC2378 is not set
+# CONFIG_ARCH_CHIP_LPC31XX is not set
+# CONFIG_ARCH_CHIP_LPC43XX is not set
+# CONFIG_ARCH_CHIP_SAM3U is not set
+CONFIG_ARCH_CHIP_STM32=y
+# CONFIG_ARCH_CHIP_STR71X is not set
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_FAMILY="armv7-m"
+CONFIG_ARCH_CHIP="stm32"
+# CONFIG_ARCH_FPU is not set
+CONFIG_ARCH_HAVE_MPU=y
+# CONFIG_ARMV7M_MPU is not set
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+# CONFIG_ARCH_CALIBRATION is not set
+# CONFIG_SERIAL_TERMIOS is not set
+# CONFIG_NET_MULTICAST is not set
+
+#
+# STM32 Configuration Options
+#
+# CONFIG_ARCH_CHIP_STM32F100C8 is not set
+# CONFIG_ARCH_CHIP_STM32F100CB is not set
+# CONFIG_ARCH_CHIP_STM32F100R8 is not set
+# CONFIG_ARCH_CHIP_STM32F100RB is not set
+# CONFIG_ARCH_CHIP_STM32F100V8 is not set
+# CONFIG_ARCH_CHIP_STM32F100VB is not set
+# CONFIG_ARCH_CHIP_STM32F103RET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103ZET6 is not set
+# CONFIG_ARCH_CHIP_STM32F105VBT7 is not set
+# CONFIG_ARCH_CHIP_STM32F107VC is not set
+# CONFIG_ARCH_CHIP_STM32F207IG is not set
+# CONFIG_ARCH_CHIP_STM32F405RG is not set
+# CONFIG_ARCH_CHIP_STM32F405VG is not set
+# CONFIG_ARCH_CHIP_STM32F405ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407VE is not set
+# CONFIG_ARCH_CHIP_STM32F407VG is not set
+# CONFIG_ARCH_CHIP_STM32F407ZE is not set
+# CONFIG_ARCH_CHIP_STM32F407ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407IE is not set
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_STM32_STM32F40XX=y
+# CONFIG_STM32_CODESOURCERYW is not set
+CONFIG_STM32_CODESOURCERYL=y
+# CONFIG_STM32_ATOLLIC_LITE is not set
+# CONFIG_STM32_ATOLLIC_PRO is not set
+# CONFIG_STM32_DEVKITARM is not set
+# CONFIG_STM32_RAISONANCE is not set
+# CONFIG_STM32_BUILDROOT is not set
+# CONFIG_STM32_DFU is not set
+
+#
+# STM32 Peripheral Support
+#
+# CONFIG_STM32_ADC1 is not set
+# CONFIG_STM32_ADC2 is not set
+# CONFIG_STM32_ADC3 is not set
+# CONFIG_STM32_CRC is not set
+# CONFIG_STM32_DMA1 is not set
+# CONFIG_STM32_DMA2 is not set
+# CONFIG_STM32_BKPSRAM is not set
+# CONFIG_STM32_CAN1 is not set
+# CONFIG_STM32_CAN2 is not set
+# CONFIG_STM32_CCMDATARAM is not set
+# CONFIG_STM32_CRYP is not set
+# CONFIG_STM32_DAC1 is not set
+# CONFIG_STM32_DAC2 is not set
+# CONFIG_STM32_DCMI is not set
+CONFIG_STM32_ETHMAC=y
+# CONFIG_STM32_FSMC is not set
+# CONFIG_STM32_HASH is not set
+CONFIG_STM32_I2C1=y
+# CONFIG_STM32_I2C2 is not set
+# CONFIG_STM32_I2C3 is not set
+# CONFIG_STM32_IWDG is not set
+# CONFIG_STM32_OTGFS is not set
+# CONFIG_STM32_OTGHS is not set
+CONFIG_STM32_PWR=y
+# CONFIG_STM32_RNG is not set
+# CONFIG_STM32_SDIO is not set
+# CONFIG_STM32_SPI1 is not set
+# CONFIG_STM32_SPI2 is not set
+# CONFIG_STM32_SPI3 is not set
+CONFIG_STM32_SYSCFG=y
+# CONFIG_STM32_TIM1 is not set
+# CONFIG_STM32_TIM2 is not set
+# CONFIG_STM32_TIM3 is not set
+# CONFIG_STM32_TIM4 is not set
+# CONFIG_STM32_TIM5 is not set
+# CONFIG_STM32_TIM6 is not set
+# CONFIG_STM32_TIM7 is not set
+# CONFIG_STM32_TIM8 is not set
+# CONFIG_STM32_TIM9 is not set
+# CONFIG_STM32_TIM10 is not set
+# CONFIG_STM32_TIM11 is not set
+# CONFIG_STM32_TIM12 is not set
+# CONFIG_STM32_TIM13 is not set
+# CONFIG_STM32_TIM14 is not set
+# CONFIG_STM32_USART1 is not set
+# CONFIG_STM32_USART2 is not set
+CONFIG_STM32_USART3=y
+# CONFIG_STM32_UART4 is not set
+# CONFIG_STM32_UART5 is not set
+# CONFIG_STM32_USART6 is not set
+# CONFIG_STM32_WWDG is not set
+
+#
+# Alternate Pin Mapping
+#
+# CONFIG_STM32_JTAG_DISABLE is not set
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set
+# CONFIG_STM32_JTAG_SW_ENABLE is not set
+# CONFIG_STM32_FORCEPOWER is not set
+# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
+# CONFIG_STM32_CCMEXCLUDE is not set
+
+#
+# Ethernet MAC configuration
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+# CONFIG_STM32_MII_MCO2 is not set
+CONFIG_STM32_AUTONEG=y
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+# CONFIG_STM32_ETH_PTP is not set
+
+#
+# USB Host Configuration
+#
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_DMA is not set
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# Board Settings
+#
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=196608
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+# CONFIG_ARCH_INTERRUPTSTACK is not set
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="stm3240g-eval"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_HAVE_BUTTONS=y
+# CONFIG_ARCH_BUTTONS is not set
+CONFIG_ARCH_HAVE_IRQBUTTONS=y
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=200
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_DEV_CONSOLE=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WORKQUEUE is not set
+CONFIG_SCHED_WAITPID=y
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="discover_main"
+CONFIG_DISABLE_OS_API=y
+# CONFIG_DISABLE_CLOCK is not set
+# CONFIG_DISABLE_POSIX_TIMERS is not set
+# CONFIG_DISABLE_PTHREAD is not set
+# CONFIG_DISABLE_SIGNALS is not set
+# CONFIG_DISABLE_MQUEUE is not set
+# CONFIG_DISABLE_MOUNTPOINT is not set
+# CONFIG_DISABLE_ENVIRON is not set
+CONFIG_DISABLE_POLL=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Stack and heap information
+#
+# CONFIG_CUSTOM_STACK is not set
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+
+#
+# Device Drivers
+#
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+CONFIG_I2C=y
+# CONFIG_I2C_SLAVE is not set
+CONFIG_I2C_TRANSFER=y
+# CONFIG_I2C_WRITEREAD is not set
+CONFIG_I2C_POLLED=y
+# CONFIG_I2C_TRACE is not set
+# CONFIG_SPI is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+# CONFIG_MTD is not set
+# CONFIG_NETDEVICES is not set
+# CONFIG_NET_SLIP is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_LOWLEVEL_CONSOLE is not set
+# CONFIG_16550_UART is not set
+CONFIG_ARCH_HAVE_USART3=y
+CONFIG_MCU_SERIAL=y
+CONFIG_STANDARD_SERIAL=y
+CONFIG_USART3_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART3 Configuration
+#
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_USART3_BAUD=115200
+CONFIG_USART3_BITS=8
+CONFIG_USART3_PARITY=0
+CONFIG_USART3_2STOP=0
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+CONFIG_NET=y
+# CONFIG_NET_NOINTS is not set
+CONFIG_NET_MULTIBUFFER=y
+# CONFIG_NET_IPv6 is not set
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_NACTIVESOCKETS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=650
+# CONFIG_NET_TCPURGDATA is not set
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_TCP_READAHEAD_BUFSIZE=562
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCP_RECVDELAY=0
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+# CONFIG_NET_PINGADDRCONF is not set
+# CONFIG_NET_IGMP is not set
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_RECEIVE_WINDOW=562
+CONFIG_NET_ARPTAB_SIZE=16
+CONFIG_NET_ARP_IPIN=y
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_NFS is not set
+# CONFIG_FS_NXFFS is not set
+# CONFIG_FS_ROMFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=2
+# CONFIG_GRAN is not set
+
+#
+# Library Routines
+#
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_HAVE_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+# CONFIG_CXX_NEWLONG is not set
+
+#
+# Application Configuration
+#
+
+#
+# Named Applications
+#
+# CONFIG_NAMEDAPP is not set
+
+#
+# Examples
+#
+
+#
+# ADC Example
+#
+# CONFIG_EXAMPLES_ADC is not set
+
+#
+# Buttons Example
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+
+#
+# CAN Example
+#
+# CONFIG_EXAMPLES_CAN is not set
+
+#
+# USB CDC/ACM Class Driver Example
+#
+# CONFIG_EXAMPLES_CDCACM is not set
+
+#
+# USB composite Class Driver Example
+#
+# CONFIG_EXAMPLES_COMPOSITE is not set
+
+#
+# DHCP Server Example
+#
+# CONFIG_EXAMPLES_DHCPD is not set
+
+#
+# FTP Client Example
+#
+# CONFIG_EXAMPLES_FTPC is not set
+
+#
+# FTP Server Example
+#
+# CONFIG_EXAMPLES_FTPD is not set
+
+#
+# "Hello, World!" Example
+#
+# CONFIG_EXAMPLES_HELLO is not set
+
+#
+# "Hello, World!" C++ Example
+#
+# CONFIG_EXAMPLES_HELLOXX is not set
+
+#
+# USB HID Keyboard Example
+#
+# CONFIG_EXAMPLES_HIDKBD is not set
+
+#
+# IGMP Example
+#
+# CONFIG_EXAMPLES_IGMP is not set
+
+#
+# LCD Read/Write Example
+#
+# CONFIG_EXAMPLES_LCDRW is not set
+
+#
+# Memory Management Example
+#
+# CONFIG_EXAMPLES_MM is not set
+
+#
+# File System Mount Example
+#
+# CONFIG_EXAMPLES_MOUNT is not set
+
+#
+# FreeModBus Example
+#
+# CONFIG_EXAMPLES_MODBUS is not set
+
+#
+# Network Test Example
+#
+# CONFIG_EXAMPLES_NETTEST is not set
+
+#
+# NuttShell (NSH) Example
+#
+# CONFIG_EXAMPLES_NSH is not set
+
+#
+# NULL Example
+#
+# CONFIG_EXAMPLES_NULL is not set
+
+#
+# NX Graphics Example
+#
+# CONFIG_EXAMPLES_NX is not set
+
+#
+# NxConsole Example
+#
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+
+#
+# NXFFS File System Example
+#
+# CONFIG_EXAMPLES_NXFFS is not set
+
+#
+# NXFLAT Example
+#
+# CONFIG_EXAMPLES_NXFLAT is not set
+
+#
+# NX Graphics "Hello, World!" Example
+#
+# CONFIG_EXAMPLES_NXHELLO is not set
+
+#
+# NX Graphics image Example
+#
+# CONFIG_EXAMPLES_NXIMAGE is not set
+
+#
+# NX Graphics lines Example
+#
+# CONFIG_EXAMPLES_NXLINES is not set
+
+#
+# NX Graphics Text Example
+#
+# CONFIG_EXAMPLES_NXTEXT is not set
+
+#
+# OS Test Example
+#
+# CONFIG_EXAMPLES_OSTEST is not set
+
+#
+# Pascal "Hello, World!"example
+#
+# CONFIG_EXAMPLES_PASHELLO is not set
+
+#
+# Pipe Example
+#
+# CONFIG_EXAMPLES_PIPE is not set
+
+#
+# Poll Example
+#
+# CONFIG_EXAMPLES_POLL is not set
+
+#
+# Pulse Width Modulation (PWM) Example
+#
+
+#
+# Quadrature Encoder Example
+#
+# CONFIG_EXAMPLES_QENCODER is not set
+
+#
+# RGMP Example
+#
+# CONFIG_EXAMPLES_RGMP is not set
+
+#
+# ROMFS Example
+#
+# CONFIG_EXAMPLES_ROMFS is not set
+
+#
+# sendmail Example
+#
+# CONFIG_EXAMPLES_SENDMAIL is not set
+
+#
+# Serial Loopback Example
+#
+# CONFIG_EXAMPLES_SERLOOP is not set
+
+#
+# Telnet Daemon Example
+#
+# CONFIG_EXAMPLES_TELNETD is not set
+
+#
+# THTTPD Web Server Example
+#
+# CONFIG_EXAMPLES_THTTPD is not set
+
+#
+# TIFF Generation Example
+#
+# CONFIG_EXAMPLES_TIFF is not set
+
+#
+# Touchscreen Example
+#
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+
+#
+# UDP Example
+#
+# CONFIG_EXAMPLES_UDP is not set
+
+#
+# UDP Discovery Daemon Example
+#
+CONFIG_EXAMPLE_DISCOVER=y
+CONFIG_EXAMPLE_DISCOVER_DHCPC=y
+CONFIG_EXAMPLE_DISCOVER_NOMAC=y
+CONFIG_EXAMPLE_DISCOVER_DRIPADDR=0xc0a80201
+CONFIG_EXAMPLE_DISCOVER_NETMASK=0xffffff00
+
+#
+# uIP Web Server Example
+#
+# CONFIG_EXAMPLES_UIP is not set
+
+#
+# USB Serial Test Example
+#
+# CONFIG_EXAMPLES_USBSERIAL is not set
+
+#
+# USB Mass Storage Class Example
+#
+# CONFIG_EXAMPLES_USBMSC is not set
+
+#
+# USB Serial Terminal Example
+#
+# CONFIG_EXAMPLES_USBTERM is not set
+
+#
+# Watchdog timer Example
+#
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# wget Example
+#
+# CONFIG_EXAMPLES_WGET is not set
+
+#
+# WLAN Example
+#
+# CONFIG_EXAMPLES_WLAN is not set
+
+#
+# Interpreters
+#
+
+#
+# Interpreters
+#
+# CONFIG_FICL is not set
+# CONFIG_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+
+#
+# DHCP client
+#
+CONFIG_NETUTILS_DHCPC=y
+
+#
+# DHCP server
+#
+# CONFIG_NETUTILS_DHCPD is not set
+
+#
+# FTP client
+#
+# CONFIG_NETUTILS_FTPC is not set
+
+#
+# FTP server
+#
+# CONFIG_NETUTILS_FTPD is not set
+
+#
+# Name resolution
+#
+CONFIG_NETUTILS_RESOLV=y
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# SMTP
+#
+# CONFIG_NETUTILS_SMTP is not set
+
+#
+# TFTP client
+#
+# CONFIG_NETUTILS_TELNETD is not set
+
+#
+# TFTP client
+#
+# CONFIG_NETUTILS_TFTPC is not set
+
+#
+# THTTPD web server
+#
+# CONFIG_NETUTILS_THTTPD is not set
+
+#
+# uIP support library
+#
+CONFIG_NETUTILS_UIPLIB=y
+
+#
+# uIP web client
+#
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# uIP web server
+#
+# CONFIG_NETUTILS_WEBSERVER is not set
+
+#
+# UDP Discovery Utility
+#
+CONFIG_NETUTILS_DISCOVER=y
+CONFIG_DISCOVER_STACK_SIZE=1024
+CONFIG_DISCOVER_PRIORITY=50
+CONFIG_DISCOVER_PORT=96
+CONFIG_DISCOVER_INTERFACE="eth0"
+CONFIG_DISCOVER_DEVICE_CLASS=0xff
+CONFIG_CONFIG_DISCOVER_DESCR="STM3240G-EVAL"
+
+#
+# ModBus
+#
+
+#
+# FreeModbus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom free memory command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+# CONFIG_SYSTEM_I2CTOOL is not set
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# readline() support
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# VSN board Add-Ons
+#
+
+#
+# VSN board add-ons
+#
+# CONFIG_VSN_POWEROFF is not set
+# CONFIG_VSN_RAMTRON is not set
+# CONFIG_VSN_SDCARD is not set
+# CONFIG_VSN_SYSINFO is not set
diff --git a/nuttx/configs/stm3240g-eval/discover/setenv.sh b/nuttx/configs/stm3240g-eval/discover/setenv.sh
new file mode 100755
index 000000000..ce5f031b1
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/discover/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/discover/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/include/board.h b/nuttx/configs/stm3240g-eval/include/board.h
new file mode 100644
index 000000000..8fa7d0dd4
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/include/board.h
@@ -0,0 +1,553 @@
+/************************************************************************************
+ * configs/stm3240g-eval/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* Four clock sources are available on STM3240G-EVAL evaluation board for
+ * STM32F407IGH6 and RTC embedded:
+ *
+ * X1, 25 MHz crystal for ethernet PHY with socket. It can be removed when clock is
+ * provided by MCO pin of the MCU
+ * X2, 26 MHz crystal for USB OTG HS PHY
+ * X3, 32 kHz crystal for embedded RTC
+ * X4, 25 MHz crystal with socket for STM32F407IGH6 microcontroller (It can be removed
+ * from socket when internal RC clock is used.)
+ *
+ * This is the "standard" configuration as set up by arch/arm/src/stm32f40xx_rcc.c:
+ * System Clock source : PLL (HSE)
+ * SYSCLK(Hz) : 168000000 Determined by PLL configuration
+ * HCLK(Hz) : 168000000 (STM32_RCC_CFGR_HPRE)
+ * AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
+ * APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
+ * APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
+ * HSE Frequency(Hz) : 25000000 (STM32_BOARD_XTAL)
+ * PLLM : 25 (STM32_PLLCFG_PLLM)
+ * PLLN : 336 (STM32_PLLCFG_PLLN)
+ * PLLP : 2 (STM32_PLLCFG_PLLP)
+ * PLLQ : 7 (STM32_PLLCFG_PLLQ)
+ * Main regulator output voltage : Scale1 mode Needed for high speed SYSCLK
+ * Flash Latency(WS) : 5
+ * Prefetch Buffer : OFF
+ * Instruction cache : ON
+ * Data cache : ON
+ * Require 48MHz for USB OTG FS, : Enabled
+ * SDIO and RNG clock
+ */
+
+/* HSI - 16 MHz RC factory-trimmed
+ * LSI - 32 KHz RC
+ * HSE - On-board crystal frequency is 25MHz
+ * LSE - 32.768 kHz
+ */
+
+#define STM32_BOARD_XTAL 25000000ul
+
+#define STM32_HSI_FREQUENCY 16000000ul
+#define STM32_LSI_FREQUENCY 32000
+#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
+#define STM32_LSE_FREQUENCY 32768
+
+/* Main PLL Configuration.
+ *
+ * PLL source is HSE
+ * PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
+ * = (25,000,000 / 25) * 336
+ * = 336,000,000
+ * SYSCLK = PLL_VCO / PLLP
+ * = 336,000,000 / 2 = 168,000,000
+ * USB OTG FS, SDIO and RNG Clock
+ * = PLL_VCO / PLLQ
+ * = 48,000,000
+ */
+
+#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(25)
+#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(336)
+#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
+#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(7)
+
+#define STM32_SYSCLK_FREQUENCY 168000000ul
+
+/* AHB clock (HCLK) is SYSCLK (168MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
+#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB1 clock (PCLK1) is HCLK/4 (42MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
+
+/* Timers driven from APB1 will be twice PCLK1 */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
+
+/* APB2 clock (PCLK2) is HCLK/2 (84MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
+#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* Timers driven from APB2 will be twice PCLK2 */
+
+#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
+
+/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
+ * otherwise frequency is 2xAPBx.
+ * Note: TIM1,8 are on APB2, others on APB1
+ */
+
+#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode. These values have not been
+ * tuned!!!
+ *
+ * SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
+ * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
+ * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* Ethernet *************************************************************************/
+/* We need to provide clocking to the MII PHY via MCO1 (PA8) */
+
+#if defined(CONFIG_NET) && defined(CONFIG_STM32_ETHMAC)
+
+# if !defined(CONFIG_STM32_MII)
+# warning "CONFIG_STM32_MII required for Ethernet"
+# elif !defined(CONFIG_STM32_MII_MCO1)
+# warning "CONFIG_STM32_MII_MCO1 required for Ethernet MII"
+# else
+
+ /* Output HSE clock (25MHz) on MCO1 pin (PA8) to clock the PHY */
+
+# define BOARD_CFGR_MC01_SOURCE RCC_CFGR_MCO1_HSE
+# define BOARD_CFGR_MC01_DIVIDER RCC_CFGR_MCO1PRE_NONE
+
+# endif
+#endif
+
+/* LED definitions ******************************************************************/
+/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
+ * way. The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with stm32_setled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_LED3 2
+#define BOARD_LED4 3
+#define BOARD_NLEDS 4
+
+/* LED bits for use with stm32_setleds() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+#define BOARD_LED3_BIT (1 << BOARD_LED3)
+#define BOARD_LED4_BIT (1 << BOARD_LED4)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on board the
+ * STM3240G-EVAL. The following definitions describe how NuttX controls the LEDs:
+ */
+
+#define LED_STARTED 0 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED2 */
+#define LED_IRQSENABLED 2 /* LED1 + LED2 */
+#define LED_STACKCREATED 3 /* LED3 */
+#define LED_INIRQ 4 /* LED1 + LED3 */
+#define LED_SIGNAL 5 /* LED2 + LED3 */
+#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
+#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+
+/* Button definitions ***************************************************************/
+/* The STM3240G-EVAL supports three buttons: */
+
+#define BUTTON_WAKEUP 0
+#define BUTTON_TAMPER 1
+#define BUTTON_USER 2
+
+#define NUM_BUTTONS 3
+
+#define BUTTON_WAKEUP_BIT (1 << BUTTON_WAKEUP)
+#define BUTTON_TAMPER_BIT (1 << BUTTON_TAMPER)
+#define BUTTON_USER_BIT (1 << BUTTON_USER)
+
+/* SRAM definitions *****************************************************************/
+/* The 16 Mbit SRAM is connected to the STM32F407IGH6 FSMC bus which shares the same
+ * I/Os with the CAN1 bus. Jumper settings:
+ *
+ * JP1: Connect PE4 to SRAM as A20
+ * JP2: onnect PE3 to SRAM as A19
+ *
+ * JP3 and JP10 must not be fitted for SRAM and LCD application. JP3 and JP10
+ * select CAN1 or CAN2 if fitted; neither if not fitted.
+ */
+
+#if defined(CONFIG_STM32_FSMC) && defined(CONFIG_STM32_FSMC_SRAM)
+# if defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2)
+# error "The STM3240G-EVAL cannot support both CAN and FSMC SRAM"
+# endif
+#endif
+
+/* This is the Bank1 SRAM2 address: */
+
+#define BOARD_SRAM_BASE 0x64000000
+#define BOARD_SRAM_SIZE (2*1024*1024)
+
+/* Alternate function pin selections ************************************************/
+
+/* UART3:
+ *
+ * - PC11 is MicroSDCard_D3 & RS232/IrDA_RX (JP22 open)
+ * - PC10 is MicroSDCard_D2 & RSS232/IrDA_TX
+ */
+
+#define GPIO_USART3_RX GPIO_USART3_RX_2
+#define GPIO_USART3_TX GPIO_USART3_TX_2
+
+/* Ethernet:
+ *
+ * - PA2 is ETH_MDIO
+ * - PC1 is ETH_MDC
+ * - PB5 is ETH_PPS_OUT
+ * - PH2 is ETH_MII_CRS
+ * - PH3 is ETH_MII_COL
+ * - PI10 is ETH_MII_RX_ER
+ * - PH6 is ETH_MII_RXD2
+ * - PH7 is ETH_MII_RXD3
+ * - PC3 is ETH_MII_TX_CLK
+ * - PC2 is ETH_MII_TXD2
+ * - PB8 is ETH_MII_TXD3
+ * - PA1 is ETH_MII_RX_CLK/ETH_RMII_REF_CLK
+ * - PA7 is ETH_MII_RX_DV/ETH_RMII_CRS_DV
+ * - PC4 is ETH_MII_RXD0/ETH_RMII_RXD0
+ * - PC5 is ETH_MII_RXD1/ETH_RMII_RXD1
+ * - PG11 is ETH_MII_TX_EN/ETH_RMII_TX_EN
+ * - PG13 is ETH_MII_TXD0/ETH_RMII_TXD0
+ * - PG14 is ETH_MII_TXD1/ETH_RMII_TXD1
+ */
+
+#define GPIO_ETH_PPS_OUT GPIO_ETH_PPS_OUT_1
+#define GPIO_ETH_MII_CRS GPIO_ETH_MII_CRS_2
+#define GPIO_ETH_MII_COL GPIO_ETH_MII_COL_2
+#define GPIO_ETH_MII_RX_ER GPIO_ETH_MII_RX_ER_2
+#define GPIO_ETH_MII_RXD2 GPIO_ETH_MII_RXD2_2
+#define GPIO_ETH_MII_RXD3 GPIO_ETH_MII_RXD3_2
+#define GPIO_ETH_MII_TXD3 GPIO_ETH_MII_TXD3_1
+#define GPIO_ETH_MII_TX_EN GPIO_ETH_MII_TX_EN_2
+#define GPIO_ETH_MII_TXD0 GPIO_ETH_MII_TXD0_2
+#define GPIO_ETH_MII_TXD1 GPIO_ETH_MII_TXD1_2
+#define GPIO_ETH_RMII_TX_EN GPIO_ETH_RMII_TX_EN_2
+#define GPIO_ETH_RMII_TXD0 GPIO_ETH_RMII_TXD0_2
+#define GPIO_ETH_RMII_TXD1 GPIO_ETH_RMII_TXD1_2
+
+/* PWM
+ *
+ * The STM3240G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using the following:
+ *
+ * If FSMC is not used:
+ * TIM4 CH2OUT: PD13 FSMC_A18 / MC_TIM4_CH2OUT
+ * Daughterboard Extension Connector, CN3, pin 32
+ * Motor Control Connector CN15, pin 33 -- not available unless you bridge SB14.
+ *
+ * TIM1 CH1OUT: PE9 FSMC_D6
+ * Daughterboard Extension Connector, CN2, pin 24
+ *
+ * TIM1_CH2OUT: PE11 FSMC_D8
+ * Daughterboard Extension Connector, CN2, pin 26
+ *
+ * TIM1_CH3OUT: PE13 FSMC_D10
+ * Daughterboard Extension Connector, CN2, pin 28
+ *
+ * TIM1_CH4OUT: PE14 FSMC_D11
+ * Daughterboard Extension Connector, CN2, pin 29
+ *
+ * If OTG FS is not used
+ *
+ * TIM1_CH3OUT: PA10 OTG_FS_ID
+ * Daughterboard Extension Connector, CN3, pin 14
+ *
+ * TIM1_CH4OUT: PA11 OTG_FS_DM
+ * Daughterboard Extension Connector, CN3, pin 11
+ *
+ * If DMCI is not used
+ *
+ * TIM8 CH1OUT: PI5 DCMI_VSYNC & MC
+ * Daughterboard Extension Connector, CN4, pin 4
+ *
+ * TIM8_CH2OUT: PI6 DCMI_D6 & MC
+ * Daughterboard Extension Connector, CN4, pin 3
+ *
+ * TIM8_CH3OUT: PI7 DCMI_D7 & MC
+ * Daughterboard Extension Connector, CN4, pin 2
+ *
+ * If SDIO is not used
+ *
+ * TIM8_CH3OUT: PC8 MicroSDCard_D0 & MC
+ * Daughterboard Extension Connector, CN3, pin 18
+ *
+ * TIM8_CH4OUT: PC9 MicroSDCard_D1 & I2S_CKIN (Need JP16 open)
+ * Daughterboard Extension Connector, CN3, pin 17
+ *
+ * Others
+ *
+ * TIM8 CH1OUT: PC6 I2S_MCK & Smartcard_IO (JP21 open)
+ */
+
+#if !defined(CONFIG_STM32_FSMC)
+# define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
+# define GPIO_TIM1_CH1OUT GPIO_TIM1_CH1OUT_2
+# define GPIO_TIM1_CH2OUT GPIO_TIM1_CH2OUT_2
+# define GPIO_TIM1_CH3OUT GPIO_TIM1_CH3OUT_2
+# define GPIO_TIM1_CH4OUT GPIO_TIM1_CH4OUT_2
+#elif !defined(CONFIG_STM32_OTGFS)
+# define GPIO_TIM1_CH3OUT GPIO_TIM1_CH3OUT_1
+# define GPIO_TIM1_CH4OUT GPIO_TIM1_CH4OUT_1
+#endif
+
+#if !defined(CONFIG_STM32_DCMI)
+# define GPIO_TIM8_CH1OUT GPIO_TIM8_CH1OUT_2
+# define GPIO_TIM8_CH2OUT GPIO_TIM8_CH2OUT_2
+# define GPIO_TIM8_CH3OUT GPIO_TIM8_CH3OUT_2
+#else
+# define GPIO_TIM8_CH1OUT GPIO_TIM8_CH1OUT_1
+# if !defined(CONFIG_STM32_SDIO)
+# define GPIO_TIM8_CH3OUT GPIO_TIM8_CH3OUT_1
+# endif
+#endif
+
+#if !defined(CONFIG_STM32_SDIO)
+# define GPIO_TIM8_CH4OUT GPIO_TIM8_CH4OUT_1
+#endif
+
+/* CAN
+ *
+ * Connector 10 (CN10) is DB-9 male connector that can be used with CAN1 or CAN2.
+ *
+ * JP10 connects CAN1_RX or CAN2_RX to the CAN transceiver
+ * JP3 connects CAN1_TX or CAN2_TX to the CAN transceiver
+ *
+ * CAN signals are then available on CN10 pins:
+ *
+ * CN10 Pin 7 = CANH
+ * CN10 Pin 2 = CANL
+ *
+ * Mapping to STM32 GPIO pins:
+ *
+ * PD0 = FSMC_D2 & CAN1_RX
+ * PD1 = FSMC_D3 & CAN1_TX
+ * PB13 = ULPI_D6 & CAN2_TX
+ * PB5 = ULPI_D7 & CAN2_RX
+ */
+
+#define GPIO_CAN1_RX GPIO_CAN1_RX_3
+#define GPIO_CAN1_TX GPIO_CAN1_TX_3
+
+#define GPIO_CAN2_RX GPIO_CAN2_RX_2
+#define GPIO_CAN2_TX GPIO_CAN2_TX_1
+
+/* I2C. Only I2C1 is available on the STM3240G-EVAL. I2C1_SCL and I2C1_SDA are
+ * available on the following pins:
+ *
+ * - PB6 is I2C1_SCL
+ * - PB9 is I2C1_SDA
+ */
+
+#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
+#define GPIO_I2C1_SDA GPIO_I2C1_SDA_2
+
+/* DMA Channl/Stream Selections *****************************************************/
+/* Stream selections are arbitrary for now but might become important in the future
+ * is we set aside more DMA channels/streams.
+ *
+ * SDIO DMA
+ * DMAMAP_SDIO_1 = Channel 4, Stream 3
+ * DMAMAP_SDIO_2 = Channel 4, Stream 6
+ */
+
+#define DMAMAP_SDIO DMAMAP_SDIO_1
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_ledinit, stm32_setled, and stm32_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
+ * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * control the LEDs from user applications.
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void stm32_ledinit(void);
+EXTERN void stm32_setled(int led, bool ledon);
+EXTERN void stm32_setleds(uint8_t ledset);
+#endif
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+/************************************************************************************
+ * Name: stm3240g_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the STM3210E-EVAL board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * dispaly is cleared by simply setting all GRAM memory to the specified color.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+EXTERN void stm3240g_lcdclear(uint16_t color);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/stm3240g-eval/nettest/Make.defs b/nuttx/configs/stm3240g-eval/nettest/Make.defs
new file mode 100644
index 000000000..032bcc48c
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nettest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/nettest/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/nettest/appconfig b/nuttx/configs/stm3240g-eval/nettest/appconfig
new file mode 100644
index 000000000..9ac1cec2e
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nettest/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/nettest/nettest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nettest
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
diff --git a/nuttx/configs/stm3240g-eval/nettest/defconfig b/nuttx/configs/stm3240g-eval/nettest/defconfig
new file mode 100644
index 000000000..3446e8c35
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nettest/defconfig
@@ -0,0 +1,634 @@
+############################################################################
+# configs/stm3240g-eval/nettest/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nettest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=y
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/nettest/setenv.sh b/nuttx/configs/stm3240g-eval/nettest/setenv.sh
new file mode 100755
index 000000000..2d3414d27
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nettest/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/nettest/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/nsh/Make.defs b/nuttx/configs/stm3240g-eval/nsh/Make.defs
new file mode 100644
index 000000000..dd928ff35
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/nsh/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/nsh/appconfig b/nuttx/configs/stm3240g-eval/nsh/appconfig
new file mode 100644
index 000000000..fdef72ccd
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh/appconfig
@@ -0,0 +1,102 @@
+############################################################################
+# configs/stm3240g-eval/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
+
+ifeq ($(CONFIG_INPUT_STMPE811),y)
+CONFIGURED_APPS += examples/touchscreen
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+# Uncomment to select a graphics example
+
+ifeq ($(CONFIG_NX),y)
+#CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nximage
+#CONFIGURED_APPS += examples/nxlines
+endif
diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig
new file mode 100644
index 000000000..03f4d3c0f
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh/defconfig
@@ -0,0 +1,843 @@
+############################################################################
+# configs/stm3240g-eval/nsh/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3240G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F407IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_INPUT=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=n
+CONFIG_INPUT_TSC2007=n
+
+#
+# STMPE811 input device configuration
+#
+# Prerequisites: CONFIG_INPUT=y
+# Other settings that effect the driver: CONFIG_DISABLE_POLL
+#
+CONFIG_INPUT_STMPE811=n
+CONFIG_STMPE811_SPI=n
+CONFIG_STMPE811_I2C=y
+CONFIG_STMPE811_MULTIPLE=y
+CONFIG_STMPE811_ACTIVELOW=y
+CONFIG_STMPE811_EDGE=y
+#CONFIG_STMPE811_NPOLLWAITERS
+CONFIG_STMPE811_TSC_DISABLE=n
+CONFIG_STMPE811_ADC_DISABLE=y
+CONFIG_STMPE811_GPIO_DISABLE=y
+CONFIG_STMPE811_GPIOINT_DISABLE=y
+CONFIG_STMPE811_SWAPXY=y
+CONFIG_STMPE811_TEMP_DISABLE=y
+CONFIG_STMPE811_REGDEBUG=n
+CONFIG_STMPE811_THRESHX=26
+CONFIG_STMPE811_THRESHY=34
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3240G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+
+#
+# STM3240G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/nsh/setenv.sh b/nuttx/configs/stm3240g-eval/nsh/setenv.sh
new file mode 100755
index 000000000..4d92d6bbf
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/nsh/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/nsh2/Make.defs b/nuttx/configs/stm3240g-eval/nsh2/Make.defs
new file mode 100644
index 000000000..f2a9daf34
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh2/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/nsh2/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/nsh2/appconfig b/nuttx/configs/stm3240g-eval/nsh2/appconfig
new file mode 100644
index 000000000..e44a5e5da
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh2/appconfig
@@ -0,0 +1,89 @@
+############################################################################
+# configs/stm3240g-eval/nsh2/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
diff --git a/nuttx/configs/stm3240g-eval/nsh2/defconfig b/nuttx/configs/stm3240g-eval/nsh2/defconfig
new file mode 100644
index 000000000..d0e628cc4
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh2/defconfig
@@ -0,0 +1,699 @@
+############################################################################
+# configs/stm3240g-eval/nsh2/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=y
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+CONFIG_STM32_CCMEXCLUDE=y
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=y
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=y
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3240G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F407IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_DMA=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=y
+CONFIG_RAMLOG=y
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=y
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=n
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=16
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=y
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=n
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/nsh2/setenv.sh b/nuttx/configs/stm3240g-eval/nsh2/setenv.sh
new file mode 100755
index 000000000..944f77734
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nsh2/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/nxconsole/Make.defs b/nuttx/configs/stm3240g-eval/nxconsole/Make.defs
new file mode 100644
index 000000000..49a50f9db
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxconsole/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/nxconsole/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/nxconsole/appconfig b/nuttx/configs/stm3240g-eval/nxconsole/appconfig
new file mode 100644
index 000000000..4c35b000a
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxconsole/appconfig
@@ -0,0 +1,99 @@
+############################################################################
+# configs/stm3240g-eval/nxconsole/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxconsole
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+# Uncomment netutils/ftpc to include an FTP client library
+# Uncomment netutils/ftpd to include an FTP server library
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+#CONFIGURED_APPS += netutils/ftpc
+#CONFIGURED_APPS += netutils/ftpd
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CONFIGURED_APPS += examples/can
+endif
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
+
+# Uncomment examples/ftpc to include the FTP client example
+# Uncomment examples/ftpd to include the FTP daemon example
+
+ifeq ($(CONFIG_NET),y)
+#CONFIGURED_APPS += examples/ftpc
+#CONFIGURED_APPS += examples/ftpd
+endif
+
+# Uncomment to select a graphics examples
+
+ifeq ($(CONFIG_NX),y)
+#CONFIGURED_APPS += examples/nx
+#CONFIGURED_APPS += examples/nxhello
+#CONFIGURED_APPS += examples/nximage
+#CONFIGURED_APPS += examples/nxlines
+endif
+
diff --git a/nuttx/configs/stm3240g-eval/nxconsole/defconfig b/nuttx/configs/stm3240g-eval/nxconsole/defconfig
new file mode 100644
index 000000000..dc3ba7ced
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxconsole/defconfig
@@ -0,0 +1,806 @@
+############################################################################
+# configs/stm3240g-eval/nxconsole/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3240G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F407IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=3
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=27
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=8
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=y
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=n
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=n
+CONFIG_NXFONT_SANS22X29B=n
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=y
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3240G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=y
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=n
+
+#
+# STM3240G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=y
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/nxconsole/setenv.sh b/nuttx/configs/stm3240g-eval/nxconsole/setenv.sh
new file mode 100755
index 000000000..a42950836
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxconsole/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/nxconsole/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/nxwm/Make.defs b/nuttx/configs/stm3240g-eval/nxwm/Make.defs
new file mode 100644
index 000000000..2fdbf70a1
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxwm/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/nxwm/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/nxwm/appconfig b/nuttx/configs/stm3240g-eval/nxwm/appconfig
new file mode 100644
index 000000000..6a5864fb1
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxwm/appconfig
@@ -0,0 +1,53 @@
+############################################################################
+# configs/stm3240g-eval/nxwm/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# The NSH Library -- NOTE: The NxWM unit test must be installed at
+# apps/external in order to build this example. See
+# NxWidgets/UnitTests/README.txt for additional information
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking libraries.
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/webclient
+CONFIGURED_APPS += netutils/tftpc
+ifeq ($(CONFIG_NSH_TELNET),y)
+CONFIGURED_APPS += netutils/telnetd
+endif
+endif
diff --git a/nuttx/configs/stm3240g-eval/nxwm/defconfig b/nuttx/configs/stm3240g-eval/nxwm/defconfig
new file mode 100644
index 000000000..2ace5113d
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxwm/defconfig
@@ -0,0 +1,876 @@
+############################################################################
+# configs/stm3240g-eval/nxwm/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=n
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3240G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F407IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxwm_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_INPUT=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+CONFIG_SCHED_ONEXIT=y
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=12
+CONFIG_NFILE_STREAMS=12
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=32
+CONFIG_MQ_MAXMSGSIZE=48
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_TSC2007=n
+
+#
+# STMPE811 input device configuration
+#
+# Prerequisites: CONFIG_INPUT=y
+# Other settings that effect the driver: CONFIG_DISABLE_POLL
+#
+CONFIG_INPUT_STMPE811=y
+CONFIG_STMPE811_SPI=n
+CONFIG_STMPE811_I2C=y
+CONFIG_STMPE811_MULTIPLE=y
+CONFIG_STMPE811_ACTIVELOW=y
+CONFIG_STMPE811_EDGE=y
+#CONFIG_STMPE811_NPOLLWAITERS
+CONFIG_STMPE811_TSC_DISABLE=n
+CONFIG_STMPE811_ADC_DISABLE=y
+CONFIG_STMPE811_GPIO_DISABLE=y
+CONFIG_STMPE811_GPIOINT_DISABLE=y
+CONFIG_STMPE811_SWAPXY=n
+CONFIG_STMPE811_TEMP_DISABLE=y
+CONFIG_STMPE811_REGDEBUG=n
+CONFIG_STMPE811_THRESHX=39
+CONFIG_STMPE811_THRESHY=51
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=y
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0x5cb7
+CONFIG_NXTK_BORDERCOLOR2=0x21c9
+CONFIG_NXTK_BORDERCOLOR3=0xffdf
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=n
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=n
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxWidgets / NxWM
+#
+# Use all defaults except
+# 1. 16 bits-per-pixel
+# 2. Make the NxWidgets background color match the NxWM back color
+# 3. Build in support for keyboard input in NxConsole
+# 4. Taskbar on the left
+# 5. We do have a touchscreen
+# 6. We do want the NxWM keybard listener
+# 7. Use a larger font with the calculator
+#
+CONFIG_NXWIDGETS_BPP=16
+CONFIG_NXWIDGETS_SERVERSTACK=2048
+CONFIG_NXWIDGETS_LISTENERSTACK=2048
+CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215)
+CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241)
+CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73)
+
+CONFIG_NXCONSOLE_NXKBDIN=y
+
+CONFIG_NXWM_TASKBAR_LEFT=y
+CONFIG_NXWM_NXCONSOLE_STACKSIZE=2048
+CONFIG_NXWM_TASKBAR_VSPACING=4
+CONFIG_NXWM_UNITTEST=y
+CONFIG_NXWM_TOUCHSCREEN=y
+CONFIG_NXWM_KEYBOARD=y
+CONFIG_NXWM_HEXCALCULATOR_FONTID=5
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=y
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=325
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3240G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=y
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=n
+
+#
+# STM3240G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=y
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=n
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/nxwm/setenv.sh b/nuttx/configs/stm3240g-eval/nxwm/setenv.sh
new file mode 100755
index 000000000..a8ff5bb04
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/nxwm/setenv.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# configs/stm3240g-eval/nxwm/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/ostest/Make.defs b/nuttx/configs/stm3240g-eval/ostest/Make.defs
new file mode 100644
index 000000000..46d35b897
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/ostest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/ostest/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/ostest/appconfig b/nuttx/configs/stm3240g-eval/ostest/appconfig
new file mode 100644
index 000000000..7d35fd121
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm3240g-eval/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/stm3240g-eval/ostest/defconfig b/nuttx/configs/stm3240g-eval/ostest/defconfig
new file mode 100644
index 000000000..449a143a5
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/ostest/defconfig
@@ -0,0 +1,734 @@
+############################################################################
+# configs/stm3240g-eval/ostest/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=n
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM3240xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=n
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxWidgets
+CONFIG_NXWIDGETS_BPP=16
+CONFIG_NXWIDGETS_DEFAULT_FONTID=5
+
+#
+# STM3240G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+
+#
+# STM3240G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=2
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=2
+CONFIG_EXAMPLE_BUTTONS_NAME0="Key/Select"
+CONFIG_EXAMPLE_BUTTONS_NAME1="Left/Right"
+CONFIG_EXAMPLE_BUTTONS_NAME2="Up/Down"
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/ostest/setenv.sh b/nuttx/configs/stm3240g-eval/ostest/setenv.sh
new file mode 100755
index 000000000..29786ec2f
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/ostest/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/ostest/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/scripts/ld.script b/nuttx/configs/stm3240g-eval/scripts/ld.script
new file mode 100644
index 000000000..078f2890f
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/scripts/ld.script
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/stm3240g-eval/scripts/ld.script
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 192Kb of SRAM. SRAM is split up into three blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ * 3) 64Kb of CCM SRAM beginning at address 0x1000:0000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm3240g-eval/src/Makefile b/nuttx/configs/stm3240g-eval/src/Makefile
new file mode 100644
index 000000000..80225ea1f
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/Makefile
@@ -0,0 +1,135 @@
+############################################################################
+# configs/stm3240g-eval/src/Makefile
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_spi.c
+
+ifeq ($(CONFIG_HAVE_CXX),y)
+CSRCS += up_cxxinitialize.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_autoleds.c
+else
+CSRCS += up_userleds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_STM32_OTGFS),y)
+CSRCS += up_usb.c
+endif
+
+ifeq ($(CONFIG_STM32_FSMC),y)
+CSRCS += up_lcd.c up_selectlcd.c up_deselectlcd.c up_selectsram.c up_deselectsram.c up_extmem.c
+endif
+
+ifeq ($(CONFIG_ADC),y)
+CSRCS += up_adc.c
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CSRCS += up_pwm.c
+endif
+
+ifeq ($(CONFIG_CAN),y)
+CSRCS += up_can.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_ARCH_FPU),y)
+CSRCS += up_ostest.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+ifeq ($(CONFIG_INPUT_STMPE811),y)
+CSRCS += up_stmpe811.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h b/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h
new file mode 100644
index 000000000..cef4d2d19
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h
@@ -0,0 +1,373 @@
+/****************************************************************************************************
+ * configs/stm3240g_eval/src/stm3240g_internal.h
+ * arch/arm/src/board/stm3240g_internal.n
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************************************/
+
+#ifndef __CONFIGS_STM3240G_EVAL_SRC_STM3240G_INTERNAL_H
+#define __CONFIGS_STM3240G_EVAL_SRC_STM3240G_INTERNAL_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************************************
+ * Definitions
+ ****************************************************************************************************/
+/* Configuration ************************************************************************************/
+/* How many SPI modules does this chip support? */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 3
+# undef CONFIG_STM32_SPI3
+#endif
+
+/* You can use either CAN1 or CAN2, but you can't use both because they share the same transceiver */
+
+#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2)
+# warning "The STM3250G-EVAL will only support one of CAN1 and CAN2"
+#endif
+
+/* You can't use CAN1 with FSMC:
+ *
+ * PD0 = FSMC_D2 & CAN1_RX
+ * PD1 = FSMC_D3 & CAN1_TX
+ */
+
+#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_FSMC)
+# warning "The STM3250G-EVAL will only support one of CAN1 and FSMC"
+#endif
+
+/* The USB OTG HS ULPI bus is shared with CAN2 bus:
+ *
+ * PB13 = ULPI_D6 & CAN2_TX
+ * PB5 = ULPI_D7 & CAN2_RX
+ */
+
+#if defined(CONFIG_STM32_CAN2) && defined(CONFIG_STM32_OTGHS)
+# warning "The STM3250G-EVAL will only support one of CAN2 and USB OTG HS"
+#endif
+
+/* STM3240G-EVAL GPIOs ******************************************************************************/
+/* LEDs */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN6)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN8)
+#define GPIO_LED3 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTI|GPIO_PIN9)
+#define GPIO_LED4 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN7)
+
+/* BUTTONS -- NOTE that all have EXTI interrupts configured */
+
+#define MIN_IRQBUTTON BUTTON_WAKEUP
+#define MAX_IRQBUTTON BUTTON_USER
+#define NUM_IRQBUTTONS (BUTTON_USER - BUTTON_WAKEUP + 1)
+
+#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN0)
+#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTC|GPIO_PIN13)
+#define GPIO_BTN_USER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTG|GPIO_PIN15)
+
+/* PWM
+ *
+ * The STM3240G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using TIM4, TIM1, or TIM8 (see board.h).
+ * Let's figure out which the user has configured.
+ */
+
+#ifdef CONFIG_PWM
+# if defined(CONFIG_STM32_TIM1_PWM)
+# define STM3240G_EVAL_PWMTIMER 1
+# elif defined(CONFIG_STM32_TIM4_PWM)
+# define STM3240G_EVAL_PWMTIMER 4
+# elif defined(CONFIG_STM32_TIM8_PWM)
+# define STM3240G_EVAL_PWMTIMER 8
+# endif
+#endif
+
+/* USB OTG FS
+ *
+ * PA9 VBUS_FS
+ * PH5 OTG_FS_PowerSwitchOn
+ * PF11 OTG_FS_Overcurrent
+ */
+
+#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
+#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN5)
+
+#ifdef CONFIG_USBHOST
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN11)
+#else
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN11)
+#endif
+
+/* The STM3240G-EVAL has two STMPE811QTR I/O expanders on board both connected
+ * to the STM32 via I2C1. They share a common interrupt line: PI2.
+ *
+ * STMPE811 U24, I2C address 0x41 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- TouchScreen_Y- LCD Connector XL
+ * X- TouchScreen_X- LCD Connector XR
+ * Y+ TouchScreen_Y+ LCD Connector XD
+ * X+ TouchScreen_X+ LCD Connector XU
+ * IN3 EXP_IO9
+ * IN2 EXP_IO10
+ * IN1 EXP_IO11
+ * IN0 EXP_IO12
+ *
+ * STMPE811 U29, I2C address 0x44 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- EXP_IO1
+ * X- EXP_IO2
+ * Y+ EXP_IO3
+ * X+ EXP_IO4
+ * IN3 EXP_IO5
+ * IN2 EXP_IO6
+ * IN1 EXP_IO7
+ * IN0 EXP_IO8
+ */
+
+#define STMPE811_ADDR1 0x41
+#define STMPE811_ADDR2 0x44
+
+#define GPIO_IO_EXPANDER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTI|GPIO_PIN2)
+
+/* GPIO settings that will be altered when external memory is selected:
+ *
+ * ----- ------- -------- ------------ ------- ------------ -------- ----------- -------- -------------
+ * PB7: FSMC NL PD0-1: FSMC D2-D3 PE0: FSMC NBL0 PF0-5: FSMC A0-A5 PG0-5: FSMC A10-A15
+ * PD3: FSMC CLK PE1: FSMC BLN1 PF6: FSMC NIORD PG6-7: FSMC INT2-3
+ * PD4: FSMC NOE PE2: FSMC A23 PF7: FSMC NREG PG9: FSMC NCE3
+ * PD5: FSMC NWE PE3-6: FSMC A19-A22 PF8: FSMC NIOWR PG9-10: FSMC NE2-3
+ * PD6: FSMC NWAIT PE7-15: FSMC D4-D12 PF9: FSMC CD PG10: FSMC NCE4 (1)
+ * PD7: FSMC NE1 PF10: FSMC INTR PG11: FSMC NCE4 (2)
+ * PD7: FSMC NCE2 PF12-15: FSMC A6-A9 PG12: FSMC NE4
+ * PD8-10: FSMC D13-D15 PG13-14: FSMC A24-A25
+ * PD11-13: FSMC_A16-A18
+ * PD14-15: FSMC D0-D1
+ */
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public data
+ ****************************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3240G-EVAL board.
+ *
+ ****************************************************************************************************/
+
+void weak_function stm32_spiinitialize(void);
+
+/****************************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related GPIO pins for
+ * the STM3240G-EVAL board.
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_OTGFS
+void weak_function stm32_usbinitialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality. This function will
+ * start a thread that will monitor for device connection/disconnection events.
+ *
+ ****************************************************************************************************/
+
+#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
+int stm32_usbhost_initialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for external memory usage
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemgpios(const uint32_t *gpios, int ngpios);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemaddr
+ *
+ * Description:
+ * Initialize adress line GPIOs for external memory access
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemaddr(int naddrs);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemdata
+ *
+ * Description:
+ * Initialize data line GPIOs for external memory access
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemdata(int ndata);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_enablefsmc(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_disablefsmc(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_selectsram
+ *
+ * Description:
+ * Initialize to access external SRAM. SRAM will be visible at the FSMC Bank
+ * NOR/SRAM2 base address (0x64000000)
+ *
+ * General transaction rules. The requested AHB transaction data size can be 8-,
+ * 16- or 32-bit wide whereas the SRAM has a fixed 16-bit data width. Some simple
+ * transaction rules must be followed:
+ *
+ * Case 1: AHB transaction width and SRAM data width are equal
+ * There is no issue in this case.
+ * Case 2: AHB transaction size is greater than the memory size
+ * In this case, the FSMC splits the AHB transaction into smaller consecutive
+ * memory accesses in order to meet the external data width.
+ * Case 3: AHB transaction size is smaller than the memory size.
+ * SRAM supports the byte select feature.
+ * a) FSMC allows write transactions accessing the right data through its
+ * byte lanes (NBL[1:0])
+ * b) Read transactions are allowed (the controller reads the entire memory
+ * word and uses the needed byte only). The NBL[1:0] are always kept low
+ * during read transactions.
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_selectsram(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_deselectsram
+ *
+ * Description:
+ * Disable SRAM
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_deselectsram(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_selectlcd(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_deselectlcd(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_STM3240G_EVAL_SRC_STM3240G_INTERNAL_H */
diff --git a/nuttx/configs/stm3240g-eval/src/up_adc.c b/nuttx/configs/stm3240g-eval/src/up_adc.c
new file mode 100644
index 000000000..e42651761
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_adc.c
@@ -0,0 +1,168 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_adc.c
+ * arch/arm/src/board/up_adc.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/analog/adc.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_pwm.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_ADC
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Configuration ************************************************************/
+/* Up to 3 ADC interfaces are supported */
+
+#if STM32_NADC < 3
+# undef CONFIG_STM32_ADC3
+#endif
+
+#if STM32_NADC < 2
+# undef CONFIG_STM32_ADC2
+#endif
+
+#if STM32_NADC < 1
+# undef CONFIG_STM32_ADC1
+#endif
+
+#if defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2) || defined(CONFIG_STM32_ADC3)
+#ifndef CONFIG_STM32_ADC3
+# warning "Channel information only available for ADC3"
+#endif
+
+/* The number of ADC channels in the conversion list */
+
+#define ADC3_NCHANNELS 1
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+/* The STM3240G-EVAL has a 10 Kohm potentiometer RV1 connected to PF9 of
+ * STM32F407IGH6 on the board: TIM14_CH1/FSMC_CD/ADC3_IN7
+ */
+
+/* Identifying number of each ADC channel: Variable Resistor. */
+
+#ifdef CONFIG_STM32_ADC3
+static const uint8_t g_chanlist[ADC3_NCHANNELS] = {7};
+
+/* Configurations of pins used byte each ADC channels */
+
+static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: adc_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/adc.
+ *
+ ************************************************************************************/
+
+int adc_devinit(void)
+{
+#ifdef CONFIG_STM32_ADC3
+ static bool initialized = false;
+ struct adc_dev_s *adc;
+ int ret;
+ int i;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Configure the pins as analog inputs for the selected channels */
+
+ for (i = 0; i < ADC3_NCHANNELS; i++)
+ {
+ stm32_configgpio(g_pinlist[i]);
+ }
+
+ /* Call stm32_adcinitialize() to get an instance of the ADC interface */
+
+ adc = stm32_adcinitialize(3, g_chanlist, ADC3_NCHANNELS);
+ if (adc == NULL)
+ {
+ adbg("ERROR: Failed to get ADC interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the ADC driver at "/dev/adc0" */
+
+ ret = adc_register("/dev/adc0", adc);
+ if (ret < 0)
+ {
+ adbg("adc_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+#else
+ return -ENOSYS;
+#endif
+}
+
+#endif /* CONFIG_STM32_ADC1 || CONFIG_STM32_ADC2 || CONFIG_STM32_ADC3 */
+#endif /* CONFIG_ADC */ \ No newline at end of file
diff --git a/nuttx/configs/stm3240g-eval/src/up_autoleds.c b/nuttx/configs/stm3240g-eval/src/up_autoleds.c
new file mode 100644
index 000000000..6c2cba455
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_autoleds.c
@@ -0,0 +1,260 @@
+/****************************************************************************
+ * configs/stm3240g_eval/src/up_autoleds.c
+ * arch/arm/src/board/up_autoleds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define STM3210E_LED1 (1 << 0)
+#define STM3210E_LED2 (1 << 1)
+#define STM3210E_LED3 (1 << 2)
+#define STM3210E_LED4 (1 << 3)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+#define LED_STARTED_ON_SETBITS ((STM3210E_LED1) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS ((STM3210E_LED1|STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((STM3210E_LED1|STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS ((STM3210E_LED1) << OFF_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_CLRBITS ((STM3210E_LED2|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_IRQSENABLED_ON_SETBITS ((STM3210E_LED1|STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((STM3210E_LED3|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS ((STM3210E_LED2) << OFF_SETBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_CLRBITS ((STM3210E_LED1|STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_STACKCREATED_ON_SETBITS ((STM3210E_LED3) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((STM3210E_LED1|STM3210E_LED2|STM3210E_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS ((STM3210E_LED1|STM3210E_LED2) << OFF_SETBITS_SHIFT)
+#define LED_STACKCREATED_OFF_CLRBITS ((STM3210E_LED3|STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_INIRQ_ON_SETBITS ((STM3210E_LED1) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((STM3210E_LED1) << OFF_CLRBITS_SHIFT)
+
+#define LED_SIGNAL_ON_SETBITS ((STM3210E_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((STM3210E_LED2) << OFF_CLRBITS_SHIFT)
+
+#define LED_ASSERTION_ON_SETBITS ((STM3210E_LED4) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_PANIC_ON_SETBITS ((STM3210E_LED4) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((STM3210E_LED4) << OFF_CLRBITS_SHIFT)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
+ LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
+
+ (LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
+ LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
+
+ (LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
+ LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
+
+ (LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
+ LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & STM3210E_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & STM3210E_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((clrbits & STM3210E_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, false);
+ }
+
+ if ((clrbits & STM3210E_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, false);
+ }
+}
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & STM3210E_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & STM3210E_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((setbits & STM3210E_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, true);
+ }
+
+ if ((setbits & STM3210E_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, true);
+ }
+}
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3240g-eval/src/up_boot.c b/nuttx/configs/stm3240g-eval/src/up_boot.c
new file mode 100644
index 000000000..518bb4ff7
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_boot.c
@@ -0,0 +1,109 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm3240g-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* If the FSMC is enabled, then enable SRAM access */
+
+#ifdef CONFIG_STM32_FSMC
+ stm32_selectsram();
+#endif
+
+ /* Initialize USB if the 1) OTG FS controller is in the configuration and 2)
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * the weak function stm32_usbinitialize() has been brought into the build.
+ * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected.
+ */
+
+#ifdef CONFIG_STM32_OTGFS
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/stm3240g-eval/src/up_buttons.c b/nuttx/configs/stm3240g-eval/src/up_buttons.c
new file mode 100644
index 000000000..522b8e4d9
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_buttons.c
@@ -0,0 +1,170 @@
+/****************************************************************************
+ * configs/stm3240g-eval/src/up_buttons.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
+ * the BUTTON_* and JOYSTICK_* definitions in board.h
+ */
+
+static const uint16_t g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_USER
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for all pins.
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed for most keys. The exception
+ * is the WAKEUP button.
+ */
+
+ bool released = stm32_gpioread(g_buttons[i]);
+ if (i == BUTTON_WAKEUP)
+ {
+ released = !released;
+ }
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ /* The following should be atomic */
+
+ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
+ {
+ oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/stm3240g-eval/src/up_can.c b/nuttx/configs/stm3240g-eval/src/up_can.c
new file mode 100644
index 000000000..6fcbbb211
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_can.c
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_can.c
+ * arch/arm/src/board/up_can.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/can.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm32_can.h"
+#include "stm3240g-internal.h"
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+
+#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2)
+# warning "Both CAN1 and CAN2 are enabled. Assuming only CAN1."
+# undef CONFIG_STM32_CAN2
+#endif
+
+#ifdef CONFIG_STM32_CAN1
+# define CAN_PORT 1
+#else
+# define CAN_PORT 2
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: can_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/can.
+ *
+ ************************************************************************************/
+
+int can_devinit(void)
+{
+ static bool initialized = false;
+ struct can_dev_s *can;
+ int ret;
+
+ /* Check if we have already initialized */
+
+ if (!initialized)
+ {
+ /* Call stm32_caninitialize() to get an instance of the CAN interface */
+
+ can = stm32_caninitialize(CAN_PORT);
+ if (can == NULL)
+ {
+ candbg("ERROR: Failed to get CAN interface\n");
+ return -ENODEV;
+ }
+
+ /* Register the CAN driver at "/dev/can0" */
+
+ ret = can_register("/dev/can0", can);
+ if (ret < 0)
+ {
+ candbg("ERROR: can_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_CAN && (CONFIG_STM32_CAN1 || CONFIG_STM32_CAN2) */
diff --git a/nuttx/configs/stm3240g-eval/src/up_cxxinitialize.c b/nuttx/configs/stm3240g-eval/src/up_cxxinitialize.c
new file mode 100644
index 000000000..b779c65ff
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_cxxinitialize.c
@@ -0,0 +1,155 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_cxxinitialize.c
+ * arch/arm/src/board/up_cxxinitialize.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include <arch/stm32/chip.h>
+#include "chip.h"
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Debug ****************************************************************************/
+/* Non-standard debug that may be enabled just for testing the static constructors */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_CXX
+#endif
+
+#ifdef CONFIG_DEBUG_CXX
+# define cxxdbg dbg
+# define cxxlldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define cxxvdbg vdbg
+# define cxxllvdbg llvdbg
+# else
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+# endif
+#else
+# define cxxdbg(x...)
+# define cxxlldbg(x...)
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This type defines one entry in initialization array */
+
+typedef void (*initializer_t)(void);
+
+/************************************************************************************
+ * External references
+ ************************************************************************************/
+/* _sinit and _einit are symbols exported by the linker script that mark the
+ * beginning and the end of the C++ initialization section.
+ */
+
+extern initializer_t _sinit;
+extern initializer_t _einit;
+
+/* _stext and _etext are symbols exported by the linker script that mark the
+ * beginning and the end of text.
+ */
+
+extern uint32_t _stext;
+extern uint32_t _etext;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_cxxinitialize
+ *
+ * Description:
+ * If C++ and C++ static constructors are supported, then this function
+ * must be provided by board-specific logic in order to perform
+ * initialization of the static C++ class instances.
+ *
+ * This function should then be called in the application-specific
+ * user_start logic in order to perform the C++ initialization. NOTE
+ * that no component of the core NuttX RTOS logic is involved; This
+ * function defintion only provides the 'contract' between application
+ * specific C++ code and platform-specific toolchain support
+ *
+ ***************************************************************************/
+
+void up_cxxinitialize(void)
+{
+ initializer_t *initp;
+
+ cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
+ &_sinit, &_einit, &_stext, &_etext);
+
+ /* Visit each entry in the initialzation table */
+
+ for (initp = &_sinit; initp != &_einit; initp++)
+ {
+ initializer_t initializer = *initp;
+ cxxdbg("initp: %p initializer: %p\n", initp, initializer);
+
+ /* Make sure that the address is non-NULL and lies in the text region
+ * defined by the linker script. Some toolchains may put NULL values
+ * or counts in the initialization table
+ */
+
+ if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
+ {
+ cxxdbg("Calling %p\n", initializer);
+ initializer();
+ }
+ }
+}
+
+#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_deselectlcd.c b/nuttx/configs/stm3240g-eval/src/up_deselectlcd.c
new file mode 100644
index 000000000..93fdd97c4
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_deselectlcd.c
@@ -0,0 +1,98 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_deselectlcd.c
+ * arch/arm/src/board/up_deselectlcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectlcd
+ *
+ * Description:
+ * Disable the LCD
+ *
+ ************************************************************************************/
+
+void stm32_deselectlcd(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(0xffffffff, STM32_FSMC_BCR4);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(0x0fffffff, STM32_FSMC_BTR4);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_deselectsram.c b/nuttx/configs/stm3240g-eval/src/up_deselectsram.c
new file mode 100644
index 000000000..ab01303fb
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_deselectsram.c
@@ -0,0 +1,97 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_deselectsram.c
+ * arch/arm/src/board/up_deselectsram.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "up_arch.h"
+#include "stm32_fsmc.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_deselectsram
+ *
+ * Description:
+ * Disable SRAM
+ *
+ ************************************************************************************/
+
+void stm32_deselectsram(void)
+{
+ /* Restore registers to their power up settings */
+
+ putreg32(FSMC_BCR_RSTVALUE, STM32_FSMC_BCR2);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_RSTVALUE, STM32_FSMC_BTR2);
+
+ /* Disable AHB clocking to the FSMC */
+
+ stm32_disablefsmc();
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_extmem.c b/nuttx/configs/stm3240g-eval/src/up_extmem.c
new file mode 100644
index 000000000..a87c07741
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_extmem.c
@@ -0,0 +1,188 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_extmem.c
+ * arch/arm/src/board/up_extmem.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_fsmc.h"
+#include "stm32_gpio.h"
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# warning "FSMC is not enabled"
+#endif
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+#define STM32_FSMC_NADDRCONFIGS 26
+#define STM32_FSMC_NDATACONFIGS 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/* GPIO configurations common to most external memories */
+
+static const uint32_t g_addressconfig[STM32_FSMC_NADDRCONFIGS] =
+{
+ GPIO_FSMC_A0, GPIO_FSMC_A1 , GPIO_FSMC_A2, GPIO_FSMC_A3, GPIO_FSMC_A4 , GPIO_FSMC_A5,
+ GPIO_FSMC_A6, GPIO_FSMC_A7, GPIO_FSMC_A8, GPIO_FSMC_A9, GPIO_FSMC_A10, GPIO_FSMC_A11,
+ GPIO_FSMC_A12, GPIO_FSMC_A13, GPIO_FSMC_A14, GPIO_FSMC_A15, GPIO_FSMC_A16, GPIO_FSMC_A17,
+ GPIO_FSMC_A18, GPIO_FSMC_A19, GPIO_FSMC_A20, GPIO_FSMC_A21, GPIO_FSMC_A22, GPIO_FSMC_A23,
+ GPIO_FSMC_A24, GPIO_FSMC_A25
+};
+
+static const uint32_t g_dataconfig[STM32_FSMC_NDATACONFIGS] =
+{
+ GPIO_FSMC_D0, GPIO_FSMC_D1 , GPIO_FSMC_D2, GPIO_FSMC_D3, GPIO_FSMC_D4 , GPIO_FSMC_D5,
+ GPIO_FSMC_D6, GPIO_FSMC_D7, GPIO_FSMC_D8, GPIO_FSMC_D9, GPIO_FSMC_D10, GPIO_FSMC_D11,
+ GPIO_FSMC_D12, GPIO_FSMC_D13, GPIO_FSMC_D14, GPIO_FSMC_D15
+};
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for external memory usage
+ *
+ ************************************************************************************/
+
+void stm32_extmemgpios(const uint32_t *gpios, int ngpios)
+{
+ int i;
+
+ /* Configure GPIOs */
+
+ for (i = 0; i < ngpios; i++)
+ {
+ stm32_configgpio(gpios[i]);
+ }
+}
+
+/************************************************************************************
+ * Name: stm32_extmemaddr
+ *
+ * Description:
+ * Initialize adress line GPIOs for external memory access
+ *
+ ************************************************************************************/
+
+void stm32_extmemaddr(int naddrs)
+{
+ stm32_extmemgpios(g_addressconfig, naddrs);
+}
+
+/************************************************************************************
+ * Name: stm32_extmemdata
+ *
+ * Description:
+ * Initialize data line GPIOs for external memory access
+ *
+ ************************************************************************************/
+
+void stm32_extmemdata(int ndata)
+{
+ stm32_extmemgpios(g_dataconfig, ndata);
+}
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_enablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHB3ENR);
+ regval |= RCC_AHB3ENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHB3ENR);
+}
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_disablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Disable AHB clocking to the FSMC */
+
+ regval = getreg32(STM32_RCC_AHB3ENR);
+ regval &= ~RCC_AHB3ENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHB3ENR);
+}
diff --git a/nuttx/configs/stm3240g-eval/src/up_lcd.c b/nuttx/configs/stm3240g-eval/src/up_lcd.c
new file mode 100644
index 000000000..45e4a2b57
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_lcd.c
@@ -0,0 +1,1210 @@
+/**************************************************************************************
+ * configs/stm3240g-eval/src/up_lcd.c
+ * arch/arm/src/board/up_lcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+/* This driver supports the following LCDs on the STM324xG_EVAL board:
+ *
+ * AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) OR
+ * AM-240320D5TOQW01H (LCD_ILI9325)
+ */
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE) || !defined(CONFIG_STM32_ILI9325_DISABLE)
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+/* Configuration **********************************************************************/
+/* CONFIG_STM32_ILI9320_DISABLE may be defined to disabled the AM-240320L8TNQW00H
+ * (LCD_ILI9320 or LCD_ILI9321)
+ * CONFIG_STM32_ILI9325_DISABLE may be defined to disabled the AM-240320D5TOQW01H
+ * (LCD_ILI9325)
+ */
+
+/* Check contrast selection */
+
+#if !defined(CONFIG_LCD_MAXCONTRAST)
+# define CONFIG_LCD_MAXCONTRAST 1
+#endif
+
+/* Check power setting */
+
+#if !defined(CONFIG_LCD_MAXPOWER) || CONFIG_LCD_MAXPOWER < 1
+# define CONFIG_LCD_MAXPOWER 1
+#endif
+
+#if CONFIG_LCD_MAXPOWER > 255
+# error "CONFIG_LCD_MAXPOWER must be less than 256 to fit in uint8_t"
+#endif
+
+/* Check orientation */
+
+#if defined(CONFIG_LCD_PORTRAIT)
+# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) || defined(CONFIG_LCD_RPORTRAIT)
+# error "Cannot define both portrait and any other orientations"
+# endif
+#elif defined(CONFIG_LCD_RPORTRAIT)
+# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
+# error "Cannot define both rportrait and any other orientations"
+# endif
+#elif defined(CONFIG_LCD_LANDSCAPE)
+# ifdef CONFIG_LCD_RLANDSCAPE
+# error "Cannot define both landscape and any other orientations"
+# endif
+#elif !defined(CONFIG_LCD_RLANDSCAPE)
+# define CONFIG_LCD_LANDSCAPE 1
+#endif
+
+/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must
+ * also be enabled.
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+# undef CONFIG_DEBUG_LCD
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_LCD
+#endif
+
+/* Display/Color Properties ***********************************************************/
+/* Display Resolution */
+
+#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
+# define STM3240G_XRES 320
+# define STM3240G_YRES 240
+#else
+# define STM3240G_XRES 240
+# define STM3240G_YRES 320
+#endif
+
+/* Color depth and format */
+
+#define STM3240G_BPP 16
+#define STM3240G_COLORFMT FB_FMT_RGB16_565
+
+/* STM3240G-EVAL LCD Hardware Definitions *********************************************/
+/* LCD /CS is CE4, Bank 3 of NOR/SRAM Bank 1~4 */
+
+#define STM3240G_LCDBASE ((uintptr_t)(0x60000000 | 0x08000000))
+#define LCD ((struct lcd_regs_s *)STM3240G_LCDBASE)
+
+#define LCD_REG_0 0x00
+#define LCD_REG_1 0x01
+#define LCD_REG_2 0x02
+#define LCD_REG_3 0x03
+#define LCD_REG_4 0x04
+#define LCD_REG_5 0x05
+#define LCD_REG_6 0x06
+#define LCD_REG_7 0x07
+#define LCD_REG_8 0x08
+#define LCD_REG_9 0x09
+#define LCD_REG_10 0x0a
+#define LCD_REG_12 0x0c
+#define LCD_REG_13 0x0d
+#define LCD_REG_14 0x0e
+#define LCD_REG_15 0x0f
+#define LCD_REG_16 0x10
+#define LCD_REG_17 0x11
+#define LCD_REG_18 0x12
+#define LCD_REG_19 0x13
+#define LCD_REG_20 0x14
+#define LCD_REG_21 0x15
+#define LCD_REG_22 0x16
+#define LCD_REG_23 0x17
+#define LCD_REG_24 0x18
+#define LCD_REG_25 0x19
+#define LCD_REG_26 0x1a
+#define LCD_REG_27 0x1b
+#define LCD_REG_28 0x1c
+#define LCD_REG_29 0x1d
+#define LCD_REG_30 0x1e
+#define LCD_REG_31 0x1f
+#define LCD_REG_32 0x20
+#define LCD_REG_33 0x21
+#define LCD_REG_34 0x22
+#define LCD_REG_36 0x24
+#define LCD_REG_37 0x25
+#define LCD_REG_40 0x28
+#define LCD_REG_41 0x29
+#define LCD_REG_43 0x2b
+#define LCD_REG_45 0x2d
+#define LCD_REG_48 0x30
+#define LCD_REG_49 0x31
+#define LCD_REG_50 0x32
+#define LCD_REG_51 0x33
+#define LCD_REG_52 0x34
+#define LCD_REG_53 0x35
+#define LCD_REG_54 0x36
+#define LCD_REG_55 0x37
+#define LCD_REG_56 0x38
+#define LCD_REG_57 0x39
+#define LCD_REG_58 0x3a
+#define LCD_REG_59 0x3b
+#define LCD_REG_60 0x3c
+#define LCD_REG_61 0x3d
+#define LCD_REG_62 0x3e
+#define LCD_REG_63 0x3f
+#define LCD_REG_64 0x40
+#define LCD_REG_65 0x41
+#define LCD_REG_66 0x42
+#define LCD_REG_67 0x43
+#define LCD_REG_68 0x44
+#define LCD_REG_69 0x45
+#define LCD_REG_70 0x46
+#define LCD_REG_71 0x47
+#define LCD_REG_72 0x48
+#define LCD_REG_73 0x49
+#define LCD_REG_74 0x4a
+#define LCD_REG_75 0x4b
+#define LCD_REG_76 0x4c
+#define LCD_REG_77 0x4d
+#define LCD_REG_78 0x4e
+#define LCD_REG_79 0x4f
+#define LCD_REG_80 0x50
+#define LCD_REG_81 0x51
+#define LCD_REG_82 0x52
+#define LCD_REG_83 0x53
+#define LCD_REG_96 0x60
+#define LCD_REG_97 0x61
+#define LCD_REG_106 0x6a
+#define LCD_REG_118 0x76
+#define LCD_REG_128 0x80
+#define LCD_REG_129 0x81
+#define LCD_REG_130 0x82
+#define LCD_REG_131 0x83
+#define LCD_REG_132 0x84
+#define LCD_REG_133 0x85
+#define LCD_REG_134 0x86
+#define LCD_REG_135 0x87
+#define LCD_REG_136 0x88
+#define LCD_REG_137 0x89
+#define LCD_REG_139 0x8b
+#define LCD_REG_140 0x8c
+#define LCD_REG_141 0x8d
+#define LCD_REG_143 0x8f
+#define LCD_REG_144 0x90
+#define LCD_REG_145 0x91
+#define LCD_REG_146 0x92
+#define LCD_REG_147 0x93
+#define LCD_REG_148 0x94
+#define LCD_REG_149 0x95
+#define LCD_REG_150 0x96
+#define LCD_REG_151 0x97
+#define LCD_REG_152 0x98
+#define LCD_REG_153 0x99
+#define LCD_REG_154 0x9a
+#define LCD_REG_157 0x9d
+#define LCD_REG_164 0xa4
+#define LCD_REG_192 0xc0
+#define LCD_REG_193 0xc1
+#define LCD_REG_229 0xe5
+
+/* LCD IDs */
+
+#define ILI9320_ID 0x9320
+#define ILI9321_ID 0x9321
+#define ILI9325_ID 0x9325
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg dbg
+# define lcdvdbg vdbg
+#else
+# define lcddbg(x...)
+# define lcdvdbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/* LCD type */
+
+enum lcd_type_e
+{
+ LCD_TYPE_UNKNOWN = 0,
+ LCD_TYPE_ILI9320,
+ LCD_TYPE_ILI9325
+};
+
+/* This structure describes the LCD registers */
+
+struct lcd_regs_s
+{
+ volatile uint16_t address;
+ volatile uint16_t value;
+};
+
+/* This structure describes the state of this driver */
+
+struct stm3240g_dev_s
+{
+ /* Publically visible device structure */
+
+ struct lcd_dev_s dev;
+
+ /* Private LCD-specific information follows */
+
+ uint8_t type; /* LCD type. See enum lcd_type_e */
+ uint8_t power; /* Current power setting */
+};
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+/* Low Level LCD access */
+
+static void stm3240g_writereg(uint8_t regaddr, uint16_t regval);
+static uint16_t stm3240g_readreg(uint8_t regaddr);
+static inline void stm3240g_gramselect(void);
+static inline void stm3240g_writegram(uint16_t rgbval);
+static void stm3240g_readnosetup(FAR uint16_t *accum);
+static uint16_t stm3240g_readnoshift(FAR uint16_t *accum);
+static void stm3240g_setcursor(uint16_t col, uint16_t row);
+
+/* LCD Data Transfer Methods */
+
+static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels);
+static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels);
+
+/* LCD Configuration */
+
+static int stm3240g_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo);
+static int stm3240g_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo);
+
+/* LCD RGB Mapping */
+
+#ifdef CONFIG_FB_CMAP
+# error "RGB color mapping not supported by this driver"
+#endif
+
+/* Cursor Controls */
+
+#ifdef CONFIG_FB_HWCURSOR
+# error "Cursor control not supported by this driver"
+#endif
+
+/* LCD Specific Controls */
+
+static int stm3240g_getpower(struct lcd_dev_s *dev);
+static int stm3240g_setpower(struct lcd_dev_s *dev, int power);
+static int stm3240g_getcontrast(struct lcd_dev_s *dev);
+static int stm3240g_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
+
+/* Initialization */
+
+static inline void stm3240g_lcdinitialize(void);
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+
+/* This is working memory allocated by the LCD driver for each LCD device
+ * and for each color plane. This memory will hold one raster line of data.
+ * The size of the allocated run buffer must therefore be at least
+ * (bpp * xres / 8). Actual alignment of the buffer must conform to the
+ * bitwidth of the underlying pixel type.
+ *
+ * If there are multiple planes, they may share the same working buffer
+ * because different planes will not be operate on concurrently. However,
+ * if there are multiple LCD devices, they must each have unique run buffers.
+ */
+
+static uint16_t g_runbuffer[STM3240G_XRES];
+
+/* This structure describes the overall LCD video controller */
+
+static const struct fb_videoinfo_s g_videoinfo =
+{
+ .fmt = STM3240G_COLORFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */
+ .xres = STM3240G_XRES, /* Horizontal resolution in pixel columns */
+ .yres = STM3240G_YRES, /* Vertical resolution in pixel rows */
+ .nplanes = 1, /* Number of color planes supported */
+};
+
+/* This is the standard, NuttX Plane information object */
+
+static const struct lcd_planeinfo_s g_planeinfo =
+{
+ .putrun = stm3240g_putrun, /* Put a run into LCD memory */
+ .getrun = stm3240g_getrun, /* Get a run from LCD memory */
+ .buffer = (uint8_t*)g_runbuffer, /* Run scratch buffer */
+ .bpp = STM3240G_BPP, /* Bits-per-pixel */
+};
+
+/* This is the standard, NuttX LCD driver object */
+
+static struct stm3240g_dev_s g_lcddev =
+{
+ .dev =
+ {
+ /* LCD Configuration */
+
+ .getvideoinfo = stm3240g_getvideoinfo,
+ .getplaneinfo = stm3240g_getplaneinfo,
+
+ /* LCD RGB Mapping -- Not supported */
+ /* Cursor Controls -- Not supported */
+
+ /* LCD Specific Controls */
+
+ .getpower = stm3240g_getpower,
+ .setpower = stm3240g_setpower,
+ .getcontrast = stm3240g_getcontrast,
+ .setcontrast = stm3240g_setcontrast,
+ },
+};
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: stm3240g_writereg
+ *
+ * Description:
+ * Write to an LCD register
+ *
+ **************************************************************************************/
+
+static void stm3240g_writereg(uint8_t regaddr, uint16_t regval)
+{
+ /* Write the register address then write the register value */
+
+ LCD->address = regaddr;
+ LCD->value = regval;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_readreg
+ *
+ * Description:
+ * Read from an LCD register
+ *
+ **************************************************************************************/
+
+static uint16_t stm3240g_readreg(uint8_t regaddr)
+{
+ /* Write the register address then read the register value */
+
+ LCD->address = regaddr;
+ return LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_gramselect
+ *
+ * Description:
+ * Setup to read or write multiple pixels to the GRAM memory
+ *
+ **************************************************************************************/
+
+static inline void stm3240g_gramselect(void)
+{
+ LCD->address = LCD_REG_34;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_writegram
+ *
+ * Description:
+ * Write one pixel to the GRAM memory
+ *
+ **************************************************************************************/
+
+static inline void stm3240g_writegram(uint16_t rgbval)
+{
+ /* Write the value (GRAM register already selected) */
+
+ LCD->value = rgbval;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_readnosetup
+ *
+ * Description:
+ * Prime the operation by reading one pixel from the GRAM memory if necessary for
+ * this LCD type. When reading 16-bit gram data, there may be some shifts in the
+ * returned data:
+ *
+ * - ILI932x: Discard first dummy read; no shift in the return data
+ *
+ **************************************************************************************/
+
+static void stm3240g_readnosetup(FAR uint16_t *accum)
+{
+ /* Read-ahead one pixel */
+
+ *accum = LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_readnoshift
+ *
+ * Description:
+ * Read one correctly aligned pixel from the GRAM memory. Possibly shifting the
+ * data and possibly swapping red and green components.
+ *
+ * - ILI932x: Unknown -- assuming colors are in the color order
+ *
+ **************************************************************************************/
+
+static uint16_t stm3240g_readnoshift(FAR uint16_t *accum)
+{
+ /* Read the value (GRAM register already selected) */
+
+ return LCD->value;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_setcursor
+ *
+ * Description:
+ * Set the cursor position. In landscape mode, the "column" is actually the physical
+ * Y position and the "row" is the physical X position.
+ *
+ **************************************************************************************/
+
+static void stm3240g_setcursor(uint16_t col, uint16_t row)
+{
+ stm3240g_writereg(LCD_REG_32, row); /* GRAM horizontal address */
+ stm3240g_writereg(LCD_REG_33, col); /* GRAM vertical address */
+}
+
+/**************************************************************************************
+ * Name: stm3240g_dumprun
+ *
+ * Description:
+ * Dump the contexts of the run buffer:
+ *
+ * run - The buffer in containing the run read to be dumped
+ * npixels - The number of pixels to dump
+ *
+ **************************************************************************************/
+
+#if 0 /* Sometimes useful */
+static void stm3240g_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels)
+{
+ int i, j;
+
+ lib_rawprintf("\n%s:\n", msg);
+ for (i = 0; i < npixels; i += 16)
+ {
+ up_putc(' ');
+ lib_rawprintf(" ");
+ for (j = 0; j < 16; j++)
+ {
+ lib_rawprintf(" %04x", *run++);
+ }
+ up_putc('\n');
+ }
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm3240g_putrun
+ *
+ * Description:
+ * This method can be used to write a partial raster line to the LCD:
+ *
+ * row - Starting row to write to (range: 0 <= row < yres)
+ * col - Starting column to write to (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer containing the run to be written to the LCD
+ * npixels - The number of pixels to write to the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
+ size_t npixels)
+{
+ FAR const uint16_t *src = (FAR const uint16_t*)buffer;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Write the run to GRAM. */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+ /* Convert coordinates -- Here the edge away from the row of buttons on
+ * the STM3240G-EVAL is used as the top.
+ */
+
+ /* Write the GRAM data, manually incrementing X */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3240g_setcursor(col, row);
+ stm3240g_gramselect();
+ stm3240g_writegram(*src++);
+
+ /* Increment to next column */
+
+ col++;
+ }
+#elif defined(CONFIG_LCD_RLANDSCAPE)
+ /* Convert coordinates -- Here the edge next to the row of buttons on
+ * the STM3240G-EVAL is used as the top.
+ */
+
+ col = (STM3240G_XRES-1) - col;
+ row = (STM3240G_YRES-1) - row;
+
+ /* Set the cursor position */
+
+ stm3240g_setcursor(col, row);
+
+ /* Then write the GRAM data, auto-decrementing X */
+
+ stm3240g_gramselect();
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position (auto-decrements to the next column) */
+
+ stm3240g_writegram(*src++);
+ }
+#elif defined(CONFIG_LCD_PORTRAIT)
+ /* Convert coordinates. In this configuration, the top of the display is to the left
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ col = (STM3240G_XRES-1) - col;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3240g_setcursor(row, col);
+ stm3240g_gramselect();
+ stm3240g_writegram(*src++);
+
+ /* Increment to next column */
+
+ col--;
+ }
+#else /* CONFIG_LCD_RPORTRAIT */
+ /* Convert coordinates. In this configuration, the top of the display is to the right
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ row = (STM3240G_YRES-1) - row;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3240g_setcursor(row, col);
+ stm3240g_gramselect();
+ stm3240g_writegram(*src++);
+
+ /* Decrement to next column */
+
+ col++;
+ }
+#endif
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_getrun
+ *
+ * Description:
+ * This method can be used to read a partial raster line from the LCD:
+ *
+ * row - Starting row to read from (range: 0 <= row < yres)
+ * col - Starting column to read read (range: 0 <= col <= xres-npixels)
+ * buffer - The buffer in which to return the run read from the LCD
+ * npixels - The number of pixels to read from the LCD
+ * (range: 0 < npixels <= xres-col)
+ *
+ **************************************************************************************/
+
+static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
+ size_t npixels)
+{
+ FAR uint16_t *dest = (FAR uint16_t*)buffer;
+ void (*readsetup)(FAR uint16_t *accum);
+ uint16_t (*readgram)(FAR uint16_t *accum);
+ uint16_t accum;
+ int i;
+
+ /* Buffer must be provided and aligned to a 16-bit address boundary */
+
+ lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
+
+ /* Configure according to the LCD type. Kind of silly with only one LCD type. */
+
+ switch (g_lcddev.type)
+ {
+ case LCD_TYPE_ILI9320:
+ case LCD_TYPE_ILI9325:
+ readsetup = stm3240g_readnosetup;
+ readgram = stm3240g_readnoshift;
+ break;
+
+ default: /* Shouldn't happen */
+ return -ENOSYS;
+ }
+
+ /* Read the run from GRAM. */
+
+#ifdef CONFIG_LCD_LANDSCAPE
+ /* Convert coordinates -- Here the edge away from the row of buttons on
+ * the STM3240G-EVAL is used as the top.
+ */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position */
+
+ stm3240g_setcursor(row, col);
+ stm3240g_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Increment to next column */
+
+ col++;
+ }
+#elif defined(CONFIG_LCD_RLANDSCAPE)
+ /* Convert coordinates -- Here the edge next to the row of buttons on
+ * the STM3240G-EVAL is used as the top.
+ */
+
+ col = (STM3240G_XRES-1) - col;
+ row = (STM3240G_YRES-1) - row;
+
+ /* Set the cursor position */
+
+ stm3240g_setcursor(col, row);
+
+ /* Then read the GRAM data, auto-decrementing Y */
+
+ stm3240g_gramselect();
+
+ /* Prime the pump for unaligned read data */
+
+ readsetup(&accum);
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position (autoincrements to the next row) */
+
+ *dest++ = readgram(&accum);
+ }
+#elif defined(CONFIG_LCD_PORTRAIT)
+ /* Convert coordinates. In this configuration, the top of the display is to the left
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ col = (STM3240G_XRES-1) - col;
+
+ /* Then read the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Read the next pixel from this position */
+
+ stm3240g_setcursor(row, col);
+ stm3240g_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Increment to next column */
+
+ col--;
+ }
+#else /* CONFIG_LCD_RPORTRAIT */
+ /* Convert coordinates. In this configuration, the top of the display is to the right
+ * of the buttons (if the board is held so that the buttons are at the botton of the
+ * board).
+ */
+
+ row = (STM3240G_YRES-1) - row;
+
+ /* Then write the GRAM data, manually incrementing Y (which is col) */
+
+ for (i = 0; i < npixels; i++)
+ {
+ /* Write the next pixel to this position */
+
+ stm3240g_setcursor(row, col);
+ stm3240g_gramselect();
+ readsetup(&accum);
+ *dest++ = readgram(&accum);
+
+ /* Decrement to next column */
+
+ col++;
+ }
+#endif
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_getvideoinfo
+ *
+ * Description:
+ * Get information about the LCD video controller configuration.
+ *
+ **************************************************************************************/
+
+static int stm3240g_getvideoinfo(FAR struct lcd_dev_s *dev,
+ FAR struct fb_videoinfo_s *vinfo)
+{
+ DEBUGASSERT(dev && vinfo);
+ lcdvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
+ g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
+ memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_getplaneinfo
+ *
+ * Description:
+ * Get information about the configuration of each LCD color plane.
+ *
+ **************************************************************************************/
+
+static int stm3240g_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
+ FAR struct lcd_planeinfo_s *pinfo)
+{
+ DEBUGASSERT(dev && pinfo && planeno == 0);
+ lcdvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
+ memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_getpower
+ *
+ * Description:
+ * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3240g_getpower(struct lcd_dev_s *dev)
+{
+ lcdvdbg("power: %d\n", 0);
+ return g_lcddev.power;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_poweroff
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3240g_poweroff(void)
+{
+ /* Turn the display off */
+
+ stm3240g_writereg(LCD_REG_7, 0);
+
+ /* Remember the power off state */
+
+ g_lcddev.power = 0;
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_setpower
+ *
+ * Description:
+ * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On
+ * backlit LCDs, this setting may correspond to the backlight setting.
+ *
+ **************************************************************************************/
+
+static int stm3240g_setpower(struct lcd_dev_s *dev, int power)
+{
+ lcdvdbg("power: %d\n", power);
+ DEBUGASSERT((unsigned)power <= CONFIG_LCD_MAXPOWER);
+
+ /* Set new power level */
+
+ if (power > 0)
+ {
+ /* Then turn the display on */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE) || !defined(CONFIG_STM32_ILI9325_DISABLE)
+ stm3240g_writereg(LCD_REG_7, 0x0173);
+#endif
+ g_lcddev.power = power;
+ }
+ else
+ {
+ /* Turn the display off */
+
+ stm3240g_poweroff();
+ }
+
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_getcontrast
+ *
+ * Description:
+ * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int stm3240g_getcontrast(struct lcd_dev_s *dev)
+{
+ lcdvdbg("Not implemented\n");
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_setcontrast
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static int stm3240g_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
+{
+ lcdvdbg("contrast: %d\n", contrast);
+ return -ENOSYS;
+}
+
+/**************************************************************************************
+ * Name: stm3240g_lcdinitialize
+ *
+ * Description:
+ * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST).
+ *
+ **************************************************************************************/
+
+static inline void stm3240g_lcdinitialize(void)
+{
+ uint16_t id;
+
+ /* Check LCD ID */
+
+ id = stm3240g_readreg(LCD_REG_0);
+ lcddbg("LCD ID: %04x\n", id);
+
+ /* Check if the ID is for the STM32_ILI9320 (or ILI9321) or STM32_ILI9325 */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE) && !defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (id == ILI9320_ID || id == ILI9321_ID || id == ILI9325_ID)
+#elif !defined(CONFIG_STM32_ILI9320_DISABLE) && defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (id == ILI9320_ID || id == ILI9321_ID)
+#else /* if defined(CONFIG_STM32_ILI9320_DISABLE) && !defined(CONFIG_STM32_ILI9325_DISABLE)) */
+ if (id == ILI9325_ID)
+#endif
+ {
+ /* Save the LCD type (not actually used at for anything important) */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE)
+# if !defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (id == ILI9325_ID)
+ {
+ g_lcddev.type = LCD_TYPE_ILI9325;
+ }
+ else
+# endif
+ {
+ g_lcddev.type = LCD_TYPE_ILI9320;
+ stm3240g_writereg(LCD_REG_229, 0x8000); /* Set the internal vcore voltage */
+ }
+#else /* if !defined(CONFIG_STM32_ILI9325_DISABLE) */
+ g_lcddev.type = LCD_TYPE_ILI9325;
+#endif
+ lcddbg("LCD type: %d\n", g_lcddev.type);
+
+ /* Start Initial Sequence */
+
+ stm3240g_writereg(LCD_REG_0, 0x0001); /* Start internal OSC. */
+ stm3240g_writereg(LCD_REG_1, 0x0100); /* Set SS and SM bit */
+ stm3240g_writereg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
+ stm3240g_writereg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */
+ //stm3240g_writereg(LCD_REG_3, 0x1018); /* Set GRAM write direction and BGR=1. */
+ stm3240g_writereg(LCD_REG_4, 0x0000); /* Resize register */
+ stm3240g_writereg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
+ stm3240g_writereg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
+ stm3240g_writereg(LCD_REG_10, 0x0000); /* FMARK function */
+ stm3240g_writereg(LCD_REG_12, 0x0000); /* RGB interface setting */
+ stm3240g_writereg(LCD_REG_13, 0x0000); /* Frame marker Position */
+ stm3240g_writereg(LCD_REG_15, 0x0000); /* RGB interface polarity */
+
+ /* Power On sequence */
+
+ stm3240g_writereg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3240g_writereg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ stm3240g_writereg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
+ stm3240g_writereg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
+ up_mdelay(200); /* Dis-charge capacitor power voltage (200ms) */
+
+ stm3240g_writereg(LCD_REG_16, 0x17b0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
+ stm3240g_writereg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
+ up_mdelay(50);
+
+ stm3240g_writereg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
+ up_mdelay(50);
+
+ stm3240g_writereg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
+ stm3240g_writereg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
+ up_mdelay(50);
+
+ stm3240g_writereg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
+ stm3240g_writereg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */
+
+ /* Adjust the Gamma Curve (ILI9320/1) */
+
+#if !defined(CONFIG_STM32_ILI9320_DISABLE)
+# if !defined(CONFIG_STM32_ILI9325_DISABLE)
+ if (g_lcddev.type == LCD_TYPE_ILI9320)
+# endif
+ {
+ stm3240g_writereg(LCD_REG_48, 0x0006);
+ stm3240g_writereg(LCD_REG_49, 0x0101);
+ stm3240g_writereg(LCD_REG_50, 0x0003);
+ stm3240g_writereg(LCD_REG_53, 0x0106);
+ stm3240g_writereg(LCD_REG_54, 0x0b02);
+ stm3240g_writereg(LCD_REG_55, 0x0302);
+ stm3240g_writereg(LCD_REG_56, 0x0707);
+ stm3240g_writereg(LCD_REG_57, 0x0007);
+ stm3240g_writereg(LCD_REG_60, 0x0600);
+ stm3240g_writereg(LCD_REG_61, 0x020b);
+ }
+#endif
+ /* Adjust the Gamma Curve (ILI9325) */
+
+#if !defined(CONFIG_STM32_ILI9325_DISABLE)
+# if !defined(CONFIG_STM32_ILI9320_DISABLE)
+ else
+# endif
+ {
+ stm3240g_writereg(LCD_REG_48, 0x0007);
+ stm3240g_writereg(LCD_REG_49, 0x0302);
+ stm3240g_writereg(LCD_REG_50, 0x0105);
+ stm3240g_writereg(LCD_REG_53, 0x0206);
+ stm3240g_writereg(LCD_REG_54, 0x0808);
+ stm3240g_writereg(LCD_REG_55, 0x0206);
+ stm3240g_writereg(LCD_REG_56, 0x0504);
+ stm3240g_writereg(LCD_REG_57, 0x0007);
+ stm3240g_writereg(LCD_REG_60, 0x0105);
+ stm3240g_writereg(LCD_REG_61, 0x0808);
+ }
+#endif
+
+ /* Set GRAM area */
+
+ stm3240g_writereg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
+ stm3240g_writereg(LCD_REG_81, 0x00ef); /* Horizontal GRAM End Address */
+ stm3240g_writereg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
+ stm3240g_writereg(LCD_REG_83, 0x013f); /* Vertical GRAM End Address */
+ stm3240g_writereg(LCD_REG_96, 0x2700); /* Gate Scan Line */
+ //stm3240g_writereg(LCD_REG_96, 0xa700); /* Gate Scan Line(GS=1, scan direction is G320~G1) */
+ stm3240g_writereg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
+ stm3240g_writereg(LCD_REG_106, 0x0000); /* Set scrolling line */
+
+ /* Partial Display Control */
+
+ stm3240g_writereg(LCD_REG_128, 0x0000);
+ stm3240g_writereg(LCD_REG_129, 0x0000);
+ stm3240g_writereg(LCD_REG_130, 0x0000);
+ stm3240g_writereg(LCD_REG_131, 0x0000);
+ stm3240g_writereg(LCD_REG_132, 0x0000);
+ stm3240g_writereg(LCD_REG_133, 0x0000);
+
+ /* Panel Control */
+
+ stm3240g_writereg(LCD_REG_144, 0x0010);
+ stm3240g_writereg(LCD_REG_146, 0x0000);
+ stm3240g_writereg(LCD_REG_147, 0x0003);
+ stm3240g_writereg(LCD_REG_149, 0x0110);
+ stm3240g_writereg(LCD_REG_151, 0x0000);
+ stm3240g_writereg(LCD_REG_152, 0x0000);
+
+ /* Set GRAM write direction and BGR = 1
+ *
+ * I/D=01 (Horizontal : increment, Vertical : decrement)
+ * AM=1 (address is updated in vertical writing direction)
+ */
+
+ stm3240g_writereg(LCD_REG_3, 0x1018);
+ stm3240g_writereg(LCD_REG_7, 0); /* Display off */
+ }
+ else
+ {
+ lcddbg("Unsupported LCD type\n");
+ }
+}
+
+ /**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ lcdvdbg("Initializing\n");
+
+ /* Configure GPIO pins and configure the FSMC to support the LCD */
+
+ stm32_selectlcd();
+
+ /* Configure and enable LCD */
+
+ up_mdelay(50);
+ stm3240g_lcdinitialize();
+
+ /* Clear the display (setting it to the color 0=black) */
+
+ stm3240g_lcdclear(0);
+
+ /* Turn the display off */
+
+ stm3240g_poweroff();
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return &g_lcddev.dev;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ stm3240g_poweroff();
+ stm32_deselectlcd();
+}
+
+/**************************************************************************************
+ * Name: stm3240g_lcdclear
+ *
+ * Description:
+ * This is a non-standard LCD interface just for the stm3240g-EVAL board. Because
+ * of the various rotations, clearing the display in the normal way by writing a
+ * sequences of runs that covers the entire display can be very slow. Here the
+ * display is cleared by simply setting all GRAM memory to the specified color.
+ *
+ **************************************************************************************/
+
+void stm3240g_lcdclear(uint16_t color)
+{
+ uint32_t i = 0;
+
+ stm3240g_setcursor(0, STM3240G_XRES-1);
+ stm3240g_gramselect();
+ for (i = 0; i < STM3240G_XRES * STM3240G_YRES; i++)
+ {
+ LCD->value = color;
+ }
+}
+
+#endif /* !CONFIG_STM32_ILI9320_DISABLE || !CONFIG_STM32_ILI9325_DISABLE */
diff --git a/nuttx/configs/stm3240g-eval/src/up_nsh.c b/nuttx/configs/stm3240g-eval/src/up_nsh.c
new file mode 100644
index 000000000..c106e9918
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_nsh.c
@@ -0,0 +1,235 @@
+/****************************************************************************
+ * config/stm3240g_eval/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_STM32_SPI1
+# include <nuttx/spi.h>
+# include <nuttx/mtd.h>
+#endif
+
+#ifdef CONFIG_STM32_SDIO
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#ifdef CONFIG_STM32_OTGFS
+# include "stm32_usbhost.h"
+#endif
+
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* For now, don't build in any SPI1 support -- NSH is not using it */
+
+#undef CONFIG_STM32_SPI1
+
+/* Assume that we support everything until convinced otherwise */
+
+#define HAVE_MMCSD 1
+#define HAVE_USBDEV 1
+#define HAVE_USBHOST 1
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
+# undef HAVE_MMCSD
+#endif
+
+/* Default MMC/SD minor number */
+
+#ifdef HAVE_MMCSD
+# ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+# endif
+
+/* Default MMC/SD SLOT number */
+
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#endif
+
+/* Can't support USB host or device features if USB OTG FS is not enabled */
+
+#ifndef CONFIG_STM32_OTGFS
+# undef HAVE_USBDEV
+# undef HAVE_USBHOST
+#endif
+
+/* Can't support USB device is USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef HAVE_USBDEV
+#endif
+
+/* Can't support USB host is USB host is not enabled */
+
+#ifndef CONFIG_USBHOST
+# undef HAVE_USBHOST
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef CONFIG_STM32_SPI1
+ FAR struct spi_dev_s *spi;
+ FAR struct mtd_dev_s *mtd;
+#endif
+#ifdef HAVE_MMCSD
+ FAR struct sdio_dev_s *sdio;
+#endif
+#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST)
+ int ret;
+#endif
+
+ /* Configure SPI-based devices */
+
+#ifdef CONFIG_STM32_SPI1
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(1);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port 0\n");
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */
+
+ mtd = m25p_initialize(spi);
+ if (!mtd)
+ {
+ message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n");
+ return -ENODEV;
+ }
+#warning "Now what are we going to do with this SPI FLASH driver?"
+#endif
+
+ /* Mount the SDIO-based MMC/SD block driver */
+
+#ifdef HAVE_MMCSD
+ /* First, get an instance of the SDIO interface */
+
+ sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the STM3240G-EVAL board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+#endif
+
+#ifdef HAVE_USBHOST
+ /* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
+ * will monitor for USB connection and disconnection events.
+ */
+
+ ret = stm32_usbhost_initialize();
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret);
+ return ret;
+ }
+#endif
+
+ return OK;
+}
diff --git a/nuttx/configs/stm3240g-eval/src/up_ostest.c b/nuttx/configs/stm3240g-eval/src/up_ostest.c
new file mode 100644
index 000000000..b84f7a40e
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_ostest.c
@@ -0,0 +1,114 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_ostest.c
+ * arch/arm/src/board/up_ostest.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <debug.h>
+
+#include <arch/irq.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm3240g-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration ********************************************************************/
+
+#undef HAVE_FPU
+#if defined(CONFIG_ARCH_FPU) && defined(CONFIG_EXAMPLES_OSTEST_FPUSIZE) && \
+ defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_DISABLE_SIGNALS) && \
+ !defined(CONFIG_ARMV7M_CMNVECTOR)
+# define HAVE_FPU 1
+#endif
+
+#ifdef HAVE_FPU
+
+#if CONFIG_EXAMPLES_OSTEST_FPUSIZE != (4*SW_FPU_REGS)
+# error "CONFIG_EXAMPLES_OSTEST_FPUSIZE has the wrong size"
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+static uint32_t g_saveregs[XCPTCONTEXT_REGS];
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+/* Given an array of size CONFIG_EXAMPLES_OSTEST_FPUSIZE, this function will return
+ * the current FPU registers.
+ */
+
+void arch_getfpu(FAR uint32_t *fpusave)
+{
+ irqstate_t flags;
+
+ /* Take a snapshot of the thread context right now */
+
+ flags = irqsave();
+ up_saveusercontext(g_saveregs);
+
+ /* Return only the floating register values */
+
+ memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
+ irqrestore(flags);
+}
+
+/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
+ * will compare them and return true if they are identical.
+ */
+
+bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
+{
+ return memcmp(fpusave1, fpusave2, (4*SW_FPU_REGS)) == 0;
+}
+
+#endif /* HAVE_FPU */
diff --git a/nuttx/configs/stm3240g-eval/src/up_pwm.c b/nuttx/configs/stm3240g-eval/src/up_pwm.c
new file mode 100644
index 000000000..7cc1d39d5
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_pwm.c
@@ -0,0 +1,120 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_pwm.c
+ * arch/arm/src/board/up_pwm.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/pwm.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "stm32_pwm.h"
+#include "stm3240g-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* PWM
+ *
+ * The STM3240G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using variously unused pins on the board for
+ * PWM output (see board.h for details of pins).
+ */
+
+#ifdef CONFIG_PWM
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pwm_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/pwm.
+ *
+ ************************************************************************************/
+
+int pwm_devinit(void)
+{
+ static bool initialized = false;
+ struct pwm_lowerhalf_s *pwm;
+ int ret;
+
+ /* Have we already initialized? */
+
+ if (!initialized)
+ {
+ /* Call stm32_pwminitialize() to get an instance of the PWM interface */
+
+ pwm = stm32_pwminitialize(STM3240G_EVAL_PWMTIMER);
+ if (!pwm)
+ {
+ dbg("Failed to get the STM32 PWM lower half\n");
+ return -ENODEV;
+ }
+
+ /* Register the PWM driver at "/dev/pwm0" */
+
+ ret = pwm_register("/dev/pwm0", pwm);
+ if (ret < 0)
+ {
+ adbg("pwm_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* CONFIG_PWM */
diff --git a/nuttx/configs/stm3240g-eval/src/up_selectlcd.c b/nuttx/configs/stm3240g-eval/src/up_selectlcd.c
new file mode 100644
index 000000000..e5781a1ea
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_selectlcd.c
@@ -0,0 +1,169 @@
+/************************************************************************************
+ * configs/stm3210e-eval/src/up_selectlcd.c
+ * arch/arm/src/board/up_selectlcd.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/* SRAM pin definitions */
+
+#define LCD_NADDRLINES 1
+#define LCD_NDATALINES 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* Pin Usage (per schematic)
+ * SRAM LCD
+ * D[0..15] [0..15] [0..15]
+ * A[0..25] [0..22] [0] RS
+ * FSMC_NBL0 PE0 OUT --- ---
+ * FSMC_NBL1 PE1 OUT --- ---
+ * FSMC_NE2 PG9 OUT --- ---
+ * FSMC_NE3 PG10 OUT --- ~CS
+ * FSMC_NE4 PG12 OUT --- ---
+ * FSMC_NWE PD5 OUT --- ~WR/SCL
+ * FSMC_NOE PD4 OUT --- ~RD
+ * FSMC_NWAIT PD6 IN --- ---
+ * FSMC_INT2 PG6* IN --- ---
+ * FSMC_INT3
+ * FSMC_INTR
+ * FSMC_CD
+ * FSMC_CLK
+ * FSMC_NCE2
+ * FSMC_NCE3
+ * FSMC_NCE4_1
+ * FSMC_NCE4_2
+ * FSMC_NIORD
+ * FSMC_NIOWR
+ * FSMC_NL
+ * FSMC_NREG
+ */
+
+/* GPIO configurations unique to the LCD */
+
+static const uint32_t g_lcdconfig[] =
+{
+ /* NOE, NWE, and NE3 */
+
+ GPIO_FSMC_NOE, GPIO_FSMC_NWE, GPIO_FSMC_NE3
+};
+#define NLCD_CONFIG (sizeof(g_lcdconfig)/sizeof(uint32_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+void stm32_selectlcd(void)
+{
+ /* Configure new GPIO pins */
+
+ stm32_extmemaddr(LCD_NADDRLINES); /* Common address lines: A0 */
+ stm32_extmemdata(LCD_NDATALINES); /* Common data lines: D0-D15 */
+ stm32_extmemgpios(g_lcdconfig, NLCD_CONFIG); /* LCD-specific control lines */
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Color LCD configuration (LCD configured as follow):
+ *
+ * - Data/Address MUX = Disable "FSMC_BCR_MUXEN" just not enable it.
+ * - Extended Mode = Disable "FSMC_BCR_EXTMOD"
+ * - Memory Type = SRAM "FSMC_BCR_SRAM"
+ * - Data Width = 16bit "FSMC_BCR_MWID16"
+ * - Write Operation = Enable "FSMC_BCR_WREN"
+ * - Asynchronous Wait = Disable
+ */
+
+ /* Bank3 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR3);
+
+ /* Bank3 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(5) | FSMC_BTR_ADDHLD(0) | FSMC_BTR_DATAST(9) | FSMC_BTR_BUSTRUN(0) |
+ FSMC_BTR_CLKDIV(0) | FSMC_BTR_DATLAT(0) | FSMC_BTR_ACCMODA, STM32_FSMC_BTR3);
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR3);
+
+ /* Enable the bank by setting the MBKEN bit */
+
+ putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR3);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_selectsram.c b/nuttx/configs/stm3240g-eval/src/up_selectsram.c
new file mode 100644
index 000000000..65cdf62c5
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_selectsram.c
@@ -0,0 +1,194 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_selectsram.c
+ * arch/arm/src/board/up_selectsram.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_STM32_FSMC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+/* SRAM Timing */
+
+#define SRAM_ADDRESS_SETUP_TIME 3
+#define SRAM_ADDRESS_HOLD_TIME 0
+#define SRAM_DATA_SETUP_TIME 6
+#define SRAM_BUS_TURNAROUND_DURATION 1
+#define SRAM_CLK_DIVISION 0
+#define SRAM_DATA_LATENCY 0
+
+/* SRAM pin definitions */
+
+#define SRAM_NADDRLINES 21
+#define SRAM_NDATALINES 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+/* GPIOs Configuration **************************************************************
+ * PD0 <-> FSMC_D2 PE0 <-> FSMC_NBL0 PF0 <-> FSMC_A0 PG0 <-> FSMC_A10
+ * PD1 <-> FSMC_D3 PE1 <-> FSMC_NBL1 PF1 <-> FSMC_A1 PG1 <-> FSMC_A11
+ * PD4 <-> FSMC_NOE PE3 <-> FSMC_A19 PF2 <-> FSMC_A2 PG2 <-> FSMC_A12
+ * PD5 <-> FSMC_NWE PE4 <-> FSMC_A20 PF3 <-> FSMC_A3 PG3 <-> FSMC_A13
+ * PD8 <-> FSMC_D13 PE7 <-> FSMC_D4 PF4 <-> FSMC_A4 PG4 <-> FSMC_A14
+ * PD9 <-> FSMC_D14 PE8 <-> FSMC_D5 PF5 <-> FSMC_A5 PG5 <-> FSMC_A15
+ * PD10 <-> FSMC_D15 PE9 <-> FSMC_D6 PF12 <-> FSMC_A6 PG9 <-> FSMC_NE2
+ * PD11 <-> FSMC_A16 PE10 <-> FSMC_D7 PF13 <-> FSMC_A7
+ * PD12 <-> FSMC_A17 PE11 <-> FSMC_D8 PF14 <-> FSMC_A8
+ * PD13 <-> FSMC_A18 PE12 <-> FSMC_D9 PF15 <-> FSMC_A9
+ * PD14 <-> FSMC_D0 PE13 <-> FSMC_D10
+ * PD15 <-> FSMC_D1 PE14 <-> FSMC_D11
+ * PE15 <-> FSMC_D12
+ */
+
+/* GPIO configurations unique to SRAM */
+
+static const uint32_t g_sramconfig[] =
+{
+ /* NE3, NBL0, NBL1, */
+
+ GPIO_FSMC_NOE, GPIO_FSMC_NWE, GPIO_FSMC_NBL0, GPIO_FSMC_NBL1, GPIO_FSMC_NE2
+};
+#define NSRAM_CONFIG (sizeof(g_sramconfig)/sizeof(uint32_t))
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_selectsram
+ *
+ * Description:
+ * Initialize to access external SRAM. SRAM will be visible at the FSMC Bank
+ * NOR/SRAM2 base address (0x64000000)
+ *
+ * General transaction rules. The requested AHB transaction data size can be 8-,
+ * 16- or 32-bit wide whereas the SRAM has a fixed 16-bit data width. Some simple
+ * transaction rules must be followed:
+ *
+ * Case 1: AHB transaction width and SRAM data width are equal
+ * There is no issue in this case.
+ * Case 2: AHB transaction size is greater than the memory size
+ * In this case, the FSMC splits the AHB transaction into smaller consecutive
+ * memory accesses in order to meet the external data width.
+ * Case 3: AHB transaction size is smaller than the memory size.
+ * SRAM supports the byte select feature.
+ * a) FSMC allows write transactions accessing the right data through its
+ * byte lanes (NBL[1:0])
+ * b) Read transactions are allowed (the controller reads the entire memory
+ * word and uses the needed byte only). The NBL[1:0] are always kept low
+ * during read transactions.
+ *
+ ************************************************************************************/
+
+void stm32_selectsram(void)
+{
+ /* Configure new GPIO pins */
+
+ stm32_extmemaddr(SRAM_NADDRLINES); /* Common address lines: A0-A20 */
+ stm32_extmemdata(SRAM_NDATALINES); /* Common data lines: D0-D15 */
+ stm32_extmemgpios(g_sramconfig, NSRAM_CONFIG); /* SRAM-specific control lines */
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Bank1 NOR/SRAM control register configuration
+ *
+ * Bank enable : Not yet
+ * Data address mux : Disabled
+ * Memory Type : PSRAM
+ * Data bus width : 16-bits
+ * Flash access : Disabled
+ * Burst access mode : Disabled
+ * Polarity : Low
+ * Wrapped burst mode : Disabled
+ * Write timing : Before state
+ * Write enable : Yes
+ * Wait signal : Disabled
+ * Extended mode : Disabled
+ * Asynchronous wait : Disabled
+ * Write burst : Disabled
+ */
+
+ putreg32((FSMC_BCR_PSRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN), STM32_FSMC_BCR2);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32((FSMC_BTR_ADDSET(SRAM_ADDRESS_SETUP_TIME) | FSMC_BTR_ADDHLD(SRAM_ADDRESS_HOLD_TIME) |
+ FSMC_BTR_DATAST(SRAM_DATA_SETUP_TIME) | FSMC_BTR_BUSTRUN(SRAM_BUS_TURNAROUND_DURATION) |
+ FSMC_BTR_CLKDIV(SRAM_CLK_DIVISION) | FSMC_BTR_DATLAT(SRAM_DATA_LATENCY) |
+ FSMC_BTR_ACCMODA),
+ STM32_FSMC_BTR2);
+
+ /* Bank1 NOR/SRAM timing register for write configuration, if extended mode is used */
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR2); /* Extended mode not used */
+
+ /* Enable the bank */
+
+ putreg32((FSMC_BCR_MBKEN | FSMC_BCR_PSRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN), STM32_FSMC_BCR2);
+}
+
+#endif /* CONFIG_STM32_FSMC */
+
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_spi.c b/nuttx/configs/stm3240g-eval/src/up_spi.c
new file mode 100644
index 000000000..3ce9d7e29
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_spi.c
@@ -0,0 +1,161 @@
+/************************************************************************************
+ * configs/stm3240g_eval/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the STM3240G-EVAL board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void)
+{
+#warning "Missing logic"
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/stm3240g-eval/src/up_stmpe811.c b/nuttx/configs/stm3240g-eval/src/up_stmpe811.c
new file mode 100644
index 000000000..257c886b9
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_stmpe811.c
@@ -0,0 +1,353 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_touchscreen.c
+ * arch/arm/src/board/up_touchscreen.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/i2c.h>
+#include <nuttx/input/touchscreen.h>
+#include <nuttx/input/stmpe811.h>
+
+#include <arch/irq.h>
+
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifdef CONFIG_INPUT_STMPE811
+#ifndef CONFIG_INPUT
+# error "STMPE811 support requires CONFIG_INPUT"
+#endif
+
+#ifndef CONFIG_STM32_I2C1
+# error "STMPE811 support requires CONFIG_STM32_I2C1"
+#endif
+
+#ifndef CONFIG_STMPE811_I2C
+# error "Only the STMPE811 I2C interface is supported"
+#endif
+
+#ifdef CONFIG_STMPE811_SPI
+# error "Only the STMPE811 SPI interface is supported"
+#endif
+
+#ifndef CONFIG_STMPE811_FREQUENCY
+# define CONFIG_STMPE811_FREQUENCY 100000
+#endif
+
+#ifndef CONFIG_STMPE811_I2CDEV
+# define CONFIG_STMPE811_I2CDEV 1
+#endif
+
+#if CONFIG_STMPE811_I2CDEV != 1
+# error "CONFIG_STMPE811_I2CDEV must be one"
+#endif
+
+#ifndef CONFIG_STMPE811_DEVMINOR
+# define CONFIG_STMPE811_DEVMINOR 0
+#endif
+
+/* Board definitions ********************************************************/
+/* The STM3240G-EVAL has two STMPE811QTR I/O expanders on board both connected
+ * to the STM32 via I2C1. They share a common interrupt line: PI2.
+ *
+ * STMPE811 U24, I2C address 0x41 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- TouchScreen_Y- LCD Connector XL
+ * X- TouchScreen_X- LCD Connector XR
+ * Y+ TouchScreen_Y+ LCD Connector XD
+ * X+ TouchScreen_X+ LCD Connector XU
+ * IN3 EXP_IO9
+ * IN2 EXP_IO10
+ * IN1 EXP_IO11
+ * IN0 EXP_IO12
+ *
+ * STMPE811 U29, I2C address 0x44 (7-bit)
+ * ------ ---- ---------------- --------------------------------------------
+ * STPE11 PIN BOARD SIGNAL BOARD CONNECTION
+ * ------ ---- ---------------- --------------------------------------------
+ * Y- EXP_IO1
+ * X- EXP_IO2
+ * Y+ EXP_IO3
+ * X+ EXP_IO4
+ * IN3 EXP_IO5
+ * IN2 EXP_IO6
+ * IN1 EXP_IO7
+ * IN0 EXP_IO8
+ */
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct stm32_stmpe811config_s
+{
+ /* Configuration structure as seen by the STMPE811 driver */
+
+ struct stmpe811_config_s config;
+
+ /* Additional private definitions only known to this driver */
+
+ STMPE811_HANDLE handle; /* The STMPE811 driver handle */
+ xcpt_t handler; /* The STMPE811 interrupt handler */
+};
+
+/****************************************************************************
+ * Static Function Prototypes
+ ****************************************************************************/
+
+/* IRQ/GPIO access callbacks. These operations all hidden behind callbacks
+ * to isolate the STMPE811 driver from differences in GPIO
+ * interrupt handling by varying boards and MCUs.* so that contact and loss-of-contact events can be detected.
+ *
+ * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt
+ * enable - Enable or disable the GPIO interrupt
+ * clear - Acknowledge/clear any pending GPIO interrupt
+ */
+
+static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr);
+static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable);
+static void stmpe811_clear(FAR struct stmpe811_config_s *state);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* A reference to a structure of this type must be passed to the STMPE811
+ * driver. This structure provides information about the configuration
+ * of the STMPE811 and provides some board-specific hooks.
+ *
+ * Memory for this structure is provided by the caller. It is not copied
+ * by the driver and is presumed to persist while the driver is active. The
+ * memory must be writable because, under certain circumstances, the driver
+ * may modify frequency or X plate resistance values.
+ */
+
+#ifndef CONFIG_STMPE811_TSC_DISABLE
+static struct stm32_stmpe811config_s g_stmpe811config =
+{
+ .config =
+ {
+#ifdef CONFIG_STMPE811_I2C
+ .address = STMPE811_ADDR1,
+#endif
+ .frequency = CONFIG_STMPE811_FREQUENCY,
+
+#ifdef CONFIG_STMPE811_MULTIPLE
+ .irq = STM32_IRQ_EXTI2,
+#endif
+ .ctrl1 = (ADC_CTRL1_SAMPLE_TIME_80 | ADC_CTRL1_MOD_12B),
+ .ctrl2 = ADC_CTRL2_ADC_FREQ_3p25,
+
+ .attach = stmpe811_attach,
+ .enable = stmpe811_enable,
+ .clear = stmpe811_clear,
+ },
+ .handler = NULL,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* IRQ/GPIO access callbacks. These operations all hidden behind
+ * callbacks to isolate the STMPE811 driver from differences in GPIO
+ * interrupt handling by varying boards and MCUs.
+ *
+ * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt
+ * enable - Enable or disable the GPIO interrupt
+ * clear - Acknowledge/clear any pending GPIO interrupt
+ */
+
+static int stmpe811_attach(FAR struct stmpe811_config_s *state, xcpt_t isr)
+{
+ FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state;
+
+ ivdbg("Saving handler %p\n", isr);
+ DEBUGASSERT(priv);
+
+ /* Just save the handler. We will use it when EXTI interruptsare enabled */
+
+ priv->handler = isr;
+ return OK;
+}
+
+static void stmpe811_enable(FAR struct stmpe811_config_s *state, bool enable)
+{
+ FAR struct stm32_stmpe811config_s *priv = (FAR struct stm32_stmpe811config_s *)state;
+ irqstate_t flags;
+
+ /* Attach and enable, or detach and disable. Enabling and disabling GPIO
+ * interrupts is a multi-step process so the safest thing is to keep
+ * interrupts disabled during the reconfiguratino.
+ */
+
+ flags = irqsave();
+ if (enable)
+ {
+ /* Configure the EXTI interrupt using the SAVED handler */
+
+ (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, true, true, true, priv->handler);
+ }
+ else
+ {
+ /* Configure the EXTI interrupt with a NULL handler to disable it */
+
+ (void)stm32_gpiosetevent(GPIO_IO_EXPANDER, false, false, false, NULL);
+ }
+ irqrestore(flags);
+}
+
+static void stmpe811_clear(FAR struct stmpe811_config_s *state)
+{
+ /* Does nothing */
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: arch_tcinitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * configure the touchscreen device. This function will register the driver
+ * as /dev/inputN where N is the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int arch_tcinitialize(int minor)
+{
+#ifndef CONFIG_STMPE811_TSC_DISABLE
+ FAR struct i2c_dev_s *dev;
+ int ret;
+
+ idbg("minor %d\n", minor);
+ DEBUGASSERT(minor == 0);
+
+ /* Check if we are already initialized */
+
+ if (!g_stmpe811config.handle)
+ {
+ ivdbg("Initializing\n");
+
+ /* Configure the STMPE811 interrupt pin as an input */
+
+ (void)stm32_configgpio(GPIO_IO_EXPANDER);
+
+ /* Get an instance of the I2C interface */
+
+ dev = up_i2cinitialize(CONFIG_STMPE811_I2CDEV);
+ if (!dev)
+ {
+ idbg("Failed to initialize I2C bus %d\n", CONFIG_STMPE811_I2CDEV);
+ return -ENODEV;
+ }
+
+ /* Instantiate the STMPE811 driver */
+
+ g_stmpe811config.handle =
+ stmpe811_instantiate(dev, (FAR struct stmpe811_config_s *)&g_stmpe811config);
+ if (!g_stmpe811config.handle)
+ {
+ idbg("Failed to instantiate the STMPE811 driver\n");
+ return -ENODEV;
+ }
+
+ /* Initialize and register the I2C touchscreen device */
+
+ ret = stmpe811_register(g_stmpe811config.handle, CONFIG_STMPE811_DEVMINOR);
+ if (ret < 0)
+ {
+ idbg("Failed to register STMPE driver: %d\n", ret);
+ /* up_i2cuninitialize(dev); */
+ return -ENODEV;
+ }
+ }
+
+ return OK;
+#else
+ return -ENOSYS;
+#endif
+}
+
+/****************************************************************************
+ * Name: arch_tcuninitialize
+ *
+ * Description:
+ * Each board that supports a touchscreen device must provide this function.
+ * This function is called by application-specific, setup logic to
+ * uninitialize the touchscreen device.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None.
+ *
+ ****************************************************************************/
+
+void arch_tcuninitialize(void)
+{
+ /* No support for un-initializing the touchscreen STMPE811 device yet */
+}
+
+#endif /* CONFIG_INPUT_STMPE811 */
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_usb.c b/nuttx/configs/stm3240g-eval/src/up_usb.c
new file mode 100644
index 000000000..294fd661e
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_usb.c
@@ -0,0 +1,294 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sched.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbhost.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+#ifdef CONFIG_STM32_OTGFS
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
+# define HAVE_USB 1
+#else
+# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
+# undef HAVE_USB
+#endif
+
+#ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+#endif
+
+#ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: usbhost_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static int usbhost_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ uvdbg("Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ uvdbg("%s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related
+ * GPIO pins for the STM3240G-EVAL board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
+
+ /* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
+
+#ifdef CONFIG_STM32_OTGFS
+ stm32_configgpio(GPIO_OTGFS_VBUS);
+ stm32_configgpio(GPIO_OTGFS_PWRON);
+ stm32_configgpio(GPIO_OTGFS_OVER);
+#endif
+}
+
+/***********************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality.
+ * This function will start a thread that will monitor for device
+ * connection/disconnection events.
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_usbhost_initialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ uvdbg("Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ udbg("Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ uvdbg("Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ uvdbg("Start usbhost_waiter\n");
+
+ pid = TASK_CREATE("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)usbhost_waiter, (const char **)NULL);
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+
+ return -ENODEV;
+}
+#endif
+
+/***********************************************************************************
+ * Name: stm32_usbhost_vbusdrive
+ *
+ * Description:
+ * Enable/disable driving of VBUS 5V output. This function must be provided be
+ * each platform that implements the STM32 OTG FS host interface
+ *
+ * "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
+ * or, if 5 V are available on the application board, a basic power switch, must
+ * be added externally to drive the 5 V VBUS line. The external charge pump can
+ * be driven by any GPIO output. When the application decides to power on VBUS
+ * using the chosen GPIO, it must also set the port power bit in the host port
+ * control and status register (PPWR bit in OTG_FS_HPRT).
+ *
+ * "The application uses this field to control power to this port, and the core
+ * clears this bit on an overcurrent condition."
+ *
+ * Input Parameters:
+ * iface - For future growth to handle multiple USB host interface. Should be zero.
+ * enable - true: enable VBUS power; false: disable VBUS power
+ *
+ * Returned Value:
+ * None
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+void stm32_usbhost_vbusdrive(int iface, bool enable)
+{
+ DEBUGASSERT(iface == 0);
+
+ if (enable)
+ {
+ /* Enable the Power Switch by driving the enable pin low */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, false);
+ }
+ else
+ {
+ /* Disable the Power Switch by driving the enable pin high */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, true);
+ }
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_setup_overcurrent
+ *
+ * Description:
+ * Setup to receive an interrupt-level callback if an overcurrent condition is
+ * detected.
+ *
+ * Input paramter:
+ * handler - New overcurrent interrupt handler
+ *
+ * Returned value:
+ * Old overcurrent interrupt handler
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+xcpt_t stm32_setup_overcurrent(xcpt_t handler)
+{
+ return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBDEV
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+#endif
+
+#endif /* CONFIG_STM32_OTGFS */
+
+
+
diff --git a/nuttx/configs/stm3240g-eval/src/up_userleds.c b/nuttx/configs/stm3240g-eval/src/up_userleds.c
new file mode 100644
index 000000000..59be38561
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_userleds.c
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * configs/stm3240g_eval/src/up_userleds.c
+ * arch/arm/src/board/up_userleds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm3240g-internal.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* This array maps an LED number to GPIO pin configuration */
+
+static uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ledinit
+ ****************************************************************************/
+
+void stm32_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: stm32_setled
+ ****************************************************************************/
+
+void stm32_setled(int led, bool ledon)
+{
+ if ((unsigned)led < BOARD_NLEDS)
+ {
+ stm32_gpiowrite(g_ledcfg[led], ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: stm32_setleds
+ ****************************************************************************/
+
+void stm32_setleds(uint8_t ledset)
+{
+ stm32_gpiowrite(BOARD_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED2, (ledset & BOARD_LED2_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED3, (ledset & BOARD_LED3_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED4, (ledset & BOARD_LED4_BIT) == 0);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm3240g-eval/src/up_watchdog.c b/nuttx/configs/stm3240g-eval/src/up_watchdog.c
new file mode 100644
index 000000000..db4a54a9f
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/stm3240g-eval/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/stm3240g-eval/telnetd/Make.defs b/nuttx/configs/stm3240g-eval/telnetd/Make.defs
new file mode 100644
index 000000000..9ed3fcb83
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/telnetd/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/telnetd/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/telnetd/appconfig b/nuttx/configs/stm3240g-eval/telnetd/appconfig
new file mode 100644
index 000000000..ca5a1d784
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/telnetd/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/stm3240g-eval/telnetd/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/telnetd
+
+# Networking support
+
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/telnetd
+
diff --git a/nuttx/configs/stm3240g-eval/telnetd/defconfig b/nuttx/configs/stm3240g-eval/telnetd/defconfig
new file mode 100644
index 000000000..67762012c
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/telnetd/defconfig
@@ -0,0 +1,650 @@
+############################################################################
+# configs/stm3240g-eval/telnetd/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=n
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="shell_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_NET=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=128
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=y
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/telnetd
+#
+CONFIG_EXAMPLES_TELNETD_DAEMONPRIO=128
+CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE=2048
+CONFIG_EXAMPLES_TELNETD_CLIENTPRIO=128
+CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE=2048
+CONFIG_EXAMPLE_TELNETD_NOMAC=y
+CONFIG_EXAMPLE_TELNETD_IPADDR=0x0a000002
+CONFIG_EXAMPLE_TELNETD_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_TELNETD_NETMASK=0xffffff00
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+# Application configuration
+
+CONFIG_APPS_DIR="../apps"
diff --git a/nuttx/configs/stm3240g-eval/telnetd/setenv.sh b/nuttx/configs/stm3240g-eval/telnetd/setenv.sh
new file mode 100755
index 000000000..c022d1d9b
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/telnetd/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/telnetd/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/webserver/Make.defs b/nuttx/configs/stm3240g-eval/webserver/Make.defs
new file mode 100644
index 000000000..460a5e22a
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/webserver/Make.defs
@@ -0,0 +1,197 @@
+############################################################################
+# configs/stm3240g-eval/webserver/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/webserver/appconfig b/nuttx/configs/stm3240g-eval/webserver/appconfig
new file mode 100644
index 000000000..cfd913b53
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/webserver/appconfig
@@ -0,0 +1,38 @@
+############################################################################
+# configs/stm3240g-eval/webserver/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+CONFIGURED_APPS += examples/uip
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/webserver
diff --git a/nuttx/configs/stm3240g-eval/webserver/defconfig b/nuttx/configs/stm3240g-eval/webserver/defconfig
new file mode 100644
index 000000000..07d8cfa7b
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/webserver/defconfig
@@ -0,0 +1,844 @@
+############################################################################
+# configs/stm3240g-eval/webserver/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_ARCH_BOARD="stm3240g-eval"
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# On-chip CCM SRAM configuration
+#
+
+#
+# On-board FSMC SRAM configuration
+#
+CONFIG_STM32_FSMC_SRAM=y
+CONFIG_HEAP2_BASE=0x64000000
+CONFIG_HEAP2_SIZE=2097152
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=y
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=y
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# I2C configuration
+#
+CONFIG_I2C=y
+CONFIG_I2C_POLLED=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_TRACE=n
+
+#
+# ADC configuration
+#
+# Enable ADC driver support. The STM3240G-EVAL has a 10 Kohm potentiometer
+# RV1 connected to PF9 of STM32F407IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7
+#
+CONFIG_ADC=n
+#CONFIG_STM32_TIM1_ADC=y
+CONFIG_STM32_TIM1_ADC3=y
+CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
+
+#
+# PWM configuration
+#
+# The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4.
+# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8.
+#
+CONFIG_PWM=n
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM8_PWM=y
+CONFIG_STM32_TIM8_CHANNEL=4
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="uip_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_I2C=n
+CONFIG_DEBUG_INPUT=n
+
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# System Logging
+#
+
+CONFIG_SYSLOG=n
+CONFIG_RAMLOG=n
+CONFIG_RAMLOG_CONSOLE=n
+CONFIG_RAMLOG_SYSLOG=n
+#CONFIG_RAMLOG_NPOLLWAITERS
+#CONFIG_RAMLOG_CONSOLE_BUFSIZE
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=y
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# FTP Server
+#
+CONFIG_FTPD_CMDBUFFERSIZE=2048
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# Input device configuration
+#
+CONFIG_INPUT=n
+CONFIG_INPUT_TSC2007=n
+
+#
+# STMPE811 input device configuration
+#
+# Prerequisites: CONFIG_INPUT=y
+# Other settings that effect the driver: CONFIG_DISABLE_POLL
+#
+CONFIG_INPUT_STMPE811=n
+CONFIG_STMPE811_SPI=n
+CONFIG_STMPE811_I2C=y
+CONFIG_STMPE811_MULTIPLE=y
+CONFIG_STMPE811_ACTIVELOW=y
+CONFIG_STMPE811_EDGE=y
+#CONFIG_STMPE811_NPOLLWAITERS
+CONFIG_STMPE811_TSC_DISABLE=n
+CONFIG_STMPE811_ADC_DISABLE=y
+CONFIG_STMPE811_GPIO_DISABLE=y
+CONFIG_STMPE811_GPIOINT_DISABLE=y
+CONFIG_STMPE811_SWAPXY=y
+CONFIG_STMPE811_TEMP_DISABLE=y
+CONFIG_STMPE811_REGDEBUG=n
+CONFIG_STMPE811_THRESHX=26
+CONFIG_STMPE811_THRESHY=34
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxConsole Configuration Settings:
+#
+CONFIG_NXCONSOLE=n
+CONFIG_NXCONSOLE_BPP=16
+CONFIG_NXCONSOLE_MXCHARS=256
+CONFIG_NXCONSOLE_CACHESIZE=32
+#
+
+#
+# STM3240G-EVAL LCD Hardware Configuration
+#
+CONFIG_LCD_NOGETRUN=y
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+
+#
+# STM3240G-EVAL specific LCD settings
+#
+CONFIG_STM32_ILI9320_DISABLE=n
+CONFIG_STM32_ILI9325_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80232
+CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80201
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_NOMAC=y
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=y
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# I2C tool settings
+#
+CONFIG_I2CTOOL_BUILTIN=y
+CONFIG_I2CTOOL_MINBUS=1
+CONFIG_I2CTOOL_MAXBUS=3
+#CONFIG_I2CTOOL_MINADDR
+#CONFIG_I2CTOOL_MAXADDR
+#CONFIG_I2CTOOL_MAXREGADDR
+CONFIG_I2CTOOL_DEFFREQ=100000
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=y
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=y
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/ftpd
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm3240g-eval/webserver/setenv.sh b/nuttx/configs/stm3240g-eval/webserver/setenv.sh
new file mode 100644
index 000000000..2347f39d8
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/webserver/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/webserver/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm3240g-eval/xmlrpc/Make.defs b/nuttx/configs/stm3240g-eval/xmlrpc/Make.defs
new file mode 100644
index 000000000..0a97a215d
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/xmlrpc/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm3240g-eval/xmlrpc/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm3240g-eval/xmlrpc/defconfig b/nuttx/configs/stm3240g-eval/xmlrpc/defconfig
new file mode 100644
index 000000000..5c70327b9
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/xmlrpc/defconfig
@@ -0,0 +1,866 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+CONFIG_NUTTX_NEWCONFIG=y
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+# CONFIG_INTELHEX_BINARY is not set
+# CONFIG_MOTOROLA_SREC is not set
+CONFIG_RAW_BINARY=y
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_VERBOSE is not set
+# CONFIG_DEBUG_ENABLE is not set
+# CONFIG_DEBUG_SCHED is not set
+# CONFIG_DEBUG_MM is not set
+CONFIG_DEBUG_NET=y
+# CONFIG_DEBUG_USB is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_DEBUG_LIB is not set
+# CONFIG_DEBUG_BINFMT is not set
+# CONFIG_DEBUG_GRAPHICS is not set
+# CONFIG_DEBUG_I2C is not set
+# CONFIG_DEBUG_SPI is not set
+# CONFIG_DEBUG_WATCHDOG is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_8051 is not set
+CONFIG_ARCH_ARM=y
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="arm"
+# CONFIG_ARCH_CHIP_C5471 is not set
+# CONFIG_ARCH_CHIP_CALYPSO is not set
+# CONFIG_ARCH_CHIP_DM320 is not set
+# CONFIG_ARCH_CHIP_IMX is not set
+# CONFIG_ARCH_CHIP_KINETIS is not set
+# CONFIG_ARCH_CHIP_LM3S is not set
+# CONFIG_ARCH_CHIP_LPC17XX is not set
+# CONFIG_ARCH_CHIP_LPC214X is not set
+# CONFIG_ARCH_CHIP_LPC2378 is not set
+# CONFIG_ARCH_CHIP_LPC31XX is not set
+# CONFIG_ARCH_CHIP_LPC43XX is not set
+# CONFIG_ARCH_CHIP_SAM3U is not set
+CONFIG_ARCH_CHIP_STM32=y
+# CONFIG_ARCH_CHIP_STR71X is not set
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_FAMILY="armv7-m"
+CONFIG_ARCH_CHIP="stm32"
+# CONFIG_ARCH_FPU is not set
+CONFIG_ARCH_HAVE_MPU=y
+# CONFIG_ARMV7M_MPU is not set
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+# CONFIG_ARCH_CALIBRATION is not set
+# CONFIG_SERIAL_TERMIOS is not set
+# CONFIG_NET_MULTICAST is not set
+
+#
+# STM32 Configuration Options
+#
+# CONFIG_ARCH_CHIP_STM32F100C8 is not set
+# CONFIG_ARCH_CHIP_STM32F100CB is not set
+# CONFIG_ARCH_CHIP_STM32F100R8 is not set
+# CONFIG_ARCH_CHIP_STM32F100RB is not set
+# CONFIG_ARCH_CHIP_STM32F100V8 is not set
+# CONFIG_ARCH_CHIP_STM32F100VB is not set
+# CONFIG_ARCH_CHIP_STM32F103RET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set
+# CONFIG_ARCH_CHIP_STM32F103VET6 is not set
+# CONFIG_ARCH_CHIP_STM32F103ZET6 is not set
+# CONFIG_ARCH_CHIP_STM32F105VBT7 is not set
+# CONFIG_ARCH_CHIP_STM32F107VC is not set
+# CONFIG_ARCH_CHIP_STM32F207IG is not set
+# CONFIG_ARCH_CHIP_STM32F405RG is not set
+# CONFIG_ARCH_CHIP_STM32F405VG is not set
+# CONFIG_ARCH_CHIP_STM32F405ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407VE is not set
+# CONFIG_ARCH_CHIP_STM32F407VG is not set
+# CONFIG_ARCH_CHIP_STM32F407ZE is not set
+# CONFIG_ARCH_CHIP_STM32F407ZG is not set
+# CONFIG_ARCH_CHIP_STM32F407IE is not set
+CONFIG_ARCH_CHIP_STM32F407IG=y
+CONFIG_STM32_STM32F40XX=y
+# CONFIG_STM32_CODESOURCERYW is not set
+CONFIG_STM32_CODESOURCERYL=y
+# CONFIG_STM32_ATOLLIC_LITE is not set
+# CONFIG_STM32_ATOLLIC_PRO is not set
+# CONFIG_STM32_DEVKITARM is not set
+# CONFIG_STM32_RAISONANCE is not set
+# CONFIG_STM32_BUILDROOT is not set
+# CONFIG_STM32_DFU is not set
+
+#
+# STM32 Peripheral Support
+#
+# CONFIG_STM32_ADC1 is not set
+# CONFIG_STM32_ADC2 is not set
+# CONFIG_STM32_ADC3 is not set
+# CONFIG_STM32_CRC is not set
+# CONFIG_STM32_DMA1 is not set
+# CONFIG_STM32_DMA2 is not set
+# CONFIG_STM32_BKPSRAM is not set
+# CONFIG_STM32_CAN1 is not set
+# CONFIG_STM32_CAN2 is not set
+# CONFIG_STM32_CCMDATARAM is not set
+# CONFIG_STM32_CRYP is not set
+# CONFIG_STM32_DAC1 is not set
+# CONFIG_STM32_DAC2 is not set
+# CONFIG_STM32_DCMI is not set
+CONFIG_STM32_ETHMAC=y
+# CONFIG_STM32_FSMC is not set
+# CONFIG_STM32_HASH is not set
+CONFIG_STM32_I2C1=y
+# CONFIG_STM32_I2C2 is not set
+# CONFIG_STM32_I2C3 is not set
+# CONFIG_STM32_IWDG is not set
+# CONFIG_STM32_OTGFS is not set
+# CONFIG_STM32_OTGHS is not set
+CONFIG_STM32_PWR=y
+# CONFIG_STM32_RNG is not set
+# CONFIG_STM32_SDIO is not set
+# CONFIG_STM32_SPI1 is not set
+# CONFIG_STM32_SPI2 is not set
+# CONFIG_STM32_SPI3 is not set
+CONFIG_STM32_SYSCFG=y
+# CONFIG_STM32_TIM1 is not set
+# CONFIG_STM32_TIM2 is not set
+# CONFIG_STM32_TIM3 is not set
+# CONFIG_STM32_TIM4 is not set
+# CONFIG_STM32_TIM5 is not set
+# CONFIG_STM32_TIM6 is not set
+# CONFIG_STM32_TIM7 is not set
+# CONFIG_STM32_TIM8 is not set
+# CONFIG_STM32_TIM9 is not set
+# CONFIG_STM32_TIM10 is not set
+# CONFIG_STM32_TIM11 is not set
+# CONFIG_STM32_TIM12 is not set
+# CONFIG_STM32_TIM13 is not set
+# CONFIG_STM32_TIM14 is not set
+# CONFIG_STM32_USART1 is not set
+# CONFIG_STM32_USART2 is not set
+CONFIG_STM32_USART3=y
+# CONFIG_STM32_UART4 is not set
+# CONFIG_STM32_UART5 is not set
+# CONFIG_STM32_USART6 is not set
+# CONFIG_STM32_WWDG is not set
+
+#
+# Alternate Pin Mapping
+#
+# CONFIG_STM32_JTAG_DISABLE is not set
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set
+# CONFIG_STM32_JTAG_SW_ENABLE is not set
+# CONFIG_STM32_FORCEPOWER is not set
+# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
+# CONFIG_STM32_CCMEXCLUDE is not set
+
+#
+# Ethernet MAC configuration
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+# CONFIG_STM32_MII_MCO2 is not set
+# CONFIG_STM32_MII_EXTCLK is not set
+CONFIG_STM32_AUTONEG=y
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+# CONFIG_STM32_ETH_PTP is not set
+
+#
+# USB Host Configuration
+#
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_DMA is not set
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# Board Settings
+#
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_SIZE=196608
+CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
+# CONFIG_ARCH_INTERRUPTSTACK is not set
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_STM3240G_EVAL=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="stm3240g-eval"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_HAVE_BUTTONS=y
+# CONFIG_ARCH_BUTTONS is not set
+CONFIG_ARCH_HAVE_IRQBUTTONS=y
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+CONFIG_MSEC_PER_TICK=10
+CONFIG_RR_INTERVAL=200
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_DEV_CONSOLE=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WORKQUEUE is not set
+CONFIG_SCHED_WAITPID=y
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="xmlrpc_main"
+# CONFIG_DISABLE_OS_API is not set
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Stack and heap information
+#
+# CONFIG_CUSTOM_STACK is not set
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+
+#
+# Device Drivers
+#
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_PWM is not set
+CONFIG_I2C=y
+# CONFIG_I2C_SLAVE is not set
+CONFIG_I2C_TRANSFER=y
+# CONFIG_I2C_WRITEREAD is not set
+CONFIG_I2C_POLLED=y
+# CONFIG_I2C_TRACE is not set
+# CONFIG_SPI is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+# CONFIG_MTD is not set
+# CONFIG_NETDEVICES is not set
+# CONFIG_NET_SLIP is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_LOWLEVEL_CONSOLE is not set
+# CONFIG_16550_UART is not set
+CONFIG_ARCH_HAVE_USART3=y
+CONFIG_MCU_SERIAL=y
+CONFIG_STANDARD_SERIAL=y
+CONFIG_CONFIG_SERIAL_NPOLLWAITERS=2
+CONFIG_USART3_SERIAL_CONSOLE=y
+# CONFIG_NO_SERIAL_CONSOLE is not set
+
+#
+# USART3 Configuration
+#
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_USART3_BAUD=115200
+CONFIG_USART3_BITS=8
+CONFIG_USART3_PARITY=0
+CONFIG_USART3_2STOP=0
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+CONFIG_NET=y
+# CONFIG_NET_NOINTS is not set
+CONFIG_NET_MULTIBUFFER=y
+# CONFIG_NET_IPv6 is not set
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_NACTIVESOCKETS=16
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=650
+# CONFIG_NET_TCPURGDATA is not set
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_TCP_READAHEAD_BUFSIZE=562
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCP_RECVDELAY=0
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+# CONFIG_NET_PINGADDRCONF is not set
+# CONFIG_NET_IGMP is not set
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_RECEIVE_WINDOW=562
+CONFIG_NET_ARPTAB_SIZE=16
+CONFIG_NET_ARP_IPIN=y
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+# CONFIG_FS_FATTIME is not set
+# CONFIG_FAT_DMAMEMORY is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_NFS is not set
+# CONFIG_FS_NXFFS is not set
+# CONFIG_FS_ROMFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=2
+# CONFIG_GRAN is not set
+
+#
+# Library Routines
+#
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_LIB_HOMEDIR="/"
+# CONFIG_HAVE_LIBM is not set
+# CONFIG_NOPRINTF_FIELDWIDTH is not set
+# CONFIG_LIBC_FLOATINGPOINT is not set
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+# CONFIG_CXX_NEWLONG is not set
+
+#
+# Application Configuration
+#
+
+#
+# Named Applications
+#
+# CONFIG_NAMEDAPP is not set
+
+#
+# Examples
+#
+
+#
+# ADC Example
+#
+# CONFIG_EXAMPLES_ADC is not set
+
+#
+# Buttons Example
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+
+#
+# CAN Example
+#
+# CONFIG_EXAMPLES_CAN is not set
+
+#
+# USB CDC/ACM Class Driver Example
+#
+# CONFIG_EXAMPLES_CDCACM is not set
+
+#
+# USB composite Class Driver Example
+#
+# CONFIG_EXAMPLES_COMPOSITE is not set
+
+#
+# DHCP Server Example
+#
+# CONFIG_EXAMPLES_DHCPD is not set
+
+#
+# FTP Client Example
+#
+# CONFIG_EXAMPLES_FTPC is not set
+
+#
+# FTP Server Example
+#
+# CONFIG_EXAMPLES_FTPD is not set
+
+#
+# "Hello, World!" Example
+#
+# CONFIG_EXAMPLES_HELLO is not set
+
+#
+# "Hello, World!" C++ Example
+#
+# CONFIG_EXAMPLES_HELLOXX is not set
+
+#
+# USB HID Keyboard Example
+#
+# CONFIG_EXAMPLES_HIDKBD is not set
+
+#
+# IGMP Example
+#
+# CONFIG_EXAMPLES_IGMP is not set
+
+#
+# LCD Read/Write Example
+#
+# CONFIG_EXAMPLES_LCDRW is not set
+
+#
+# Memory Management Example
+#
+# CONFIG_EXAMPLES_MM is not set
+
+#
+# File System Mount Example
+#
+# CONFIG_EXAMPLES_MOUNT is not set
+
+#
+# FreeModBus Example
+#
+# CONFIG_EXAMPLES_MODBUS is not set
+
+#
+# Network Test Example
+#
+# CONFIG_EXAMPLES_NETTEST is not set
+
+#
+# NuttShell (NSH) Example
+#
+# CONFIG_EXAMPLES_NSH is not set
+
+#
+# NULL Example
+#
+# CONFIG_EXAMPLES_NULL is not set
+
+#
+# NX Graphics Example
+#
+# CONFIG_EXAMPLES_NX is not set
+
+#
+# NxConsole Example
+#
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+
+#
+# NXFFS File System Example
+#
+# CONFIG_EXAMPLES_NXFFS is not set
+
+#
+# NXFLAT Example
+#
+# CONFIG_EXAMPLES_NXFLAT is not set
+
+#
+# NX Graphics "Hello, World!" Example
+#
+# CONFIG_EXAMPLES_NXHELLO is not set
+
+#
+# NX Graphics image Example
+#
+# CONFIG_EXAMPLES_NXIMAGE is not set
+
+#
+# NX Graphics lines Example
+#
+# CONFIG_EXAMPLES_NXLINES is not set
+
+#
+# NX Graphics Text Example
+#
+# CONFIG_EXAMPLES_NXTEXT is not set
+
+#
+# OS Test Example
+#
+# CONFIG_EXAMPLES_OSTEST is not set
+
+#
+# Pascal "Hello, World!"example
+#
+# CONFIG_EXAMPLES_PASHELLO is not set
+
+#
+# Pipe Example
+#
+# CONFIG_EXAMPLES_PIPE is not set
+
+#
+# Poll Example
+#
+# CONFIG_EXAMPLES_POLL is not set
+
+#
+# Pulse Width Modulation (PWM) Example
+#
+
+#
+# Quadrature Encoder Example
+#
+# CONFIG_EXAMPLES_QENCODER is not set
+
+#
+# RGMP Example
+#
+# CONFIG_EXAMPLES_RGMP is not set
+
+#
+# ROMFS Example
+#
+# CONFIG_EXAMPLES_ROMFS is not set
+
+#
+# sendmail Example
+#
+# CONFIG_EXAMPLES_SENDMAIL is not set
+
+#
+# Serial Loopback Example
+#
+# CONFIG_EXAMPLES_SERLOOP is not set
+
+#
+# Telnet Daemon Example
+#
+# CONFIG_EXAMPLES_TELNETD is not set
+
+#
+# THTTPD Web Server Example
+#
+# CONFIG_EXAMPLES_THTTPD is not set
+
+#
+# TIFF Generation Example
+#
+# CONFIG_EXAMPLES_TIFF is not set
+
+#
+# Touchscreen Example
+#
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+
+#
+# UDP Example
+#
+# CONFIG_EXAMPLES_UDP is not set
+
+#
+# UDP Discovery Daemon Example
+#
+# CONFIG_EXAMPLE_DISCOVER is not set
+
+#
+# uIP Web Server Example
+#
+# CONFIG_EXAMPLES_UIP is not set
+
+#
+# USB Serial Test Example
+#
+# CONFIG_EXAMPLES_USBSERIAL is not set
+
+#
+# USB Mass Storage Class Example
+#
+# CONFIG_EXAMPLES_USBMSC is not set
+
+#
+# USB Serial Terminal Example
+#
+# CONFIG_EXAMPLES_USBTERM is not set
+
+#
+# Watchdog timer Example
+#
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# wget Example
+#
+# CONFIG_EXAMPLES_WGET is not set
+
+#
+# WLAN Example
+#
+# CONFIG_EXAMPLES_WLAN is not set
+
+#
+# XML RPC Example
+#
+CONFIG_EXAMPLES_XMLRPC=y
+CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE=1024
+CONFIG_EXAMPLES_XMLRPC_DHCPC=y
+CONFIG_EXAMPLES_XMLRPC_NOMAC=y
+CONFIG_EXAMPLES_XMLRPC_DRIPADDR=0x0a000001
+CONFIG_EXAMPLES_XMLRPC_NETMASK=0xffffff00
+
+#
+# Interpreters
+#
+
+#
+# Interpreters
+#
+# CONFIG_FICL is not set
+# CONFIG_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+
+#
+# DHCP client
+#
+CONFIG_NETUTILS_DHCPC=y
+
+#
+# DHCP server
+#
+# CONFIG_NETUTILS_DHCPD is not set
+
+#
+# FTP client
+#
+# CONFIG_NETUTILS_FTPC is not set
+
+#
+# FTP server
+#
+# CONFIG_NETUTILS_FTPD is not set
+
+#
+# Name resolution
+#
+CONFIG_NETUTILS_RESOLV=y
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# SMTP
+#
+# CONFIG_NETUTILS_SMTP is not set
+
+#
+# TFTP client
+#
+# CONFIG_NETUTILS_TELNETD is not set
+
+#
+# TFTP client
+#
+# CONFIG_NETUTILS_TFTPC is not set
+
+#
+# THTTPD web server
+#
+# CONFIG_NETUTILS_THTTPD is not set
+
+#
+# uIP support library
+#
+CONFIG_NETUTILS_UIPLIB=y
+
+#
+# uIP web client
+#
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# uIP web server
+#
+# CONFIG_NETUTILS_WEBSERVER is not set
+
+#
+# UDP Discovery Utility
+#
+# CONFIG_NETUTILS_DISCOVER is not set
+
+#
+# XML-RPC library
+#
+CONFIG_NETUTILS_XMLRPC=y
+CONFIG_XMLRPC_STRINGSIZE=64
+
+#
+# ModBus
+#
+
+#
+# FreeModbus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# System NSH Add-Ons
+#
+
+#
+# Custom free memory command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+# CONFIG_SYSTEM_I2CTOOL is not set
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# readline() support
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# VSN board Add-Ons
+#
+
+#
+# VSN board add-ons
+#
+# CONFIG_VSN_POWEROFF is not set
+# CONFIG_VSN_RAMTRON is not set
+# CONFIG_VSN_SDCARD is not set
+# CONFIG_VSN_SYSINFO is not set
diff --git a/nuttx/configs/stm3240g-eval/xmlrpc/setenv.sh b/nuttx/configs/stm3240g-eval/xmlrpc/setenv.sh
new file mode 100644
index 000000000..847be2a89
--- /dev/null
+++ b/nuttx/configs/stm3240g-eval/xmlrpc/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm3240g-eval/xmlrpc/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm32f4discovery/Kconfig b/nuttx/configs/stm32f4discovery/Kconfig
new file mode 100644
index 000000000..af94245c4
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/Kconfig
@@ -0,0 +1,57 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_STM32F4_DISCOVERY
+
+config PM_BUTTONS
+ bool "PM Button support"
+ default n
+ depends on PM && ARCH_IRQBUTTONS
+ ---help---
+ Enable PM button EXTI interrupts to support PM testing
+
+config PM_BUTTON_ACTIVITY
+ int "Button PM activity weight"
+ default 10
+ depends on PM_BUTTONS
+ ---help---
+ The activity weight to report to the power management subsystem when a button is pressed.
+
+config PM_ALARM_SEC
+ int "PM_STANDBY delay (seconds)"
+ default 15
+ depends on PM && RTC_ALARM
+ --help---
+ Number of seconds to wait in PM_STANDBY before going to PM_STANDBY mode.
+
+config PM_ALARM_NSEC
+ int "PM_STANDBY delay (nanoseconds)"
+ default 0
+ depends on PM && RTC_ALARM
+ --help---
+ Number of additional nanoseconds to wait in PM_STANDBY before going to PM_STANDBY mode.
+
+config PM_SLEEP_WAKEUP
+ bool "PM_SLEEP wake-up alarm"
+ default n
+ depends on PM && RTC_ALARM
+ --help---
+ Wake-up of PM_SLEEP mode after a delay and resume normal operation.
+
+config PM_SLEEP_WAKEUP_SEC
+ int "PM_SLEEP delay (seconds)"
+ default 10
+ depends on PM && RTC_ALARM
+ --help---
+ Number of seconds to wait in PM_SLEEP before going to PM_STANDBY mode.
+
+config PM_SLEEP_WAKEUP_NSEC
+ int "PM_SLEEP delay (nanoseconds)"
+ default 0
+ depends on PM && RTC_ALARM
+ --help---
+ Number of additional nanoseconds to wait in PM_SLEEP before going to PM_STANDBY mode.
+
+endif
diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt
new file mode 100644
index 000000000..12b30c62c
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/README.txt
@@ -0,0 +1,1195 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the
+STMicro STM32F4 Discovery development board.
+
+Contents
+========
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - LEDs
+ - PWM
+ - UARTs
+ - Timer Inputs/Outputs
+ - FPU
+ - FSMC SRAM
+ - SSD1289
+ - STM32F4Discovery-specific Configuration Options
+ - Configurations
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Raisonance R-Link emulatator and some RIDE7 development tools
+ were used and those tools works only under Windows.
+
+GNU Toolchain Options
+=====================
+
+ Toolchain Configurations
+ ------------------------
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The Atollic Toolchain,
+ 3. The devkitARM GNU toolchain,
+ 4. Raisonance GNU toolchain, or
+ 5. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the CodeSourcery toolchain for Windows. To use
+ the Atollic, devkitARM, Raisonance GNU, or NuttX buildroot toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_ATOLLIC_LITE=y : The free, "Lite" version of Atollic toolchain under Windows
+ CONFIG_STM32_ATOLLIC_PRO=y : The paid, "Pro" version of Atollic toolchain under Windows
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you change the default toolchain, then you may also have to modify the PATH in
+ the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), Atollic, devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ The CodeSourcery Toolchain (2009q1)
+ -----------------------------------
+ The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ The Atollic "Pro" and "Lite" Toolchain
+ --------------------------------------
+ One problem that I had with the Atollic toolchains is that the provide a gcc.exe
+ and g++.exe in the same bin/ file as their ARM binaries. If the Atollic bin/ path
+ appears in your PATH variable before /usr/bin, then you will get the wrong gcc
+ when you try to build host executables. This will cause to strange, uninterpretable
+ errors build some host binaries in tools/ when you first make.
+
+ Also, the Atollic toolchains are the only toolchains that have built-in support for
+ the FPU in these configurations. If you plan to use the Cortex-M4 FPU, you will
+ need to use the Atollic toolchain for now. See the FPU section below for more
+ information.
+
+ The Atollic "Lite" Toolchain
+ ----------------------------
+ The free, "Lite" version of the Atollic toolchain does not support C++ nor
+ does it support ar, nm, objdump, or objdcopy. If you use the Atollic "Lite"
+ toolchain, you will have to set:
+
+ CONFIG_HAVE_CXX=n
+
+ In order to compile successfully. Otherwise, you will get errors like:
+
+ "C++ Compiler only available in TrueSTUDIO Professional"
+
+ The make may then fail in some of the post link processing because of some of
+ the other missing tools. The Make.defs file replaces the ar and nm with
+ the default system x86 tool versions and these seem to work okay. Disable all
+ of the following to avoid using objcopy:
+
+ CONFIG_RRLOAD_BINARY=n
+ CONFIG_INTELHEX_BINARY=n
+ CONFIG_MOTOROLA_SREC=n
+ CONFIG_RAW_BINARY=n
+
+ devkitARM
+ ---------
+ The devkitARM toolchain includes a version of MSYS make. Make sure that the
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh STM32F4Discovery/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+LEDs
+====
+
+The STM32F4Discovery board has four LEDs; green, organge, red and blue on the
+board.. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
+defined. In that case, the usage by the board port is defined in
+include/board.h and src/up_leds.c. The LEDs are used to encode OS-related
+events as follows:
+
+ SYMBOL Meaning LED1* LED2 LED3 LED4
+ green orange red blue
+ ------------------- ----------------------- ------- ------- ------- ------
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
+ is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+*** LED2 may also flicker normally if signals are processed.
+
+PWM
+===
+
+The STM32F4Discovery has no real on-board PWM devices, but the board can be
+configured to output a pulse train using TIM4 CH2 on PD3. This pin is
+available next to the audio jack.
+
+UART
+====
+
+UART/USART PINS
+---------------
+
+USART1
+ CK PA8
+ CTS PA11*
+ RTS PA12*
+ RX PA10*, PB7
+ TX PA9*, PB6*
+USART2
+ CK PA4*, PD7
+ CTS PA0*, PD3
+ RTS PA1, PD4*
+ RX PA3, PD6
+ TX PA2, PD5*
+USART3
+ CK PB12, PC12*, PD10
+ CTS PB13, PD11
+ RTS PB14, PD12*
+ RX PB11, PC11, PD9
+ TX PB10*, PC10*, PD8
+UART4
+ RX PA1, PC11
+ TX PA0*, PC10*
+UART5
+ RX PD2
+ TX PC12*
+USART6
+ CK PC8, PG7**
+ CTS PG13**, PG15**
+ RTS PG12**, PG8**
+ RX PC7*, PG9**
+ TX PC6, PG14**
+
+ * Indicates pins that have other on-board functions and should be used only
+ with care (See table 5 in the STM32F4Discovery User Guide). The rest are
+ free I/O pins.
+** Port G pins are not supported by the MCU
+
+Default USART/UART Configuration
+--------------------------------
+
+USART2 is enabled in all configurations (see */defconfig). RX and TX are
+configured on pins PA3 and PA2, respectively (see include/board.h).
+
+Timer Inputs/Outputs
+====================
+
+TIM1
+ CH1 PA8, PE9
+ CH2 PA9*, PE11
+ CH3 PA10*, PE13
+ CH4 PA11*, PE14
+TIM2
+ CH1 PA0*, PA15, PA5*
+ CH2 PA1, PB3*
+ CH3 PA2, PB10*
+ CH4 PA3, PB11
+TIM3
+ CH1 PA6*, PB4, PC6
+ CH2 PA7*, PB5, PC7*
+ CH3 PB0, PC8
+ CH4 PB1, PC9
+TIM4
+ CH1 PB6*, PD12*
+ CH2 PB7, PD13*
+ CH3 PB8, PD14*
+ CH4 PB9*, PD15*
+TIM5
+ CH1 PA0*, PH10**
+ CH2 PA1, PH11**
+ CH3 PA2, PH12**
+ CH4 PA3, PI0
+TIM8
+ CH1 PC6, PI5
+ CH2 PC7*, PI6
+ CH3 PC8, PI7
+ CH4 PC9, PI2
+TIM9
+ CH1 PA2, PE5
+ CH2 PA3, PE6
+TIM10
+ CH1 PB8, PF6
+TIM11
+ CH1 PB9*, PF7
+TIM12
+ CH1 PH6**, PB14
+ CH2 PC15, PH9**
+TIM13
+ CH1 PA6*, PF8
+TIM14
+ CH1 PA7*, PF9
+
+ * Indicates pins that have other on-board functions and should be used only
+ with care (See table 5 in the STM32F4Discovery User Guide). The rest are
+ free I/O pins.
+** Port H pins are not supported by the MCU
+
+Quadrature Encode Timer Inputs
+------------------------------
+
+If enabled (by setting CONFIG_QENCODER=y), then quadrature encoder will
+use either TIM2 or TIM8 (see nsh/defconfig). If TIM2 is selected, the input
+pins PA15 and PA1 for CH1 and CH2, respectively). If TIM8 is selected, then
+PC6 and PI5 will be used for CH1 and CH2 (see include board.h for pin
+definitions).
+
+FPU
+===
+
+FPU Configuration Options
+-------------------------
+
+There are two version of the FPU support built into the STM32 port.
+
+1. Lazy Floating Point Register Save.
+
+ This is an untested implementation that saves and restores FPU registers
+ only on context switches. This means: (1) floating point registers are
+ not stored on each context switch and, hence, possibly better interrupt
+ performance. But, (2) since floating point registers are not saved,
+ you cannot use floating point operations within interrupt handlers.
+
+ This logic can be enabled by simply adding the following to your .config
+ file:
+
+ CONFIG_ARCH_FPU=y
+
+2. Non-Lazy Floating Point Register Save
+
+ Mike Smith has contributed an extensive re-write of the ARMv7-M exception
+ handling logic. This includes verified support for the FPU. These changes
+ have not yet been incorporated into the mainline and are still considered
+ experimental. These FPU logic can be enabled with:
+
+ CONFIG_ARCH_FPU=y
+ CONFIG_ARMV7M_CMNVECTOR=y
+
+ You will probably also changes to the ld.script in if this option is selected.
+ This should work:
+
+ -ENTRY(_stext)
+ +ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
+ +EXTERN(_vectors) /* Force the vectors to be included in the output */
+
+CFLAGS
+------
+
+Only the Atollic toolchain has built-in support for the Cortex-M4 FPU. You will see
+the following lines in each Make.defs file:
+
+ ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ ...
+ ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+ else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ endif
+ endif
+
+If you are using a toolchain other than the Atollic toolchain, then to use the FPU
+you will also have to modify the CFLAGS to enable compiler support for the ARMv7-M
+FPU. As of this writing, there are not many GCC toolchains that will support the
+ARMv7-M FPU.
+
+As a minimum you will need to add CFLAG options to (1) enable hardware floating point
+code generation, and to (2) select the FPU implementation. You might try the same
+options as used with the Atollic toolchain in the Make.defs file:
+
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+
+FSMC SRAM
+=========
+
+On-board SRAM
+-------------
+The STM32F4Discovery has no on-board SRAM. The information here is only for
+reference in case you choose to add some.
+
+Configuration Options
+---------------------
+Internal SRAM is available in all members of the STM32 family. The F4 family
+also contains internal CCM SRAM. This SRAM is different because it cannot
+be used for DMA. So if DMA needed, then the following should be defined
+to exclude CCM SRAM from the heap:
+
+ CONFIG_STM32_CCMEXCLUDE : Exclude CCM SRAM from the HEAP
+
+In addition to internal SRAM, SRAM may also be available through the FSMC.
+In order to use FSMC SRAM, the following additional things need to be
+present in the NuttX configuration file:
+
+ CONFIG_STM32_FSMC=y : Enables the FSMC
+ CONFIG_STM32_FSMC_SRAM=y : Indicates that SRAM is available via the
+ FSMC (as opposed to an LCD or FLASH).
+ CONFIG_HEAP2_BASE : The base address of the SRAM in the FSMC
+ address space
+ CONFIG_HEAP2_SIZE : The size of the SRAM in the FSMC
+ address space
+ CONFIG_MM_REGIONS : Must be set to a large enough value to
+ include the FSMC SRAM
+
+SRAM Configurations
+-------------------
+There are 4 possible SRAM configurations:
+
+ Configuration 1. System SRAM (only)
+ CONFIG_MM_REGIONS == 1
+ CONFIG_STM32_FSMC_SRAM NOT defined
+ CONFIG_STM32_CCMEXCLUDE defined
+ Configuration 2. System SRAM and CCM SRAM
+ CONFIG_MM_REGIONS == 2
+ CONFIG_STM32_FSMC_SRAM NOT defined
+ CONFIG_STM32_CCMEXCLUDE NOT defined
+ Configuration 3. System SRAM and FSMC SRAM
+ CONFIG_MM_REGIONS == 2
+ CONFIG_STM32_FSMC_SRAM defined
+ CONFIG_STM32_CCMEXCLUDE defined
+ Configuration 4. System SRAM, CCM SRAM, and FSMC SRAM
+ CONFIG_MM_REGIONS == 3
+ CONFIG_STM32_FSMC_SRAM defined
+ CONFIG_STM32_CCMEXCLUDE NOT defined
+
+Configuration Changes
+---------------------
+
+Below are all of the configuration changes that I had to make to configs/stm3240g-eval/nsh2
+in order to successfully build NuttX using the Atollic toolchain WITH FPU support:
+
+ -CONFIG_ARCH_FPU=n : Enable FPU support
+ +CONFIG_ARCH_FPU=y
+
+ -CONFIG_STM32_CODESOURCERYW=y : Disable the CodeSourcery toolchain
+ +CONFIG_STM32_CODESOURCERYW=n
+
+ -CONFIG_STM32_ATOLLIC_LITE=n : Enable *one* the Atollic toolchains
+ CONFIG_STM32_ATOLLIC_PRO=n
+ -CONFIG_STM32_ATOLLIC_LITE=y : The "Lite" version
+ CONFIG_STM32_ATOLLIC_PRO=n : The "Pro" version
+
+ -CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
+ +CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_HAVE_CXX=y : Suppress generation of C++ code
+ +CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
+
+See the section above on Toolchains, NOTE 2, for explanations for some of
+the configuration settings. Some of the usual settings are just not supported
+by the "Lite" version of the Atollic toolchain.
+
+SSD1289
+=======
+
+I purchased an LCD display on eBay from china. The LCD is 320x240 RGB565 and
+is based on an SSD1289 LCD controller and an XPT2046 touch IC. The pin out
+from the 2x16 connect on the LCD is labeled as follows:
+
+LCD CONNECTOR: SSD1289 MPU INTERFACE PINS:
+
+ +------+------+ DEN I Display enable pin
+1 | GND | 3V3 | 2 VSYNC I Frame synchronization signal
+ +------+------+ HSYNC I Line synchronization signal
+3 | D1 | D0 | 4 DOTCLK I Dot clock and OSC source
+ +------+------+ DC I Data or command
+5 | D3 | D2 | 6 E (~RD) I Enable/Read strobe
+ +------+------+ R (~WR) I Read/Write strobe
+7 | D5 | D4 | 8 D0-D17 IO For parallel mode, 8/9/16/18 bit interface
+ +------+------+ WSYNC O RAM write synchronizatin output
+9 | D7 | D6 | 10 ~RES I System reset
+ +------+------+ ~CS I Chip select of serial interface
+11 | D9 | D8 | 12 SCK I Clock of serial interface
+ +------+------+ SDI I Data input in serial mode
+13 | D11 | D10 | 14 SDO O Data output in serial moce
+ +------+------+
+15 | D13 | D12 | 16
+ +------+------+
+17 | D15 | D14 | 18
+ +------+------+
+19 | RS | CS | 20
+ +------+------+
+21 | RD | WR | 22 NOTES:
+ +------+------+
+23 |BL_CNT|RESET | 24 BL_CNT is the PWM backlight level control.
+ +------+------+
+25 |TP_RQ |TP_S0 | 26 These pins are for the touch panel: TP_REQ
+ +------+------+ TP_S0, TP_SI, TP_SCX, and TP_CS
+27 | NC |TP_SI | 28
+ +------+------+
+29 | NC |TP_SCX| 30
+ +------+------+
+31 | NC |TP_CS | 32
+ +------+------+
+
+MAPPING TO STM32 F4:
+
+ ---------------- -------------- ----------------------------------
+ STM32 FUNCTION LCD PIN STM32F4Discovery PIN
+ ---------------- -------------- ----------------------------------
+ FSMC_D0 D0 pin 4 PD14 P1 pin 46 Conflict (Note 1)
+ FSMC_D1 D1 pin 3 PD15 P1 pin 47 Conflict (Note 2)
+ FSMC_D2 D2 pin 6 PD0 P2 pin 36 Free I/O
+ FSMC_D3 D3 pin 5 PD1 P2 pin 33 Free I/O
+ FSMC_D4 D4 pin 8 PE7 P1 pin 25 Free I/O
+ FSMC_D5 D5 pin 7 PE8 P1 pin 26 Free I/O
+ FSMC_D6 D6 pin 10 PE9 P1 pin 27 Free I/O
+ FSMC_D7 D7 pin 9 PE10 P1 pin 28 Free I/O
+ FSMC_D8 D8 pin 12 PE11 P1 pin 29 Free I/O
+ FSMC_D9 D9 pin 11 PE12 P1 pin 30 Free I/O
+ FSMC_D10 D10 pin 14 PE13 P1 pin 31 Free I/O
+ FSMC_D11 D11 pin 13 PE14 P1 pin 32 Free I/O
+ FSMC_D12 D12 pin 16 PE15 P1 pin 33 Free I/O
+ FSMC_D13 D13 pin 15 PD8 P1 pin 40 Free I/O
+ FSMC_D14 D14 pin 18 PD9 P1 pin 41 Free I/O
+ FSMC_D15 D15 pin 17 PD10 P1 pin 42 Free I/O
+ FSMC_A16 RS pin 19 PD11 P1 pin 27 Free I/O
+ FSMC_NE1 ~CS pin 10 PD7 P2 pin 27 Free I/O
+ FSMC_NWE ~WR pin 22 PD5 P2 pin 29 Conflict (Note 3)
+ FSMC_NOE ~RD pin 21 PD4 P2 pin 32 Conflict (Note 4)
+ PC6 RESET pin 24 PC6 P2 pin 47 Free I/O
+ Timer ouput BL_CNT pin 23 (to be determined)
+ ---------------- -------------- ----------------------------------
+
+ 1 Used for the RED LED
+ 2 Used for the BLUE LED
+ 3 Used for the RED LED and for OTG FS Overcurrent. It may be okay to use
+ for the parallel interface if PC0 is held high (or floating). PC0 enables
+ the STMPS2141STR IC power switch that drives the OTG FS host VBUS.
+ 4 Also the reset pin for the CS43L22 audio Codec.
+
+NOTE: The configuration to test this LCD configuration is available at
+configs/stm32f4discover/nxlines. As of this writing, I have not seen the
+LCD working so I probaby have some things wrong.
+
+I might need to use a bit-baning interface. Below is the pin configurationf
+of a similar LCD to support a (write-only), bit banging interface:
+
+ LCD PIN BOARD CONNECTION
+ LEDA 5V
+ VCC 5V
+ RD 3.3V
+ GND GND
+ DB0-7 Port C pins configured as outputs
+ DB8-15 Port A pins configured as outputs
+ RS Pin configured as output
+ WR Pin configured as output
+ CS Pin configured as output
+ RSET Pin configured as output
+
+The following summarize the bit banging oprations:
+
+ /* Rese the LCD */
+ void Reset(void)
+ {
+ Set RSET output
+ delay
+ Clear RSET output
+ delay
+ Set RSET output
+ }
+
+ /* Write 16-bits of whatever */
+ void Write16(uint8_t ms, uint8_t ls)
+ {
+ Set port A to ms
+ Set port B to ls
+
+ Clear WR pin
+ Set WR pin
+ }
+
+ /* Set the index register to an LCD register address */
+ void Index(uint8_t address)
+ {
+ Clear RS
+ Write16(0, address);
+ }
+
+ /* Write data to the LCD register or GRAM memory */
+ void WriteData(uin16_t data)
+ {
+ Set RS
+ Write16(data >> 8, data & 0xff);
+ }
+
+ /* Write to a register */
+ void WriteRegister(uint8_t address, uint16_t data)
+ {
+ Index(address);
+ WriteData(data);
+ }
+
+STM32F4Discovery-specific Configuration Options
+===============================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM4=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F407VG=y
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
+ configuration features.
+
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=STM32F4Discovery (for the STM32F4Discovery development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_STM32_CCMEXCLUDE - Exclude CCM SRAM from the HEAP
+
+ In addition to internal SRAM, SRAM may also be available through the FSMC.
+ In order to use FSMC SRAM, the following additional things need to be
+ present in the NuttX configuration file:
+
+ CONFIG_STM32_FSMC_SRAM - Indicates that SRAM is available via the
+ FSMC (as opposed to an LCD or FLASH).
+
+ CONFIG_HEAP2_BASE - The base address of the SRAM in the FSMC address space (hex)
+
+ CONFIG_HEAP2_SIZE - The size of the SRAM in the FSMC address space (decimal)
+
+ CONFIG_ARCH_IRQPRIO - The STM32F4Discovery supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_FPU - The STM32F4Discovery supports a floating point unit (FPU)
+
+ CONFIG_ARCH_FPU=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ AHB1
+ ----
+ CONFIG_STM32_CRC
+ CONFIG_STM32_BKPSRAM
+ CONFIG_STM32_CCMDATARAM
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_ETHMAC
+ CONFIG_STM32_OTGHS
+
+ AHB2
+ ----
+ CONFIG_STM32_DCMI
+ CONFIG_STM32_CRYP
+ CONFIG_STM32_HASH
+ CONFIG_STM32_RNG
+ CONFIG_STM32_OTGFS
+
+ AHB3
+ ----
+ CONFIG_STM32_FSMC
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_TIM12
+ CONFIG_STM32_TIM13
+ CONFIG_STM32_TIM14
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_IWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI3
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_I2C3
+ CONFIG_STM32_CAN1
+ CONFIG_STM32_CAN2
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_PWR -- Required for RTC
+
+ APB2
+ ----
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_USART6
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_ADC3
+ CONFIG_STM32_SDIO
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_SYSCFG
+ CONFIG_STM32_TIM9
+ CONFIG_STM32_TIM10
+ CONFIG_STM32_TIM11
+
+ Timer devices may be used for different purposes. One special purpose is
+ to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
+ is defined (as above) then the following may also be defined to indicate that
+ the timer is intended to be used for pulsed output modulation, ADC conversion,
+ or DAC conversion. Note that ADC/DAC require two definition: Not only do you have
+ to assign the timer (n) for used by the ADC or DAC, but then you also have to
+ configure which ADC or DAC (m) it is assigned to.
+
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,14
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,14
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,14, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,14
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,14, m=1,..,2
+
+ For each timer that is enabled for PWM usage, we need the following additional
+ configuration settings:
+
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+
+ NOTE: The STM32 timers are each capable of generating different signals on
+ each of the four channels with different duty cycles. That capability is
+ not supported by this driver: Only one output channel per timer.
+
+ JTAG Enable settings (by default only SW-DP is enabled):
+
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+
+ STM32F4Discovery specific device driver settings
+
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ m (m=4,5) for the console and ttys0 (default is the USART1).
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ STM32F4Discovery CAN Configuration
+
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
+
+ STM32F4Discovery SPI Configuration
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ STM32F4Discovery DMA Configuration
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
+
+ STM32 USB OTG FS Host Driver Support
+
+ Pre-requisites
+
+ CONFIG_USBDEV - Enable USB device support
+ CONFIG_USBHOST - Enable USB host support
+ CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG - Needed
+ CONFIG_SCHED_WORKQUEUE - Worker thread support is required
+
+ Options:
+
+ CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
+ Default 128 (512 bytes)
+ CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
+ in 32-bit words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
+ words. Default 96 (384 bytes)
+ CONFIG_STM32_OTGFS_DESCSIZE - Maximum size of a descriptor. Default: 128
+ CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
+ want to do that?
+ CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
+ debug. Depends on CONFIG_DEBUG.
+ CONFIG_STM32_USBHOST_PKTDUMP - Dump all incoming and outgoing USB
+ packets. Depends on CONFIG_DEBUG.
+
+Configurations
+==============
+
+Each STM32F4Discovery configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh STM32F4Discovery/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ Default toolchain:
+
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux / Mac OS X
+
+ If you use the Atollic toolchain, then the FPU test can be enabled in the
+ examples/ostest by adding the following your NuttX configuration file:
+
+ -CONFIG_ARCH_FPU=n : Enable FPU support
+ +CONFIG_ARCH_FPU=y
+
+ -CONFIG_STM32_CODESOURCERYW=y : Disable the CodeSourcery toolchain
+ +CONFIG_STM32_CODESOURCERYW=n
+
+ -CONFIG_STM32_ATOLLIC_LITE=n : Enable *one* the Atollic toolchains
+ CONFIG_STM32_ATOLLIC_PRO=n
+ -CONFIG_STM32_ATOLLIC_LITE=y : The "Lite" version
+ CONFIG_STM32_ATOLLIC_PRO=n : The "Pro" version
+
+ -CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
+ +CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_HAVE_CXX=y : Suppress generation of C++ code
+ +CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
+
+ -CONFIG_SCHED_WAITPID=y : Enable the waitpid() API needed by the FPU test
+ +CONFIG_SCHED_WAITPID=n
+
+ The FPU test also needs to know the size of the FPU registers save area in
+ bytes (see arch/arm/include/armv7-m/irq_lazyfpu.h):
+
+ -CONFIG_EXAMPLES_OSTEST_FPUSIZE=(4*33)
+
+ nsh:
+ ---
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+
+ Default toolchain:
+
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux / Mac OS X
+
+ NOTES:
+ 1. This example supports the PWM test (apps/examples/pwm) but this must
+ be manually enabled by selecting:
+
+ CONFIG_PWM=y : Enable the generic PWM infrastructure
+ CONFIG_STM32_TIM4=y : Enable TIM4
+ CONFIG_STM32_TIM4_PWM=y : Use TIM4 to generate PWM output
+
+ See also apps/examples/README.txt
+
+ Special PWM-only debug options:
+
+ CONFIG_DEBUG_PWM
+
+ 2. This example supports the Quadrature Encode test (apps/examples/qencoder)
+ but this must be manually enabled by selecting:
+
+ CONFIG_QENCODER=y : Enable the generic Quadrature Encoder infrastructure
+ CONFIG_STM32_TIM8=y : Enable TIM8
+ CONFIG_STM32_TIM2=n : (Or optionally TIM2)
+ CONFIG_STM32_TIM8_QE=y : Use TIM8 as the quadrature encoder
+ CONFIG_STM32_TIM2_QE=y : (Or optionally TIM2)
+
+ See also apps/examples/README.txt
+
+ Special PWM-only debug options:
+
+ CONFIG_DEBUG_QENCODER
+
+ 3. This example supports the watchdog timer test (apps/examples/watchdog)
+ but this must be manually enabled by selecting:
+
+ CONFIG_WATCHDOG=y : Enables watchdog timer driver support
+ CONFIG_STM32_WWDG=y : Enables the WWDG timer facility, OR
+ CONFIG_STM32_IWDG=y : Enables the IWDG timer facility (but not both)
+
+ The WWDG watchdog is driven off the (fast) 42MHz PCLK1 and, as result,
+ has a maximum timeout value of 49 milliseconds. for WWDG watchdog, you
+ should also add the fillowing to the configuration file:
+
+ CONFIG_EXAMPLES_WATCHDOG_PINGDELAY=20
+ CONFIG_EXAMPLES_WATCHDOG_TIMEOUT=49
+
+ The IWDG timer has a range of about 35 seconds and should not be an issue.
+
+ 4. USB Support (CDC/ACM device)
+
+ CONFIG_STM32_OTGFS=y : STM32 OTG FS support
+ CONFIG_USBDEV=y : USB device support must be enabled
+ CONFIG_CDCACM=y : The CDC/ACM driver must be built
+ CONFIG_NSH_BUILTIN_APPS=y : NSH built-in application support must be enabled
+
+ 5. Using the USB console.
+
+ The STM32F4Discovery NSH configuration can be set up to use a USB CDC/ACM
+ (or PL2303) USB console. The normal way that you would configure the
+ the USB console would be to change the .config file like this:
+
+ CONFIG_STM32_OTGFS=y : STM32 OTG FS support
+ CONFIG_DEV_CONSOLE=n : Inhibit use of /dev/console by other logic
+ CONFIG_USBDEV=y : USB device support must be enabled
+ CONFIG_CDCACM=y : The CDC/ACM driver must be built
+ CONFIG_CDCACM_CONSOLE=y : Enable the CDC/ACM USB console.
+
+ However, that configuration does not work. It fails early probably because
+ of some dependency on /dev/console before the USB connection is established.
+
+ But there is a work around for this that works better (but has some side
+ effects). The following configuration will also create a NSH USB console
+ but this version will will use /dev/console. Instead, it will use the
+ normal /dev/ttyACM0 USB serial device for the console:
+
+ CONFIG_STM32_OTGFS=y : STM32 OTG FS support
+ CONFIG_USBDEV=y : USB device support must be enabled
+ CONFIG_CDCACM=y : The CDC/ACM driver must be built
+ CONFIG_CDCACM_CONSOLE=n : Done use the CDC/ACM USB console.
+ CONFIG_NSH_USBCONSOLE=y : Instead use some other USB device for the console
+
+ The particular USB device that is used is:
+
+ CONFIG_NSH_USBCONDEV="/dev/ttyACM0"
+
+ NOTE 1: When you first start the USB console, you have hit ENTER a few
+ times before NSH starts. The logic does this to prevent sending USB data
+ before there is anything on the host side listening for USB serial input.
+
+ Now the side effects:
+
+ NOTE 2. When any other device other than /dev/console is used for a user
+ interface, linefeeds (\n) will not be expanded to carriage return /
+ linefeeds (\r\n). You will need to set your terminal program to account
+ for this.
+
+ NOTE 3: /dev/console still exists and still refers to the serial port. So
+ you can still use certain kinds of debug output (see include/debug.h, all
+ of the interfaces based on lib_lowprintf will work in this configuration).
+
+ 6. USB OTG FS Host Support. The following changes will enable support for
+ a USB host on the STM32F4Discovery, including support for a mass storage
+ class driver:
+
+ CONFIG_USBDEV=n - Make sure tht USB device support is disabled
+ CONFIG_USBHOST=y - Enable USB host support
+ CONFIG_STM32_OTGFS=y - Enable the STM32 USB OTG FS block
+ CONFIG_STM32_SYSCFG=y - Needed for all USB OTF FS support
+ CONFIG_SCHED_WORKQUEUE=y - Worker thread support is required for the mass
+ storage class driver.
+ CONFIG_NSH_ARCHINIT=y - Architecture specific USB initialization
+ is needed for NSH
+ CONFIG_FS_FAT=y - Needed by the USB host mass storage class.
+
+ With those changes, you can use NSH with a FLASH pen driver as shown
+ belong. Here NSH is started with nothing in the USB host slot:
+
+ NuttShell (NSH) NuttX-x.yy
+ nsh> ls /dev
+ /dev:
+ console
+ null
+ ttyS0
+
+ After inserting the FLASH drive, the /dev/sda appears and can be
+ mounted like this:
+
+ nsh> ls /dev
+ /dev:
+ console
+ null
+ sda
+ ttyS0
+ nsh> mount -t vfat /dev/sda /mnt/stuff
+ nsh> ls /mnt/stuff
+ /mnt/stuff:
+ -rw-rw-rw- 16236 filea.c
+
+ And files on the FLASH can be manipulated to standard interfaces:
+
+ nsh> echo "This is a test" >/mnt/stuff/atest.txt
+ nsh> ls /mnt/stuff
+ /mnt/stuff:
+ -rw-rw-rw- 16236 filea.c
+ -rw-rw-rw- 16 atest.txt
+ nsh> cat /mnt/stuff/atest.txt
+ This is a test
+ nsh> cp /mnt/stuff/filea.c fileb.c
+ nsh> ls /mnt/stuff
+ /mnt/stuff:
+ -rw-rw-rw- 16236 filea.c
+ -rw-rw-rw- 16 atest.txt
+ -rw-rw-rw- 16236 fileb.c
+
+ To prevent data loss, don't forget to un-mount the FLASH drive
+ before removing it:
+
+ nsh> umount /mnt/stuff
+
+ nxlines:
+ ------
+ An example using the NuttX graphics system (NX). This example focuses on
+ placing lines on the background in various orientations.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_LCD_LANDSCAPE=y : 320x240 landscape orientation
+
+ The STM32F4Discovery board does not have any graphics capability. This
+ configuration assumes that you have connected an SD1289-based LCD as
+ described about under "SSD1289". NOTE: At present, it has not been
+ proven that the STM32F4Discovery can actually drive an LCD. There are
+ some issues with how some of the dedicated FSMC pins are used on the
+ boards. This configuration may not be useful and may only serve as
+ an illustration of how to build for th SSD1289 LCD.
+
+ Default toolchain:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ NOTE: As of this writing, I have not seen the LCD work!
+
+ pm:
+ --
+ This is a configuration that is used to test STM32 power management, i.e.,
+ to test that the board can go into lower and lower states of power usage
+ as a result of inactivity. This configuration is based on the nsh2
+ configuration with modifications for testing power management. This
+ configuration should provide some guideline for power management in your
+ STM32 application.
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+
+ CONFIG_PM_CUSTOMINIT and CONFIG_IDLE_CUSTOM are necessary parts of the
+ PM configuration:
+
+ CONFIG_PM_CUSTOMINIT=y
+
+ CONFIG_PM_CUSTOMINIT moves the PM initialization from arch/arm/src/stm32/stm32_pminitialiaze.c
+ to configs/stm3210-eval/src/up_pm.c. This allows us to support board-
+ specific PM initialization.
+
+ CONFIG_IDLE_CUSTOM=y
+
+ The bulk of the PM activities occur in the IDLE loop. The IDLE loop is
+ special because it is what runs when there is no other task running. Therefore
+ when the IDLE executes, we can be assure that nothing else is going on; this
+ is the ideal condition for doing reduced power management.
+
+ The configuration CONFIG_IDLE_CUSTOM allows us to "steal" the normal STM32
+ IDLE loop (of arch/arm/src/stm32/stm32_idle.c) and replace this with our own
+ custom IDLE loop (at configs/stm3210-eval/src/up_idle.c).
+
+ Here are some additional things to note in the configuration:
+
+ CONFIG_PM_BUTTONS=y
+
+ CONFIG_PM_BUTTONS enables button support for PM testing. Buttons can drive
+ EXTI interrupts and EXTI interrrupts can be used to wakeup for certain reduced
+ power modes (STOP mode). The use of the buttons here is for PM testing purposes
+ only; buttons would normally be part the application code and CONFIG_PM_BUTTONS
+ would not be defined.
+
+ CONFIG_RTC_ALARM=y
+
+ The RTC alarm is used to wake up from STOP mode and to transition to
+ STANDBY mode. This used of the RTC alarm could conflict with other uses of
+ the RTC alarm in your application.
diff --git a/nuttx/configs/stm32f4discovery/include/board.h b/nuttx/configs/stm32f4discovery/include/board.h
new file mode 100644
index 000000000..9b866d56f
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/include/board.h
@@ -0,0 +1,323 @@
+/************************************************************************************
+ * configs/stm32f4discovery/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIG_STM32F4DISCOVERY_INCLUDE_BOARD_H
+#define __CONFIG_STM32F4DISCOVERY_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* The STM32F4 Discovery board features a single 8MHz crystal. Space is provided
+ * for a 32kHz RTC backup crystal, but it is not stuffed.
+ *
+ * This is the canonical configuration:
+ * System Clock source : PLL (HSE)
+ * SYSCLK(Hz) : 168000000 Determined by PLL configuration
+ * HCLK(Hz) : 168000000 (STM32_RCC_CFGR_HPRE)
+ * AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
+ * APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
+ * APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
+ * HSE Frequency(Hz) : 25000000 (STM32_BOARD_XTAL)
+ * PLLM : 8 (STM32_PLLCFG_PLLM)
+ * PLLN : 336 (STM32_PLLCFG_PLLN)
+ * PLLP : 2 (STM32_PLLCFG_PLLP)
+ * PLLQ : 7 (STM32_PLLCFG_PLLQ)
+ * Main regulator output voltage : Scale1 mode Needed for high speed SYSCLK
+ * Flash Latency(WS) : 5
+ * Prefetch Buffer : OFF
+ * Instruction cache : ON
+ * Data cache : ON
+ * Require 48MHz for USB OTG FS, : Enabled
+ * SDIO and RNG clock
+ */
+
+/* HSI - 16 MHz RC factory-trimmed
+ * LSI - 32 KHz RC
+ * HSE - On-board crystal frequency is 25MHz
+ * LSE - 32.768 kHz
+ */
+
+#define STM32_BOARD_XTAL 8000000ul
+
+#define STM32_HSI_FREQUENCY 16000000ul
+#define STM32_LSI_FREQUENCY 32000
+#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
+#define STM32_LSE_FREQUENCY 32768
+
+/* Main PLL Configuration.
+ *
+ * PLL source is HSE
+ * PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
+ * = (25,000,000 / 25) * 336
+ * = 336,000,000
+ * SYSCLK = PLL_VCO / PLLP
+ * = 336,000,000 / 2 = 168,000,000
+ * USB OTG FS, SDIO and RNG Clock
+ * = PLL_VCO / PLLQ
+ * = 48,000,000
+ */
+
+#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(8)
+#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(336)
+#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
+#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(7)
+
+#define STM32_SYSCLK_FREQUENCY 168000000ul
+
+/* AHB clock (HCLK) is SYSCLK (168MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
+#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB1 clock (PCLK1) is HCLK/4 (42MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
+
+/* Timers driven from APB1 will be twice PCLK1 */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
+
+/* APB2 clock (PCLK2) is HCLK/2 (84MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
+#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* Timers driven from APB2 will be twice PCLK2 */
+
+#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
+
+/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
+ * otherwise frequency is 2xAPBx.
+ * Note: TIM1,8 are on APB2, others on APB1
+ */
+
+#define STM32_TIM18_FREQUENCY STM32_HCLK_FREQUENCY
+#define STM32_TIM27_FREQUENCY STM32_HCLK_FREQUENCY
+
+/* LED definitions ******************************************************************/
+/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
+ * way. The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with stm32_setled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_LED3 2
+#define BOARD_LED4 3
+#define BOARD_NLEDS 4
+
+#define BOARD_LED_GREEN BOARD_LED1
+#define BOARD_LED_ORANGE BOARD_LED2
+#define BOARD_LED_RED BOARD_LED3
+#define BOARD_LED_BLUE BOARD_LED4
+
+/* LED bits for use with stm32_setleds() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+#define BOARD_LED3_BIT (1 << BOARD_LED3)
+#define BOARD_LED4_BIT (1 << BOARD_LED4)
+
+/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on board the
+ * stm32f4discovery. The following definitions describe how NuttX controls the LEDs:
+ */
+
+#define LED_STARTED 0 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED2 */
+#define LED_IRQSENABLED 2 /* LED1 + LED2 */
+#define LED_STACKCREATED 3 /* LED3 */
+#define LED_INIRQ 4 /* LED1 + LED3 */
+#define LED_SIGNAL 5 /* LED2 + LED3 */
+#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
+#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+
+/* Button definitions ***************************************************************/
+/* The STM32F4 Discovery supports one button: */
+
+#define BUTTON_USER 0
+
+#define NUM_BUTTONS 1
+
+#define BUTTON_USER_BIT (1 << BUTTON_USER)
+
+/* Alternate function pin selections ************************************************/
+
+/* UART2:
+ *
+ * The STM32F4 Discovery has no on-board serial devices, but the console is
+ * brought out to PA2 (TX) and PA3 (RX) for connection to an external serial device.
+ * (See the README.txt file for other options)
+ */
+
+#define GPIO_USART2_RX GPIO_USART2_RX_1
+#define GPIO_USART2_TX GPIO_USART2_TX_1
+
+/* PWM
+ *
+ * The STM32F4 Discovery has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using TIM4 CH2 on PD13.
+ */
+
+#define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
+
+/* SPI */
+
+#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1
+#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1
+#define GPIO_SPI1_SCK GPIO_SPI1_SCK_1
+
+/* Timer Inputs/Outputs (see the README.txt file for options) */
+
+#define GPIO_TIM2_CH1IN GPIO_TIM2_CH1IN_2
+#define GPIO_TIM2_CH2IN GPIO_TIM2_CH2IN_1
+
+#define GPIO_TIM8_CH1IN GPIO_TIM8_CH1IN_1
+#define GPIO_TIM8_CH2IN GPIO_TIM8_CH2IN_1
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_ledinit, stm32_setled, and stm32_setleds
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
+ * CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
+ * control the LEDs from user applications.
+ *
+ ************************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void stm32_ledinit(void);
+EXTERN void stm32_setled(int led, bool ledon);
+EXTERN void stm32_setleds(uint8_t ledset);
+#endif
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIG_STM32F4DISCOVERY_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/stm32f4discovery/nsh/Make.defs b/nuttx/configs/stm32f4discovery/nsh/Make.defs
new file mode 100644
index 000000000..daf3851c8
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nsh/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm32f4discovery/nsh/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm32f4discovery/nsh/appconfig b/nuttx/configs/stm32f4discovery/nsh/appconfig
new file mode 100644
index 000000000..097948c87
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nsh/appconfig
@@ -0,0 +1,67 @@
+############################################################################
+# configs/stm32f4discovery/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_QENCODER),y)
+CONFIGURED_APPS += examples/qencoder
+endif
+
+ifeq ($(CONFIG_USBDEV),y)
+ifeq ($(CONFIG_CDCACM),y)
+CONFIGURED_APPS += examples/cdcacm
+endif
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
diff --git a/nuttx/configs/stm32f4discovery/nsh/defconfig b/nuttx/configs/stm32f4discovery/nsh/defconfig
new file mode 100644
index 000000000..8e1861d73
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nsh/defconfig
@@ -0,0 +1,713 @@
+############################################################################
+# configs/stm32f4discovery/nsh/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407VG=y
+CONFIG_ARCH_BOARD="stm32f4discovery"
+CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default only SW-DP is enabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=n
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=y
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=n
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=y
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=y
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific SPI device driver settings
+#
+CONFIG_SPI_EXCHANGE=y
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# PWM configuration
+#
+# The stm32f4discovery has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using TIM4 CH2. (Don't forget to set CONFIG_STM32_TIM4=y above)
+#
+CONFIG_PWM=n
+CONFIG_STM32_TIM4_PWM=y
+CONFIG_STM32_TIM4_CHANNEL=2
+
+#
+# Quadrature Encoder configuration.
+#
+CONFIG_QENCODER=n
+CONFIG_STM32_TIM2_QE=n
+CONFIG_STM32_TIM2_QECLKOUT=28000000
+CONFIG_STM32_TIM8_QE=y
+CONFIG_STM32_TIM8_QECLKOUT=28000000
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_QENCODER=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration (Prolifics PL2303 emulation)
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_USBCONSOLE=n
+CONFIG_NSH_USBCONDEV="/dev/ttyACM0"
+CONFIG_NSH_UBSDEV_MINOR=0
+CONFIG_NSH_USBDEV_TRACEINIT=n
+CONFIG_NSH_USBDEV_TRACECLASS=n
+CONFIG_NSH_USBDEV_TRACETRANSFERS=n
+CONFIG_NSH_USBDEV_TRACECONTROLLER=n
+CONFIG_NSH_USBDEV_TRACEINTERRUPTS=n
+#CONFIG_NSH_CONDEV
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/watchdog
+#
+
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm32f4discovery/nsh/setenv.sh b/nuttx/configs/stm32f4discovery/nsh/setenv.sh
new file mode 100755
index 000000000..65a7a3ab4
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nsh/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm32f4discovery/nsh/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm32f4discovery/nxlines/Make.defs b/nuttx/configs/stm32f4discovery/nxlines/Make.defs
new file mode 100644
index 000000000..4f2052ecc
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nxlines/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm32f4discovery/nxlines/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm32f4discovery/nxlines/appconfig b/nuttx/configs/stm32f4discovery/nxlines/appconfig
new file mode 100644
index 000000000..1f9921461
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nxlines/appconfig
@@ -0,0 +1,38 @@
+############################################################################
+# configs/stm32f4discovery/nxlines/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nxlines
diff --git a/nuttx/configs/stm32f4discovery/nxlines/defconfig b/nuttx/configs/stm32f4discovery/nxlines/defconfig
new file mode 100644
index 000000000..45d819e8a
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nxlines/defconfig
@@ -0,0 +1,731 @@
+############################################################################
+# configs/stm32f4discovery/nxlines/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407VG=y
+CONFIG_ARCH_BOARD="stm32f4discovery"
+CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default only SW-DP is enabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=n
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=y
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=n
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=y
+# AHB3:
+CONFIG_STM32_FSMC=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=y
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific SPI device driver settings
+#
+CONFIG_SPI_EXCHANGE=y
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# PWM configuration
+#
+# The stm32f4discovery has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using TIM4 CH2. (Don't forget to set CONFIG_STM32_TIM4=y above)
+#
+CONFIG_PWM=n
+CONFIG_STM32_TIM4_PWM=y
+CONFIG_STM32_TIM4_CHANNEL=2
+
+#
+# Quadrature Encoder configuration.
+#
+CONFIG_QENCODER=n
+CONFIG_STM32_TIM2_QE=n
+CONFIG_STM32_TIM2_QECLKOUT=28000000
+CONFIG_STM32_TIM8_QE=y
+CONFIG_STM32_TIM8_QECLKOUT=28000000
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nxlines_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_QENCODER=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration (Prolifics PL2303 emulation)
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=y
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=255
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0x5cb7
+CONFIG_NXTK_BORDERCOLOR2=0x21c9
+CONFIG_NXTK_BORDERCOLOR3=0xffdf
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=n
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=y
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=n
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# SSD1289 LCD Hardware Configuration
+#
+CONFIG_LCD_SSD1289=y
+CONFIG_LCD_NOGETRUN=n
+CONFIG_LCD_LANDSCAPE=y
+CONFIG_LCD_RLANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/watchdog
+#
+
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm32f4discovery/nxlines/setenv.sh b/nuttx/configs/stm32f4discovery/nxlines/setenv.sh
new file mode 100755
index 000000000..e188703a0
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/nxlines/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm32f4discovery/nxlines/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm32f4discovery/ostest/Make.defs b/nuttx/configs/stm32f4discovery/ostest/Make.defs
new file mode 100644
index 000000000..6b1ed2ff1
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/ostest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm32f4discovery/ostest/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm32f4discovery/ostest/appconfig b/nuttx/configs/stm32f4discovery/ostest/appconfig
new file mode 100644
index 000000000..266c7e327
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/stm32f4discovery/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/stm32f4discovery/ostest/defconfig b/nuttx/configs/stm32f4discovery/ostest/defconfig
new file mode 100644
index 000000000..5640cebd1
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/ostest/defconfig
@@ -0,0 +1,747 @@
+############################################################################
+# configs/stm32f4discovery/ostest/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407VG=y
+CONFIG_ARCH_BOARD="stm32f4discovery"
+CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=y
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default only SW-DP is enabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=n
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=y
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=n
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=n
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=n
+# APB2:
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F4Discovery specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MBPS
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=n
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=n
+CONFIG_RTC_ALARM=n
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=1
+CONFIG_LCD_MAXCONTRAST=1
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# NxWidgets
+CONFIG_NXWIDGETS_BPP=16
+CONFIG_NXWIDGETS_DEFAULT_FONTID=5
+
+#
+# stm32f4discovery LCD Hardware Configuration
+#
+CONFIG_LCD_LANDSCAPE=n
+CONFIG_LCD_PORTRAIT=n
+CONFIG_LCD_RPORTRAIT=y
+CONFIG_LCD_BACKLIGHT=y
+CONFIG_LCD_PWM=n
+CONFIG_STM32_AM240320_DISABLE=y
+CONFIG_STM32_SPFD5408B_DISABLE=n
+CONFIG_STM32_R61580_DISABLE=n
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+#CONFIG_NSH_CONDEV="/dev/ttyS1"
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/nx
+#
+CONFIG_EXAMPLES_NX_BUILTIN=n
+CONFIG_EXAMPLES_NX_VPLANE=0
+CONFIG_EXAMPLES_NX_DEVNO=0
+CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NX_COLOR1=0xaedc
+CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
+CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
+CONFIG_EXAMPLES_NX_FONTID=0
+CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
+CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_NX_RAWWINDOWS=n
+CONFIG_EXAMPLES_NX_STACKSIZE=2048
+CONFIG_EXAMPLES_NX_CLIENTPRIO=80
+CONFIG_EXAMPLES_NX_SERVERPRIO=120
+CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NX_EXTERNINIT=n
+
+#
+# Settings for examples/nxhello
+#
+CONFIG_EXAMPLES_NXHELLO_BUILTIN=n
+CONFIG_EXAMPLES_NXHELLO_VPLANE=0
+CONFIG_EXAMPLES_NXHELLO_DEVNO=0
+CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXHELLO_FONTID=6
+CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXHELLO_BPP=16
+CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
+
+#
+# Settings for examples/nximage
+#
+CONFIG_EXAMPLES_NXIMAGE_BUILTIN=n
+CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
+CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
+CONFIG_EXAMPLES_NXIMAGE_BPP=16
+CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
+CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
+CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
+CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
+
+#
+# Settings for examples/nxlines
+#
+CONFIG_EXAMPLES_NXLINES_BUILTIN=n
+CONFIG_EXAMPLES_NXLINES_VPLANE=0
+CONFIG_EXAMPLES_NXLINES_DEVNO=0
+CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+CONFIG_EXAMPLES_NXLINES_BPP=16
+CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
+
+#
+# Settings for examples/touchscreen
+#
+CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=n
+CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
+CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
+CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+
+#
+# Settings for examples/buttons
+#
+CONFIG_EXAMPLE_BUTTONS_MIN=0
+CONFIG_EXAMPLE_BUTTONS_MAX=2
+CONFIG_EXAMPLE_IRQBUTTONS_MIN=0
+CONFIG_EXAMPLE_IRQBUTTONS_MAX=2
+CONFIG_EXAMPLE_BUTTONS_NAME0="Key/Select"
+CONFIG_EXAMPLE_BUTTONS_NAME1="Left/Right"
+CONFIG_EXAMPLE_BUTTONS_NAME2="Up/Down"
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_BUILTIN=n
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/stm32f4discovery/ostest/setenv.sh b/nuttx/configs/stm32f4discovery/ostest/setenv.sh
new file mode 100755
index 000000000..d67f434d0
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/ostest/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm32f4discovery/ostest/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm32f4discovery/pm/Make.defs b/nuttx/configs/stm32f4discovery/pm/Make.defs
new file mode 100644
index 000000000..4c10a3251
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/pm/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/stm32f4discovery/pm/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_LITE),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV =
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_ATOLLIC_PRO),y)
+ # Atollic toolchain under Windows
+ CROSSDEV = arm-atollic-eabi-
+ ARCROSSDEV = arm-atollic-eabi-
+ WINTOOL = y
+ifeq ($(CONFIG_ARCH_FPU),y)
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+else
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ ARCROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ ARCROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+LDSCRIPT = ld.script
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(ARCROSSDEV)ar rcs
+NM = $(ARCROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/stm32f4discovery/pm/appconfig b/nuttx/configs/stm32f4discovery/pm/appconfig
new file mode 100644
index 000000000..010f1ef70
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/pm/appconfig
@@ -0,0 +1,67 @@
+############################################################################
+# configs/stm32f4discovery/pm/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH application library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Applications configured as an NX built-in commands
+
+ifeq ($(CONFIG_ADC),y)
+CONFIGURED_APPS += examples/adc
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CONFIGURED_APPS += examples/pwm
+endif
+
+ifeq ($(CONFIG_QENCODER),y)
+CONFIGURED_APPS += examples/qencoder
+endif
+
+ifeq ($(CONFIG_USBDEV),y)
+ifeq ($(CONFIG_CDCACM),y)
+CONFIGURED_APPS += examples/cdcacm
+endif
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CONFIGURED_APPS += examples/watchdog
+endif
diff --git a/nuttx/configs/stm32f4discovery/pm/defconfig b/nuttx/configs/stm32f4discovery/pm/defconfig
new file mode 100644
index 000000000..fb03c477e
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/pm/defconfig
@@ -0,0 +1,736 @@
+############################################################################
+# configs/stm32f4discovery/pm/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F407VG=y
+CONFIG_ARCH_BOARD="stm32f4discovery"
+CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_DRAM_SIZE=196608
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_FPU=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=n
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=y
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_ATOLLIC_LITE=n
+CONFIG_STM32_ATOLLIC_PRO=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=n
+
+#
+# JTAG Enable settings (by default only SW-DP is enabled):
+#
+CONFIG_STM32_DFU=n
+CONFIG_STM32_JTAG_FULL_ENABLE=n
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=y
+
+#
+# Individual subsystems can be enabled:
+#
+# AHB1:
+CONFIG_STM32_CRC=n
+CONFIG_STM32_BKPSRAM=n
+CONFIG_STM32_CCMDATARAM=n
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_ETHMAC=n
+CONFIG_STM32_OTGHS=n
+# AHB2:
+CONFIG_STM32_DCMI=n
+CONFIG_STM32_CRYP=n
+CONFIG_STM32_HASH=n
+CONFIG_STM32_RNG=n
+CONFIG_STM32_OTGFS=y
+# AHB3:
+CONFIG_STM32_FSMC=n
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=n
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_TIM12=n
+CONFIG_STM32_TIM13=n
+CONFIG_STM32_TIM14=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_IWDG=n
+CONFIG_STM32_SPI2=n
+CONFIG_STM32_SPI3=n
+CONFIG_STM32_USART2=y
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=n
+CONFIG_STM32_I2C2=n
+CONFIG_STM32_I2C3=n
+CONFIG_STM32_CAN1=n
+CONFIG_STM32_CAN2=n
+CONFIG_STM32_DAC=n
+CONFIG_STM32_PWR=y
+# APB2:
+CONFIG_STM32_TIM1=y
+CONFIG_STM32_TIM8=n
+CONFIG_STM32_USART1=n
+CONFIG_STM32_USART6=n
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_ADC3=n
+CONFIG_STM32_SDIO=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_SYSCFG=y
+CONFIG_STM32_TIM9=n
+CONFIG_STM32_TIM10=n
+CONFIG_STM32_TIM11=n
+
+#
+# STM32F40xxx specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=n
+CONFIG_USART2_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=128
+CONFIG_USART2_TXBUFSIZE=128
+CONFIG_USART3_TXBUFSIZE=128
+CONFIG_UART4_TXBUFSIZE=128
+CONFIG_UART5_TXBUFSIZE=128
+
+CONFIG_USART1_RXBUFSIZE=128
+CONFIG_USART2_RXBUFSIZE=128
+CONFIG_USART3_RXBUFSIZE=128
+CONFIG_UART4_RXBUFSIZE=128
+CONFIG_UART5_RXBUFSIZE=128
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# STM32F40xxx specific SPI device driver settings
+#
+CONFIG_SPI_EXCHANGE=y
+
+#
+# STM32F40xxx specific CAN device driver settings
+#
+CONFIG_CAN=n
+CONFIG_CAN_EXTID=n
+#CONFIG_CAN_FIFOSIZE
+#CONFIG_CAN_NPENDINGRTR
+CONFIG_CAN_LOOPBACK=n
+CONFIG_CAN1_BAUD=700000
+CONFIG_CAN2_BAUD=700000
+
+#
+# STM32F40xxx Ethernet device driver settings
+#
+CONFIG_STM32_PHYADDR=1
+CONFIG_STM32_MII=y
+CONFIG_STM32_MII_MCO1=y
+CONFIG_STM32_MII_MCO2=n
+CONFIG_STM32_RMII=n
+CONFIG_STM32_AUTONEG=y
+#CONFIG_STM32_ETHFD
+#CONFIG_STM32_ETH100MB
+CONFIG_STM32_PHYSR=16
+CONFIG_STM32_PHYSR_SPEED=0x0002
+CONFIG_STM32_PHYSR_100MBPS=0x0000
+CONFIG_STM32_PHYSR_MODE=0x0004
+CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
+CONFIG_STM32_ETH_PTP=n
+CONFIG_STM32_ETHMAC_REGDEBUG=n
+
+#
+# PWM configuration
+#
+# The stm32f4discovery has no real on-board PWM devices, but the board can be configured to output
+# a pulse train using TIM4 CH2. (Don't forget to set CONFIG_STM32_TIM4=y above)
+#
+CONFIG_PWM=n
+CONFIG_STM32_TIM4_PWM=y
+CONFIG_STM32_TIM4_CHANNEL=2
+
+#
+# Quadrature Encoder configuration.
+#
+CONFIG_QENCODER=n
+CONFIG_STM32_TIM2_QE=n
+CONFIG_STM32_TIM2_QECLKOUT=28000000
+CONFIG_STM32_TIM8_QE=y
+CONFIG_STM32_TIM8_QECLKOUT=28000000
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_GRAPHICS=n
+CONFIG_DEBUG_LCD=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_NET=n
+CONFIG_DEBUG_RTC=n
+CONFIG_DEBUG_ANALOG=n
+CONFIG_DEBUG_PWM=n
+CONFIG_DEBUG_CAN=n
+CONFIG_DEBUG_QENCODER=n
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_MM_REGIONS=2
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+# General Power Management Configuration
+# (see include/nuttx/power/pm.h for many more standard configuration options)
+#
+CONFIG_PM=y
+CONFIG_PM_CUSTOMINIT=y
+CONFIG_IDLE_CUSTOM=y
+
+#
+# Board/Application-Specific Power Management Configuration.
+# These settings are probably not meaningful outside of this configuration
+#
+# Button support can be built into the configs/stm3210e-eval/pm configuration
+# to support PM testing. These would not be part of a normal, operational
+# configuration.
+#
+CONFIG_PM_BUTTONS=y
+CONFIG_PM_IRQBUTTON=y
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Framebuffer driver options
+#
+CONFIG_FB_CMAP=n
+CONFIG_FB_HWCURSOR=n
+CONFIG_FB_HWCURSORIMAGE=n
+#CONFIG_FB_HWCURSORSIZE
+#CONFIG_FB_TRANSPARENCY
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# STM32 SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+#CONFIG_SDIO_PRI=128
+#CONFIG_SDIO_DMAPRIO
+#CONFIG_SDIO_WIDTH_D1_ONLY
+CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_NOINTS=n
+CONFIG_NET_MULTIBUFFER=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=10
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=40
+#CONFIG_NET_TCP_READAHEAD_BUFSIZE
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_ARP_IPIN=n
+CONFIG_NET_MULTICAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# RTC Configuration
+#
+CONFIG_RTC=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_HIRES=n
+CONFIG_RTC_FREQUENCY=1
+CONFIG_RTC_ALARM=y
+
+#
+# STM32 USB OTG FS Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
+# USB Serial Device Configuration (Prolifics PL2303 emulation)
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Watchdog timer configuration
+#
+CONFIG_WATCHDOG=n
+
+#
+# Graphics related configuration settings
+#
+CONFIG_NX=n
+CONFIG_NX_MULTIUSER=n
+CONFIG_NX_NPLANES=1
+CONFIG_NX_DISABLE_1BPP=y
+CONFIG_NX_DISABLE_2BPP=y
+CONFIG_NX_DISABLE_4BPP=y
+CONFIG_NX_DISABLE_8BPP=y
+CONFIG_NX_DISABLE_16BPP=n
+CONFIG_NX_DISABLE_24BPP=y
+CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_PACKEDMSFIRST=n
+CONFIG_NX_LCDDRIVER=y
+CONFIG_LCD_MAXPOWER=100
+CONFIG_LCD_MAXCONTRAST=100
+CONFIG_NX_MOUSE=y
+CONFIG_NX_KBD=y
+#CONFIG_NXTK_BORDERWIDTH=4
+CONFIG_NXTK_BORDERCOLOR1=0xd69a
+CONFIG_NXTK_BORDERCOLOR2=0xad55
+CONFIG_NXTK_AUTORAISE=n
+CONFIG_NXFONT_SANS17X22=y
+CONFIG_NXFONT_SANS20X26=n
+CONFIG_NXFONT_SANS22X29=n
+CONFIG_NXFONT_SANS23X27=n
+CONFIG_NXFONT_SANS28X37=n
+CONFIG_NXFONT_SANS17X23B=n
+CONFIG_NXFONT_SANS20X27B=y
+CONFIG_NXFONT_SANS22X29B=y
+CONFIG_NXFONT_SANS28X37B=n
+CONFIG_NXFONT_SANS40X49B=n
+CONFIG_NXFONT_SERIF22X29=n
+CONFIG_NXFONT_SERIF29X37=n
+CONFIG_NXFONT_SERIF38X48=n
+CONFIG_NXFONT_SERIF22X28B=n
+CONFIG_NXFONT_SERIF27X38B=n
+CONFIG_NXFONT_SERIF38X49B=n
+CONFIG_NXFONTS_CHARBITS=7
+CONFIG_NX_BLOCKING=y
+CONFIG_NX_MXSERVERMSGS=32
+CONFIG_NX_MXCLIENTMSGS=16
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_USBCONSOLE=n
+CONFIG_NSH_USBCONDEV="/dev/ttyACM0"
+CONFIG_NSH_UBSDEV_MINOR=0
+CONFIG_NSH_USBDEV_TRACEINIT=n
+CONFIG_NSH_USBDEV_TRACECLASS=n
+CONFIG_NSH_USBDEV_TRACETRANSFERS=n
+CONFIG_NSH_USBDEV_TRACECONTROLLER=n
+CONFIG_NSH_USBDEV_TRACEINTERRUPTS=n
+#CONFIG_NSH_CONDEV
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/adc
+#
+
+#
+# Settings for examples/can
+#
+
+#
+# Settings for examples/pwm
+#
+
+#
+# Settings for examples/watchdog
+#
+
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Settings for examples/watchdog
+#
+# This test depends on these specific Watchdog/NSH configurations settings (your
+# specific watchdog hardware settings might require additional settings).
+#
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+# Application configuration
+
+CONFIG_APPS_DIR="../apps"
diff --git a/nuttx/configs/stm32f4discovery/pm/setenv.sh b/nuttx/configs/stm32f4discovery/pm/setenv.sh
new file mode 100644
index 000000000..ca0795942
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/pm/setenv.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# configs/stm32f4discovery/pm/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the RIDE
+# toolchain under windows. You will also have to edit this if you install
+# the RIDE toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# These are the Cygwin paths to the locations where I installed the Atollic
+# toolchain under windows. You will also have to edit this if you install
+# the Atollic toolchain in any other location. /usr/bin is added before
+# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
+# at those locations as well.
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
+#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/stm32f4discovery/scripts/ld.script b/nuttx/configs/stm32f4discovery/scripts/ld.script
new file mode 100644
index 000000000..67879e8d1
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/scripts/ld.script
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/stm32f4discovery/scripts/ld.script
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F407VG has 1024Kb of FLASH beginning at address 0x0800:0000 and
+ * 192Kb of SRAM. SRAM is split up into three blocks:
+ *
+ * 1) 112Kb of SRAM beginning at address 0x2000:0000
+ * 2) 16Kb of SRAM beginning at address 0x2001:c000
+ * 3) 64Kb of CCM SRAM beginning at address 0x1000:0000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/stm32f4discovery/src/Makefile b/nuttx/configs/stm32f4discovery/src/Makefile
new file mode 100644
index 000000000..97753132a
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/Makefile
@@ -0,0 +1,139 @@
+############################################################################
+# configs/stm32f4discovery/src/Makefile
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_spi.c
+
+ifeq ($(CONFIG_HAVE_CXX),y)
+CSRCS += up_cxxinitialize.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_autoleds.c
+else
+CSRCS += up_userleds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_STM32_OTGFS),y)
+CSRCS += up_usb.c
+endif
+
+ifeq ($(CONFIG_PWM),y)
+CSRCS += up_pwm.c
+endif
+
+ifeq ($(CONFIG_QENCODER),y)
+CSRCS += up_qencoder.c
+endif
+
+ifeq ($(CONFIG_WATCHDOG),y)
+CSRCS += up_watchdog.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_PM_CUSTOMINIT),y)
+CSRCS += up_pm.c
+endif
+
+ifeq ($(CONFIG_PM_BUTTONS),y)
+CSRCS += up_pmbuttons.c
+endif
+
+ifeq ($(CONFIG_IDLE_CUSTOM),y)
+CSRCS += up_idle.c
+endif
+
+ifeq ($(CONFIG_STM32_FSMC),y)
+CSRCS += up_extmem.c
+
+ifeq ($(CONFIG_LCD_SSD1289),y)
+CSRCS += up_ssd1289.c
+endif
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
new file mode 100644
index 000000000..2824cd2bd
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
@@ -0,0 +1,253 @@
+/****************************************************************************************************
+ * configs/stm32f4discovery/src/stm32f4discovery-internal.h
+ * arch/arm/src/board/stm32f4discovery-internal.n
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************************************/
+
+#ifndef __CONFIGS_STM32F4DISCOVERY_SRC_STM32F4DISCOVERY_INTERNAL_H
+#define __CONFIGS_STM32F4DISCOVERY_SRC_STM32F4DISCOVERY_INTERNAL_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************************************
+ * Definitions
+ ****************************************************************************************************/
+/* Configuration ************************************************************************************/
+/* How many SPI modules does this chip support? */
+
+#if STM32_NSPI < 1
+# undef CONFIG_STM32_SPI1
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 2
+# undef CONFIG_STM32_SPI2
+# undef CONFIG_STM32_SPI3
+#elif STM32_NSPI < 3
+# undef CONFIG_STM32_SPI3
+#endif
+
+/* STM32F4 Discovery GPIOs **************************************************************************/
+/* LEDs */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN12)
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN13)
+#define GPIO_LED3 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN14)
+#define GPIO_LED4 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN15)
+
+/* BUTTONS -- NOTE that all have EXTI interrupts configured */
+
+#define MIN_IRQBUTTON BUTTON_USER
+#define MAX_IRQBUTTON BUTTON_USER
+#define NUM_IRQBUTTONS 1
+
+#define GPIO_BTN_USER (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTA|GPIO_PIN0)
+
+/* PWM
+ *
+ * The STM32F4 Discovery has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using TIM4 CH2 on PD13.
+ */
+
+#define STM32F4DISCOVERY_PWMTIMER 4
+#define STM32F4DISCOVERY_PWMCHANNEL 2
+
+/* SPI chip selects */
+
+#define GPIO_CS_MEMS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN3)
+
+/* USB OTG FS
+ *
+ * PA9 OTG_FS_VBUS VBUS sensing (also connected to the green LED)
+ * PC0 OTG_FS_PowerSwitchOn
+ * PD5 OTG_FS_Overcurrent
+ */
+
+#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
+#define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN0)
+
+#ifdef CONFIG_USBHOST
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5)
+
+#else
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5)
+#endif
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public data
+ ****************************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the stm32f4discovery board.
+ *
+ ****************************************************************************************************/
+
+void weak_function stm32_spiinitialize(void);
+
+/****************************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related
+ * GPIO pins for the STM32F4Discovery board.
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_OTGFS
+void weak_function stm32_usbinitialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality. This function will
+ * start a thread that will monitor for device connection/disconnection events.
+ *
+ ****************************************************************************************************/
+
+#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
+int stm32_usbhost_initialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for external memory usage
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemgpios(const uint32_t *gpios, int ngpios);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemaddr
+ *
+ * Description:
+ * Initialize adress line GPIOs for external memory access
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemaddr(int naddrs);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_extmemdata
+ *
+ * Description:
+ * Initialize data line GPIOs for external memory access
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_extmemdata(int ndata);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_enablefsmc(void);
+#endif
+
+/****************************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_STM32_FSMC
+void stm32_disablefsmc(void);
+#endif
+
+/****************************************************************************************************
+ * Name: up_ledpminitialize
+ *
+ * Description:
+ * Enable logic to use the LEDs on the STM32F4Discovery to support power management testing
+ *
+ ****************************************************************************************************/
+
+#ifdef CONFIG_PM
+void up_ledpminitialize(void);
+#endif
+
+/****************************************************************************************************
+ * Name: up_pmbuttons
+ *
+ * Description:
+ * Configure the user button of the STM32f4discovery board as EXTI,
+ * so it is able to wakeup the MCU from the PM_STANDBY mode
+ *
+ ****************************************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
+void up_pmbuttons(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_STM32F4DISCOVERY_SRC_STM32F4DISCOVERY_INTERNAL_H */
+
diff --git a/nuttx/configs/stm32f4discovery/src/up_autoleds.c b/nuttx/configs/stm32f4discovery/src/up_autoleds.c
new file mode 100644
index 000000000..e38d2f3b1
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_autoleds.c
@@ -0,0 +1,260 @@
+/****************************************************************************
+ * configs/stm32f4discovery/src/up_autoleds.c
+ * arch/arm/src/board/up_autoleds.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define STM32F4_LED1 (1 << 0)
+#define STM32F4_LED2 (1 << 1)
+#define STM32F4_LED3 (1 << 2)
+#define STM32F4_LED4 (1 << 3)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+#define LED_STARTED_ON_SETBITS ((STM32F4_LED1) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((STM32F4_LED2|STM32F4_LED3|STM32F4_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS ((STM32F4_LED1|STM32F4_LED2|STM32F4_LED3|STM32F4_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((STM32F4_LED2) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((STM32F4_LED1|STM32F4_LED3|STM32F4_LED4) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS ((STM32F4_LED1) << OFF_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_CLRBITS ((STM32F4_LED2|STM32F4_LED3|STM32F4_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_IRQSENABLED_ON_SETBITS ((STM32F4_LED1|STM32F4_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((STM32F4_LED3|STM32F4_LED4) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS ((STM32F4_LED2) << OFF_SETBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_CLRBITS ((STM32F4_LED1|STM32F4_LED3|STM32F4_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_STACKCREATED_ON_SETBITS ((STM32F4_LED3) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((STM32F4_LED1|STM32F4_LED2|STM32F4_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS ((STM32F4_LED1|STM32F4_LED2) << OFF_SETBITS_SHIFT)
+#define LED_STACKCREATED_OFF_CLRBITS ((STM32F4_LED3|STM32F4_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_INIRQ_ON_SETBITS ((STM32F4_LED1) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((STM32F4_LED1) << OFF_CLRBITS_SHIFT)
+
+#define LED_SIGNAL_ON_SETBITS ((STM32F4_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((STM32F4_LED2) << OFF_CLRBITS_SHIFT)
+
+#define LED_ASSERTION_ON_SETBITS ((STM32F4_LED4) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((STM32F4_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_PANIC_ON_SETBITS ((STM32F4_LED4) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((STM32F4_LED4) << OFF_CLRBITS_SHIFT)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
+ LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
+
+ (LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
+ LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
+
+ (LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
+ LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
+
+ (LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
+ LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & STM32F4_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & STM32F4_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((clrbits & STM32F4_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, false);
+ }
+
+ if ((clrbits & STM32F4_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, false);
+ }
+}
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & STM32F4_LED1) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & STM32F4_LED2) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((setbits & STM32F4_LED3) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED3, true);
+ }
+
+ if ((setbits & STM32F4_LED4) != 0)
+ {
+ stm32_gpiowrite(GPIO_LED4, true);
+ }
+}
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm32f4discovery/src/up_boot.c b/nuttx/configs/stm32f4discovery/src/up_boot.c
new file mode 100644
index 000000000..3e9b7242d
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_boot.c
@@ -0,0 +1,103 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm32f4discovery-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+ if (stm32_spiinitialize)
+ {
+ stm32_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB if the 1) OTG FS controller is in the configuration and 2)
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * the weak function stm32_usbinitialize() has been brought into the build.
+ * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected.
+ */
+
+#ifdef CONFIG_STM32_OTGFS
+ if (stm32_usbinitialize)
+ {
+ stm32_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/stm32f4discovery/src/up_buttons.c b/nuttx/configs/stm32f4discovery/src/up_buttons.c
new file mode 100644
index 000000000..ae1366930
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_buttons.c
@@ -0,0 +1,165 @@
+/****************************************************************************
+ * configs/stm32f4discovery/src/up_buttons.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "stm32f4discovery-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
+ * the BUTTON_* definitions in board.h
+ */
+
+static const uint16_t g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_USER
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for all pins.
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed.
+ */
+
+ bool released = stm32_gpioread(g_buttons[i]);
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (!released)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ /* The following should be atomic */
+
+ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
+ {
+ oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/stm32f4discovery/src/up_cxxinitialize.c b/nuttx/configs/stm32f4discovery/src/up_cxxinitialize.c
new file mode 100644
index 000000000..402dfb111
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_cxxinitialize.c
@@ -0,0 +1,155 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_cxxinitialize.c
+ * arch/arm/src/board/up_cxxinitialize.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include <arch/stm32/chip.h>
+#include "chip.h"
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Debug ****************************************************************************/
+/* Non-standard debug that may be enabled just for testing the static constructors */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_CXX
+#endif
+
+#ifdef CONFIG_DEBUG_CXX
+# define cxxdbg dbg
+# define cxxlldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define cxxvdbg vdbg
+# define cxxllvdbg llvdbg
+# else
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+# endif
+#else
+# define cxxdbg(x...)
+# define cxxlldbg(x...)
+# define cxxvdbg(x...)
+# define cxxllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Types
+ ************************************************************************************/
+/* This type defines one entry in initialization array */
+
+typedef void (*initializer_t)(void);
+
+/************************************************************************************
+ * External references
+ ************************************************************************************/
+/* _sinit and _einit are symbols exported by the linker script that mark the
+ * beginning and the end of the C++ initialization section.
+ */
+
+extern initializer_t _sinit;
+extern initializer_t _einit;
+
+/* _stext and _etext are symbols exported by the linker script that mark the
+ * beginning and the end of text.
+ */
+
+extern uint32_t _stext;
+extern uint32_t _etext;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_cxxinitialize
+ *
+ * Description:
+ * If C++ and C++ static constructors are supported, then this function
+ * must be provided by board-specific logic in order to perform
+ * initialization of the static C++ class instances.
+ *
+ * This function should then be called in the application-specific
+ * user_start logic in order to perform the C++ initialization. NOTE
+ * that no component of the core NuttX RTOS logic is involved; This
+ * function defintion only provides the 'contract' between application
+ * specific C++ code and platform-specific toolchain support
+ *
+ ***************************************************************************/
+
+void up_cxxinitialize(void)
+{
+ initializer_t *initp;
+
+ cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
+ &_sinit, &_einit, &_stext, &_etext);
+
+ /* Visit each entry in the initialzation table */
+
+ for (initp = &_sinit; initp != &_einit; initp++)
+ {
+ initializer_t initializer = *initp;
+ cxxdbg("initp: %p initializer: %p\n", initp, initializer);
+
+ /* Make sure that the address is non-NULL and lies in the text region
+ * defined by the linker script. Some toolchains may put NULL values
+ * or counts in the initialization table
+ */
+
+ if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
+ {
+ cxxdbg("Calling %p\n", initializer);
+ initializer();
+ }
+ }
+}
+
+#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
+
diff --git a/nuttx/configs/stm32f4discovery/src/up_extmem.c b/nuttx/configs/stm32f4discovery/src/up_extmem.c
new file mode 100644
index 000000000..083321578
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_extmem.c
@@ -0,0 +1,188 @@
+/************************************************************************************
+ * configs/stm32f4disovery/src/up_extmem.c
+ * arch/arm/src/board/up_extmem.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32_fsmc.h"
+#include "stm32_gpio.h"
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# warning "FSMC is not enabled"
+#endif
+
+#if STM32_NGPIO_PORTS < 6
+# error "Required GPIO ports not enabled"
+#endif
+
+#define STM32_FSMC_NADDRCONFIGS 26
+#define STM32_FSMC_NDATACONFIGS 16
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/* GPIO configurations common to most external memories */
+
+static const uint32_t g_addressconfig[STM32_FSMC_NADDRCONFIGS] =
+{
+ GPIO_FSMC_A0, GPIO_FSMC_A1 , GPIO_FSMC_A2, GPIO_FSMC_A3, GPIO_FSMC_A4 , GPIO_FSMC_A5,
+ GPIO_FSMC_A6, GPIO_FSMC_A7, GPIO_FSMC_A8, GPIO_FSMC_A9, GPIO_FSMC_A10, GPIO_FSMC_A11,
+ GPIO_FSMC_A12, GPIO_FSMC_A13, GPIO_FSMC_A14, GPIO_FSMC_A15, GPIO_FSMC_A16, GPIO_FSMC_A17,
+ GPIO_FSMC_A18, GPIO_FSMC_A19, GPIO_FSMC_A20, GPIO_FSMC_A21, GPIO_FSMC_A22, GPIO_FSMC_A23,
+ GPIO_FSMC_A24, GPIO_FSMC_A25
+};
+
+static const uint32_t g_dataconfig[STM32_FSMC_NDATACONFIGS] =
+{
+ GPIO_FSMC_D0, GPIO_FSMC_D1 , GPIO_FSMC_D2, GPIO_FSMC_D3, GPIO_FSMC_D4 , GPIO_FSMC_D5,
+ GPIO_FSMC_D6, GPIO_FSMC_D7, GPIO_FSMC_D8, GPIO_FSMC_D9, GPIO_FSMC_D10, GPIO_FSMC_D11,
+ GPIO_FSMC_D12, GPIO_FSMC_D13, GPIO_FSMC_D14, GPIO_FSMC_D15
+};
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_extmemgpios
+ *
+ * Description:
+ * Initialize GPIOs for external memory usage
+ *
+ ************************************************************************************/
+
+void stm32_extmemgpios(const uint32_t *gpios, int ngpios)
+{
+ int i;
+
+ /* Configure GPIOs */
+
+ for (i = 0; i < ngpios; i++)
+ {
+ stm32_configgpio(gpios[i]);
+ }
+}
+
+/************************************************************************************
+ * Name: stm32_extmemaddr
+ *
+ * Description:
+ * Initialize adress line GPIOs for external memory access
+ *
+ ************************************************************************************/
+
+void stm32_extmemaddr(int naddrs)
+{
+ stm32_extmemgpios(g_addressconfig, naddrs);
+}
+
+/************************************************************************************
+ * Name: stm32_extmemdata
+ *
+ * Description:
+ * Initialize data line GPIOs for external memory access
+ *
+ ************************************************************************************/
+
+void stm32_extmemdata(int ndata)
+{
+ stm32_extmemgpios(g_dataconfig, ndata);
+}
+
+/************************************************************************************
+ * Name: stm32_enablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_enablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Enable AHB clocking to the FSMC */
+
+ regval = getreg32( STM32_RCC_AHB3ENR);
+ regval |= RCC_AHB3ENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHB3ENR);
+}
+
+/************************************************************************************
+ * Name: stm32_disablefsmc
+ *
+ * Description:
+ * enable clocking to the FSMC module
+ *
+ ************************************************************************************/
+
+void stm32_disablefsmc(void)
+{
+ uint32_t regval;
+
+ /* Disable AHB clocking to the FSMC */
+
+ regval = getreg32(STM32_RCC_AHB3ENR);
+ regval &= ~RCC_AHB3ENR_FSMCEN;
+ putreg32(regval, STM32_RCC_AHB3ENR);
+}
diff --git a/nuttx/configs/stm32f4discovery/src/up_idle.c b/nuttx/configs/stm32f4discovery/src/up_idle.c
new file mode 100644
index 000000000..c8563acb9
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_idle.c
@@ -0,0 +1,277 @@
+/****************************************************************************
+ * configs/stm32f4discovery/src/up_idle.c
+ * arch/arm/src/board/up_idle.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <arch/board/board.h>
+#include <nuttx/config.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/clock.h>
+#include <nuttx/power/pm.h>
+
+#include <debug.h>
+#include <nuttx/rtc.h>
+#include <arch/irq.h>
+
+#include "up_internal.h"
+#include "stm32_pm.h"
+#include "stm32_rcc.h"
+#include "stm32_exti.h"
+
+#include "stm32f4discovery-internal.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* Does the board support an IDLE LED to indicate that the board is in the
+ * IDLE state?
+ */
+
+#if defined(CONFIG_ARCH_LEDS) && defined(LED_IDLE)
+# define BEGIN_IDLE() up_ledon(LED_IDLE)
+# define END_IDLE() up_ledoff(LED_IDLE)
+#else
+# define BEGIN_IDLE()
+# define END_IDLE()
+#endif
+
+/* Values for the RTC Alarm to wake up from the PM_STANDBY mode */
+
+#ifndef CONFIG_PM_ALARM_SEC
+# define CONFIG_PM_ALARM_SEC 3
+#endif
+
+#ifndef CONFIG_PM_ALARM_NSEC
+# define CONFIG_PM_ALARM_NSEC 0
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static void up_alarmcb(void);
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_idlepm
+ *
+ * Description:
+ * Perform IDLE state power management.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void up_idlepm(void)
+{
+#ifdef CONFIG_RTC_ALARM
+ struct timespec alarmtime;
+#endif
+ static enum pm_state_e oldstate = PM_NORMAL;
+ enum pm_state_e newstate;
+ irqstate_t flags;
+ int ret;
+
+ /* Decide, which power saving level can be obtained */
+
+ newstate = pm_checkstate();
+
+ /* Check for state changes */
+
+ if (newstate != oldstate)
+ {
+ lldbg("newstate= %d oldstate=%d\n", newstate, oldstate);
+
+ flags = irqsave();
+
+ /* Force the global state change */
+
+ ret = pm_changestate(newstate);
+ if (ret < 0)
+ {
+ /* The new state change failed, revert to the preceding state */
+
+ (void)pm_changestate(oldstate);
+
+ /* No state change... */
+
+ goto errout;
+ }
+
+ /* Then perform board-specific, state-dependent logic here */
+
+ switch (newstate)
+ {
+ case PM_NORMAL:
+ {
+ }
+ break;
+
+ case PM_IDLE:
+ {
+ }
+ break;
+
+ case PM_STANDBY:
+ {
+#ifdef CONFIG_RTC_ALARM
+ /* Disable RTC Alarm interrupt */
+
+#warning "missing logic"
+
+ /* Configure the RTC alarm to Auto Wake the system */
+
+#warning "missing logic"
+
+ /* The tv_nsec value must not exceed 1,000,000,000. That
+ * would be an invalid time.
+ */
+
+#warning "missing logic"
+
+ /* Set the alarm */
+
+#warning "missing logic"
+#endif
+ /* Call the STM32 stop mode */
+
+ stm32_pmstop(true);
+
+ /* We have been re-awakened by some even: A button press?
+ * An alarm? Cancel any pending alarm and resume the normal
+ * operation.
+ */
+
+#ifdef CONFIG_RTC_ALARM
+#warning "missing logic"
+#endif
+ /* Resume normal operation */
+
+ pm_changestate(PM_NORMAL);
+ newstate = PM_NORMAL;
+ }
+ break;
+
+ case PM_SLEEP:
+ {
+ /* We should not return from standby mode. The only way out
+ * of standby is via the reset path.
+ */
+
+ (void)stm32_pmstandby();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* Save the new state */
+
+ oldstate = newstate;
+
+errout:
+ irqrestore(flags);
+ }
+}
+#else
+# define up_idlepm()
+#endif
+
+/************************************************************************************
+ * Name: up_alarmcb
+ *
+ * Description:
+ * RTC alarm service routine
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PM) && defined(CONFIG_RTC_ALARM)
+static void up_alarmcb(void)
+{
+ /* This alarm occurs because there wasn't any EXTI interrupt during the
+ * PM_STANDBY period. So just go to sleep.
+ */
+
+ pm_changestate(PM_SLEEP);
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_idle
+ *
+ * Description:
+ * up_idle() is the logic that will be executed when their is no other
+ * ready-to-run task. This is processor idle time and will continue until
+ * some interrupt occurs to cause a context switch from the idle task.
+ *
+ * Processing in this state may be processor-specific. e.g., this is where
+ * power management operations might be performed.
+ *
+ ****************************************************************************/
+
+void up_idle(void)
+{
+#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
+ /* If the system is idle and there are no timer interrupts, then process
+ * "fake" timer interrupts. Hopefully, something will wake up.
+ */
+
+ sched_process_timer();
+#else
+
+ /* Perform IDLE mode power management */
+
+ BEGIN_IDLE();
+ up_idlepm();
+ END_IDLE();
+#endif
+}
+
diff --git a/nuttx/configs/stm32f4discovery/src/up_nsh.c b/nuttx/configs/stm32f4discovery/src/up_nsh.c
new file mode 100644
index 000000000..2a933569f
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_nsh.c
@@ -0,0 +1,134 @@
+/****************************************************************************
+ * config/stm32f4discovery/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_STM32_SDIO
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#ifdef CONFIG_STM32_OTGFS
+# include "stm32_usbhost.h"
+#endif
+
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#define HAVE_USBDEV 1
+#define HAVE_USBHOST 1
+
+/* Can't support USB host or device features if USB OTG FS is not enabled */
+
+#ifndef CONFIG_STM32_OTGFS
+# undef HAVE_USBDEV
+# undef HAVE_USBHOST
+#endif
+
+/* Can't support USB device is USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef HAVE_USBDEV
+#endif
+
+/* Can't support USB host is USB host is not enabled */
+
+#ifndef CONFIG_USBHOST
+# undef HAVE_USBHOST
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef HAVE_USBHOST
+ int ret;
+
+ /* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
+ * will monitor for USB connection and disconnection events.
+ */
+
+ ret = stm32_usbhost_initialize();
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret);
+ return ret;
+ }
+#endif
+
+ return OK;
+}
diff --git a/nuttx/configs/stm32f4discovery/src/up_pm.c b/nuttx/configs/stm32f4discovery/src/up_pm.c
new file mode 100644
index 000000000..3ee0675cb
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_pm.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/stm32f4discovery/src/up_pm.c
+ * arch/arm/src/board/up_pm.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/power/pm.h>
+
+#include "up_internal.h"
+#include "stm32_pm.h"
+#include "stm32f4discovery-internal.h"
+
+#ifdef CONFIG_PM
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_pminitialize
+ *
+ * Description:
+ * This function is called by MCU-specific logic at power-on reset in
+ * order to provide one-time initialization the power management subystem.
+ * This function must be called *very* early in the intialization sequence
+ * *before* any other device drivers are initialized (since they may
+ * attempt to register with the power management subsystem).
+ *
+ * Input parameters:
+ * None.
+ *
+ * Returned value:
+ * None.
+ *
+ ****************************************************************************/
+
+void up_pminitialize(void)
+{
+ /* Then initialize the NuttX power management subsystem proper */
+
+ pm_initialize();
+
+#if defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
+ /* Initialize the buttons to wake up the system from low power modes */
+
+ up_pmbuttons();
+#endif
+
+ /* Initialize the LED PM */
+
+ up_ledpminitialize();
+}
+
+#endif /* CONFIG_PM */
diff --git a/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c b/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c
new file mode 100644
index 000000000..aa72e3da1
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c
@@ -0,0 +1,149 @@
+/****************************************************************************
+ * configs/stm32f4discovery/src/up_pmbuttons.c
+ * arch/arm/src/board/up_pmbuttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Diego Sanchez <dsanchez@nx-engineering.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <arch/board/board.h>
+#include <nuttx/config.h>
+
+#include <nuttx/power/pm.h>
+#include <arch/irq.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include "up_arch.h"
+#include "nvic.h"
+#include "stm32_pwr.h"
+#include "stm32_pm.h"
+#include "stm32f4discovery-internal.h"
+
+#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_ARCH_BUTTONS
+# error "CONFIG_ARCH_BUTTONS is not defined in the configuration"
+#endif
+
+#ifndef CONFIG_ARCH_IRQBUTTONS
+# warning "CONFIG_ARCH_IRQBUTTONS is not defined in the configuration"
+#endif
+
+#ifndef CONFIG_PM_BUTTON_ACTIVITY
+# define CONFIG_PM_BUTTON_ACTIVITY 10
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static int button_handler(int irq, FAR void *context);
+#endif /* CONFIG_ARCH_IRQBUTTONS */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: button_handler
+ *
+ * Description:
+ * Handle a button wake-up interrupt
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static int button_handler(int irq, FAR void *context)
+{
+ /* At this point the MCU should have already awakened. The state
+ * change will be handled in the IDLE loop when the system is re-awakened
+ * The button interrupt handler should be totally ignorant of the PM
+ * activities and should report button activity as if nothing
+ * special happened.
+ */
+
+ pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
+ return OK;
+}
+#endif /* CONFIG_ARCH_IRQBUTTONS */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_pmbuttons
+ *
+ * Description:
+ * Configure the user button of the STM32f4discovery board as EXTI,
+ * so it is able to wakeup the MCU from the PM_STANDBY mode
+ *
+ ****************************************************************************/
+
+void up_pmbuttons(void)
+{
+ /* Initialize the button GPIOs */
+
+ up_buttoninit();
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+ xcpt_t oldhandler = up_irqbutton(0, button_handler);
+
+ if (oldhandler != NULL)
+ {
+ lib_lowprintf("WARNING: oldhandler:%p is not NULL! "
+ "Button events may be lost or aliased!\n",
+ oldhandler);
+ }
+#endif
+}
+
+#endif /* CONFIG_PM && CONFIG_IDLE_CUSTOM && CONFIG_PM_BUTTONS)*/
diff --git a/nuttx/configs/stm32f4discovery/src/up_pwm.c b/nuttx/configs/stm32f4discovery/src/up_pwm.c
new file mode 100644
index 000000000..d03fb4d59
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_pwm.c
@@ -0,0 +1,142 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_pwm.c
+ * arch/arm/src/board/up_pwm.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/pwm.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "stm32_pwm.h"
+#include "stm32f4discovery-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* PWM
+ *
+ * The stm32f4discovery has no real on-board PWM devices, but the board can be configured to output
+ * a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this
+ * purpose:
+ *
+ * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
+ *
+ * FSMC must be disabled in this case!
+ */
+
+#define HAVE_PWM 1
+
+#ifndef CONFIG_PWM
+# undef HAVE_PWM
+#endif
+
+#ifndef CONFIG_STM32_TIM4
+# undef HAVE_PWM
+#endif
+
+#ifndef CONFIG_STM32_TIM4_PWM
+# undef HAVE_PWM
+#endif
+
+#if CONFIG_STM32_TIM4_CHANNEL != STM32F4DISCOVERY_PWMCHANNEL
+# undef HAVE_PWM
+#endif
+
+#ifdef HAVE_PWM
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pwm_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/pwm.
+ *
+ ************************************************************************************/
+
+int pwm_devinit(void)
+{
+ static bool initialized = false;
+ struct pwm_lowerhalf_s *pwm;
+ int ret;
+
+ /* Have we already initialized? */
+
+ if (!initialized)
+ {
+ /* Call stm32_pwminitialize() to get an instance of the PWM interface */
+
+ pwm = stm32_pwminitialize(STM32F4DISCOVERY_PWMTIMER);
+ if (!pwm)
+ {
+ dbg("Failed to get the STM32 PWM lower half\n");
+ return -ENODEV;
+ }
+
+ /* Register the PWM driver at "/dev/pwm0" */
+
+ ret = pwm_register("/dev/pwm0", pwm);
+ if (ret < 0)
+ {
+ adbg("pwm_register failed: %d\n", ret);
+ return ret;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* HAVE_PWM */
diff --git a/nuttx/configs/stm32f4discovery/src/up_qencoder.c b/nuttx/configs/stm32f4discovery/src/up_qencoder.c
new file mode 100644
index 000000000..36a3877e8
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_qencoder.c
@@ -0,0 +1,187 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_qencoder.c
+ * arch/arm/src/board/up_qencoder.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/sensors/qencoder.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "stm32_qencoder.h"
+#include "stm32f4discovery-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Check if we have a timer configured for quadrature encoder -- assume YES. */
+
+#define HAVE_QENCODER 1
+
+/* If TIMn is not enabled (via CONFIG_STM32_TIMn), then the configuration cannot
+ * specify TIMn as a quadrature encoder (via CONFIG_STM32_TIMn_QE).
+ */
+
+#ifndef CONFIG_STM32_TIM1
+# undef CONFIG_STM32_TIM1_QE
+#endif
+#ifndef CONFIG_STM32_TIM2
+# undef CONFIG_STM32_TIM2_QE
+#endif
+#ifndef CONFIG_STM32_TIM3
+# undef CONFIG_STM32_TIM3_QE
+#endif
+#ifndef CONFIG_STM32_TIM4
+# undef CONFIG_STM32_TIM4_QE
+#endif
+#ifndef CONFIG_STM32_TIM5
+# undef CONFIG_STM32_TIM5_QE
+#endif
+#ifndef CONFIG_STM32_TIM8
+# undef CONFIG_STM32_TIM8_QE
+#endif
+
+/* If the upper-half quadrature encoder driver is not enabled, then we cannot
+ * support the quadrature encoder.
+ */
+
+#ifndef CONFIG_QENCODER
+# undef HAVE_QENCODER
+#endif
+
+/* Which Timer should we use, TIMID={1,2,3,4,5,8}. If multiple timers are
+ * configured as quadrature encoders, this logic will arbitrarily select
+ * the lowest numbered timer.
+ *
+ * At least one TIMn, n={1,2,3,4,5,8}, must be both enabled and configured
+ * as a quadrature encoder in order to support the lower half quadrature
+ * encoder driver. The above check assures that if CONFIG_STM32_TIMn_QE
+ * is defined, then the correspdonding TIMn is also enabled.
+ */
+
+#if defined CONFIG_STM32_TIM1_QE
+# define TIMID 1
+#elif defined CONFIG_STM32_TIM2_QE
+# define TIMID 2
+#elif defined CONFIG_STM32_TIM3_QE
+# define TIMID 3
+#elif defined CONFIG_STM32_TIM4_QE
+# define TIMID 4
+#elif defined CONFIG_STM32_TIM5_QE
+# define TIMID 5
+#elif defined CONFIG_STM32_TIM8_QE
+# define TIMID 8
+#else
+# undef HAVE_QENCODER
+#endif
+
+#ifdef HAVE_QENCODER
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the quadrature encoder */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_QENCODER
+#endif
+
+#ifdef CONFIG_DEBUG_QENCODER
+# define qedbg dbg
+# define qelldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define qevdbg vdbg
+# define qellvdbg llvdbg
+# else
+# define qevdbg(x...)
+# define qellvdbg(x...)
+# endif
+#else
+# define qedbg(x...)
+# define qelldbg(x...)
+# define qevdbg(x...)
+# define qellvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: qe_devinit
+ *
+ * Description:
+ * All STM32 architectures must provide the following interface to work with
+ * examples/qencoder.
+ *
+ ************************************************************************************/
+
+int qe_devinit(void)
+{
+ static bool initialized = false;
+ int ret;
+
+ /* Check if we are already initialized */
+
+ if (!initialized)
+ {
+ /* Initialize a quadrature encoder interface. */
+
+ qevdbg("Initializing the quadrature encoder using TIM%d\n", TIMID);
+ ret = stm32_qeinitialize("/dev/qe0", TIMID);
+ if (ret < 0)
+ {
+ qedbg("stm32_qeinitialize failed: %d\n", ret);
+ return ret;
+ }
+
+ initialized = true;
+ }
+
+ return OK;
+}
+
+#endif /* HAVE_QENCODER */
diff --git a/nuttx/configs/stm32f4discovery/src/up_spi.c b/nuttx/configs/stm32f4discovery/src/up_spi.c
new file mode 100644
index 000000000..3cf7d38b5
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_spi.c
@@ -0,0 +1,165 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the stm32f4discovery board.
+ *
+ ************************************************************************************/
+
+void weak_function stm32_spiinitialize(void)
+{
+#ifdef CONFIG_STM32_SPI1
+ stm32_configgpio(GPIO_CS_MEMS);
+#endif
+}
+
+/****************************************************************************
+ * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * Description:
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_SPI1
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ stm32_gpiowrite(GPIO_CS_MEMS, !selected);
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/stm32f4discovery/src/up_ssd1289.c b/nuttx/configs/stm32f4discovery/src/up_ssd1289.c
new file mode 100644
index 000000000..4d5a4ab7a
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_ssd1289.c
@@ -0,0 +1,426 @@
+/**************************************************************************************
+ * configs/stm32fdiscover/src/up_ssd1289.c
+ * arch/arm/src/board/up_ssd1289.c
+ *
+ * This logic supports the connection of an SSD1289-based LCD to the STM32F4Discovery
+ * board.
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Included Files
+ **************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/spi.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1289.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+#ifdef CONFIG_LCD_SSD1289
+
+/**************************************************************************************
+ * Pre-processor Definitions
+ **************************************************************************************/
+/* Configuration **********************************************************************/
+
+#ifndef CONFIG_STM32_FSMC
+# error "CONFIG_STM32_FSMC is required to use the LCD"
+#endif
+
+/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must
+ * also be enabled.
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_GRAPHICS
+# undef CONFIG_DEBUG_LCD
+#endif
+
+#ifndef CONFIG_DEBUG_VERBOSE
+# undef CONFIG_DEBUG_LCD
+#endif
+
+/* STM32F4Discovery LCD Hardware Definitions ******************************************/
+/* LCD /CS is CE1 == NOR/SRAM Bank 1
+ *
+ * Bank 1 = 0x60000000 | 0x00000000
+ * Bank 2 = 0x60000000 | 0x04000000
+ * Bank 3 = 0x60000000 | 0x08000000
+ * Bank 4 = 0x60000000 | 0x0c000000
+ *
+ * FSMC address bit 16 is used to distinguish command and data. FSMC address bits
+ * 0-24 correspond to ARM address bits 1-25.
+ */
+
+#define STM32_LCDBASE ((uintptr_t)(0x60000000 | 0x00000000))
+#define LCD_INDEX (STM32_LCDBASE)
+#define LCD_DATA (STM32_LCDBASE + 0x00020000)
+
+/* SRAM pin definitions */
+
+#define LCD_NADDRLINES 1 /* A16 */
+#define LCD_NDATALINES 16 /* D0-15 */
+
+/* Debug ******************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+# define lcddbg dbg
+# define lcdvdbg vdbg
+#else
+# define lcddbg(x...)
+# define lcdvdbg(x...)
+#endif
+
+/**************************************************************************************
+ * Private Type Definition
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Private Function Protototypes
+ **************************************************************************************/
+/* Low Level LCD access */
+
+static void stm32_select(FAR struct ssd1289_lcd_s *dev);
+static void stm32_deselect(FAR struct ssd1289_lcd_s *dev);
+static void stm32_index(FAR struct ssd1289_lcd_s *dev, uint8_t index);
+#ifndef CONFIG_SSD1289_WRONLY
+static uint16_t stm32_read(FAR struct ssd1289_lcd_s *dev);
+#endif
+static void stm32_write(FAR struct ssd1289_lcd_s *dev, uint16_t data);
+static void stm32_backlight(FAR struct ssd1289_lcd_s *dev, int power);
+
+/**************************************************************************************
+ * Private Data
+ **************************************************************************************/
+/* LCD pin mapping (see configs/stm324discovery/README.txt
+ * MAPPING TO STM32 F4:
+ *
+ * ---------------- ------------- ----------------------------------
+ * STM32 FUNCTION LCD PIN STM32F4Discovery PIN
+ * ---------------- ------------- ----------------------------------
+ * FSMC_D0 D0 pin 4 PD14 P1 pin 46 Conflict (Note 1)
+ * FSMC_D1 D1 pin 3 PD15 P1 pin 47 Conflict (Note 2)
+ * FSMC_D2 D2 pin 6 PD0 P2 pin 36 Free I/O
+ * FSMC_D3 D3 pin 5 PD1 P2 pin 33 Free I/O
+ * FSMC_D4 D4 pin 8 PE7 P1 pin 25 Free I/O
+ * FSMC_D5 D5 pin 7 PE8 P1 pin 26 Free I/O
+ * FSMC_D6 D6 pin 10 PE9 P1 pin 27 Free I/O
+ * FSMC_D7 D7 pin 9 PE10 P1 pin 28 Free I/O
+ * FSMC_D8 D8 pin 12 PE11 P1 pin 29 Free I/O
+ * FSMC_D9 D9 pin 11 PE12 P1 pin 30 Free I/O
+ * FSMC_D10 D10 pin 14 PE13 P1 pin 31 Free I/O
+ * FSMC_D11 D11 pin 13 PE14 P1 pin 32 Free I/O
+ * FSMC_D12 D12 pin 16 PE15 P1 pin 33 Free I/O
+ * FSMC_D13 D13 pin 15 PD8 P1 pin 40 Free I/O
+ * FSMC_D14 D14 pin 18 PD9 P1 pin 41 Free I/O
+ * FSMC_D15 D15 pin 17 PD10 P1 pin 42 Free I/O
+ * FSMC_A16 RS pin 19 PD11 P1 pin 27 Free I/O
+ * FSMC_NE1 ~CS pin 10 PD7 P2 pin 27 Free I/O
+ * FSMC_NWE ~WR pin 22 PD5 P2 pin 29 Conflict (Note 3)
+ * FSMC_NOE ~RD pin 21 PD4 P2 pin 32 Conflict (Note 4)
+ * PC6 RESET pin 24 PC6 P2 pin 47 Free I/O
+ * ---------------- ------------- ----------------------------------
+ *
+ * 1 Used for the RED LED
+ * 2 Used for the BLUE LED
+ * 3 Used for the RED LED and for OTG FS Overcurrent. It may be okay to use
+ * for the parallel interface if PC0 is held high (or floating). PC0 enables
+ * the STMPS2141STR IC power switch that drives the OTG FS host VBUS.
+ * 4 Also the reset pin for the CS43L22 audio Codec.
+ */
+
+#define GPIO_LCD_RESET (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN6)
+
+/* GPIO configurations unique to the LCD */
+
+static const uint32_t g_lcdconfig[] =
+{
+ /* PC6(RESET), FSMC_A16, FSMC_NOE, FSMC_NWE, and FSMC_NE1 */
+
+ GPIO_LCD_RESET, GPIO_FSMC_A16, GPIO_FSMC_NOE, GPIO_FSMC_NWE, GPIO_FSMC_NE1
+};
+#define NLCD_CONFIG (sizeof(g_lcdconfig)/sizeof(uint32_t))
+
+/* This is the driver state structure (there is no retained state information) */
+
+static struct ssd1289_lcd_s g_ssd1289 =
+{
+ .select = stm32_select,
+ .deselect = stm32_deselect,
+ .index = stm32_index,
+#ifndef CONFIG_SSD1289_WRONLY
+ .read = stm32_read,
+#endif
+ .write = stm32_write,
+ .backlight = stm32_backlight
+};
+
+/* The saved instance of the LCD driver */
+
+static FAR struct lcd_dev_s *g_ssd1289drvr;
+
+/**************************************************************************************
+ * Private Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: stm32_select
+ *
+ * Description:
+ * Select the LCD device
+ *
+ **************************************************************************************/
+
+static void stm32_select(FAR struct ssd1289_lcd_s *dev)
+{
+ /* Does not apply to this hardware */
+}
+
+/**************************************************************************************
+ * Name: stm32_deselect
+ *
+ * Description:
+ * De-select the LCD device
+ *
+ **************************************************************************************/
+
+static void stm32_deselect(FAR struct ssd1289_lcd_s *dev)
+{
+ /* Does not apply to this hardware */
+}
+
+/**************************************************************************************
+ * Name: stm32_deselect
+ *
+ * Description:
+ * Set the index register
+ *
+ **************************************************************************************/
+
+static void stm32_index(FAR struct ssd1289_lcd_s *dev, uint8_t index)
+{
+ putreg16((uint16_t)index, LCD_INDEX);
+}
+
+/**************************************************************************************
+ * Name: stm32_read
+ *
+ * Description:
+ * Read LCD data (GRAM data or register contents)
+ *
+ **************************************************************************************/
+
+#ifndef CONFIG_SSD1289_WRONLY
+static uint16_t stm32_read(FAR struct ssd1289_lcd_s *dev)
+{
+ return getreg16(LCD_DATA);
+}
+#endif
+
+/**************************************************************************************
+ * Name: stm32_write
+ *
+ * Description:
+ * Write LCD data (GRAM data or register contents)
+ *
+ **************************************************************************************/
+
+static void stm32_write(FAR struct ssd1289_lcd_s *dev, uint16_t data)
+{
+ putreg16((uint16_t)data, LCD_DATA);
+}
+
+/**************************************************************************************
+ * Name: stm32_write
+ *
+ * Description:
+ * Write LCD data (GRAM data or register contents)
+ *
+ **************************************************************************************/
+
+static void stm32_backlight(FAR struct ssd1289_lcd_s *dev, int power)
+{
+#warning "Missing logic"
+}
+
+/************************************************************************************
+ * Name: stm32_selectlcd
+ *
+ * Description:
+ * Initialize to the LCD
+ *
+ ************************************************************************************/
+
+void stm32_selectlcd(void)
+{
+ /* Configure GPIO pins */
+
+ stm32_extmemdata(LCD_NDATALINES); /* Common data lines: D0-D15 */
+ stm32_extmemgpios(g_lcdconfig, NLCD_CONFIG); /* LCD-specific control lines */
+
+ /* Enable AHB clocking to the FSMC */
+
+ stm32_enablefsmc();
+
+ /* Color LCD configuration (LCD configured as follow):
+ *
+ * - Data/Address MUX = Disable "FSMC_BCR_MUXEN" just not enable it.
+ * - Extended Mode = Disable "FSMC_BCR_EXTMOD"
+ * - Memory Type = SRAM "FSMC_BCR_SRAM"
+ * - Data Width = 16bit "FSMC_BCR_MWID16"
+ * - Write Operation = Enable "FSMC_BCR_WREN"
+ * - Asynchronous Wait = Disable
+ */
+
+ /* Bank1 NOR/SRAM control register configuration */
+
+ putreg32(FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1);
+
+ /* Bank1 NOR/SRAM timing register configuration */
+
+ putreg32(FSMC_BTR_ADDSET(5) | FSMC_BTR_ADDHLD(0) | FSMC_BTR_DATAST(9) | FSMC_BTR_BUSTRUN(0) |
+ FSMC_BTR_CLKDIV(0) | FSMC_BTR_DATLAT(0) | FSMC_BTR_ACCMODA, STM32_FSMC_BTR1);
+
+ putreg32(0xffffffff, STM32_FSMC_BWTR1);
+
+ /* Enable the bank by setting the MBKEN bit */
+
+ putreg32(FSMC_BCR_MBKEN | FSMC_BCR_SRAM | FSMC_BCR_MWID16 | FSMC_BCR_WREN, STM32_FSMC_BCR1);
+}
+
+/**************************************************************************************
+ * Public Functions
+ **************************************************************************************/
+
+/**************************************************************************************
+ * Name: up_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD video hardware. The initial state of the LCD is fully
+ * initialized, display memory cleared, and the LCD ready to use, but with the power
+ * setting at 0 (full off).
+ *
+ **************************************************************************************/
+
+int up_lcdinitialize(void)
+{
+ /* Only initialize the driver once */
+
+ if (!g_ssd1289drvr)
+ {
+ lcdvdbg("Initializing\n");
+
+ /* Configure GPIO pins and configure the FSMC to support the LCD */
+
+ stm32_selectlcd();
+
+ /* Reset the LCD (active low) */
+
+ stm32_gpiowrite(GPIO_LCD_RESET, false);
+ up_mdelay(5);
+ stm32_gpiowrite(GPIO_LCD_RESET, true);
+
+ /* Configure and enable the LCD */
+
+ up_mdelay(50);
+ g_ssd1289drvr = ssd1289_lcdinitialize(&g_ssd1289);
+ if (!g_ssd1289drvr)
+ {
+ lcddbg("ERROR: ssd1289_lcdinitialize failed\n");
+ return -ENODEV;
+ }
+ }
+
+ /* Clear the display (setting it to the color 0=black) */
+
+#if 0 /* Already done in the driver */
+ ssd1289_clear(g_ssd1289drvr, 0);
+#endif
+
+ /* Turn the display off */
+
+ g_ssd1289drvr->setpower(g_ssd1289drvr, 0);
+ return OK;
+}
+
+/**************************************************************************************
+ * Name: up_lcdgetdev
+ *
+ * Description:
+ * Return a a reference to the LCD object for the specified LCD. This allows support
+ * for multiple LCD devices.
+ *
+ **************************************************************************************/
+
+FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
+{
+ DEBUGASSERT(lcddev == 0);
+ return g_ssd1289drvr;
+}
+
+/**************************************************************************************
+ * Name: up_lcduninitialize
+ *
+ * Description:
+ * Unitialize the LCD support
+ *
+ **************************************************************************************/
+
+void up_lcduninitialize(void)
+{
+ /* Turn the display off */
+
+ g_ssd1289drvr->setpower(g_ssd1289drvr, 0);
+}
+
+#endif /* CONFIG_LCD_SSD1289 */
+
+
diff --git a/nuttx/configs/stm32f4discovery/src/up_usb.c b/nuttx/configs/stm32f4discovery/src/up_usb.c
new file mode 100644
index 000000000..89fc96006
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_usb.c
@@ -0,0 +1,294 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sched.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbhost.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+#ifdef CONFIG_STM32_OTGFS
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
+# define HAVE_USB 1
+#else
+# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
+# undef HAVE_USB
+#endif
+
+#ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+#endif
+
+#ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: usbhost_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static int usbhost_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ uvdbg("Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ uvdbg("%s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup USB-related
+ * GPIO pins for the STM32F4Discovery board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
+
+ /* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
+
+#ifdef CONFIG_STM32_OTGFS
+ stm32_configgpio(GPIO_OTGFS_VBUS);
+ stm32_configgpio(GPIO_OTGFS_PWRON);
+ stm32_configgpio(GPIO_OTGFS_OVER);
+#endif
+}
+
+/***********************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host functionality.
+ * This function will start a thread that will monitor for device
+ * connection/disconnection events.
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_usbhost_initialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ uvdbg("Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ udbg("Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ uvdbg("Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ uvdbg("Start usbhost_waiter\n");
+
+ pid = TASK_CREATE("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)usbhost_waiter, (const char **)NULL);
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+
+ return -ENODEV;
+}
+#endif
+
+/***********************************************************************************
+ * Name: stm32_usbhost_vbusdrive
+ *
+ * Description:
+ * Enable/disable driving of VBUS 5V output. This function must be provided be
+ * each platform that implements the STM32 OTG FS host interface
+ *
+ * "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
+ * or, if 5 V are available on the application board, a basic power switch, must
+ * be added externally to drive the 5 V VBUS line. The external charge pump can
+ * be driven by any GPIO output. When the application decides to power on VBUS
+ * using the chosen GPIO, it must also set the port power bit in the host port
+ * control and status register (PPWR bit in OTG_FS_HPRT).
+ *
+ * "The application uses this field to control power to this port, and the core
+ * clears this bit on an overcurrent condition."
+ *
+ * Input Parameters:
+ * iface - For future growth to handle multiple USB host interface. Should be zero.
+ * enable - true: enable VBUS power; false: disable VBUS power
+ *
+ * Returned Value:
+ * None
+ *
+ ***********************************************************************************/
+
+#ifdef CONFIG_USBHOST
+void stm32_usbhost_vbusdrive(int iface, bool enable)
+{
+ DEBUGASSERT(iface == 0);
+
+ if (enable)
+ {
+ /* Enable the Power Switch by driving the enable pin low */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, false);
+ }
+ else
+ {
+ /* Disable the Power Switch by driving the enable pin high */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, true);
+ }
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_setup_overcurrent
+ *
+ * Description:
+ * Setup to receive an interrupt-level callback if an overcurrent condition is
+ * detected.
+ *
+ * Input paramter:
+ * handler - New overcurrent interrupt handler
+ *
+ * Returned value:
+ * Old overcurrent interrupt handler
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBHOST
+xcpt_t stm32_setup_overcurrent(xcpt_t handler)
+{
+ return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler);
+}
+#endif
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_USBDEV
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+#endif
+
+#endif /* CONFIG_STM32_OTGFS */
+
+
+
diff --git a/nuttx/configs/stm32f4discovery/src/up_userleds.c b/nuttx/configs/stm32f4discovery/src/up_userleds.c
new file mode 100644
index 000000000..90adb4882
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_userleds.c
@@ -0,0 +1,248 @@
+/****************************************************************************
+ * configs/stm32f4discovery/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+#include <nuttx/power/pm.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+#include "stm32_internal.h"
+#include "stm32f4discovery-internal.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* This array maps an LED number to GPIO pin configuration */
+
+static uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
+};
+
+/****************************************************************************
+ * Private Function Protototypes
+ ****************************************************************************/
+
+/* LED Power Management */
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
+static int led_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
+#endif
+
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static struct pm_callback_s g_ledscb =
+{
+ .notify = led_pm_notify,
+ .prepare = led_pm_prepare,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: led_pm_notify
+ *
+ * Description:
+ * Notify the driver of new power state. This callback is called after
+ * all drivers have had the opportunity to prepare for the new power state.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static void led_pm_notify(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ switch (pmstate)
+ {
+ case(PM_NORMAL):
+ {
+ /* Restore normal LEDs operation */
+
+ }
+ break;
+
+ case(PM_IDLE):
+ {
+ /* Entering IDLE mode - Turn leds off */
+
+ }
+ break;
+
+ case(PM_STANDBY):
+ {
+ /* Entering STANDBY mode - Logic for PM_STANDBY goes here */
+
+ }
+ break;
+
+ case(PM_SLEEP):
+ {
+ /* Entering SLEEP mode - Logic for PM_SLEEP goes here */
+
+ }
+ break;
+
+ default:
+ {
+ /* Should not get here */
+
+ }
+ break;
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: led_pm_prepare
+ *
+ * Description:
+ * Request the driver to prepare for a new power state. This is a warning
+ * that the system is about to enter into a new power state. The driver
+ * should begin whatever operations that may be required to enter power
+ * state. The driver may abort the state change mode by returning a
+ * non-zero value from the callback function.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+static int led_pm_prepare(struct pm_callback_s *cb , enum pm_state_e pmstate)
+{
+ /* No preparation to change power modes is required by the LEDs driver.
+ * We always accept the state change by returning OK.
+ */
+
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ledinit
+ ****************************************************************************/
+
+void stm32_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+ stm32_configgpio(GPIO_LED3);
+ stm32_configgpio(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: stm32_setled
+ ****************************************************************************/
+
+void stm32_setled(int led, bool ledon)
+{
+ if ((unsigned)led < BOARD_NLEDS)
+ {
+ stm32_gpiowrite(g_ledcfg[led], ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: stm32_setleds
+ ****************************************************************************/
+
+void stm32_setleds(uint8_t ledset)
+{
+ stm32_gpiowrite(BOARD_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED2, (ledset & BOARD_LED2_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED3, (ledset & BOARD_LED3_BIT) == 0);
+ stm32_gpiowrite(BOARD_LED4, (ledset & BOARD_LED4_BIT) == 0);
+}
+
+/****************************************************************************
+ * Name: up_ledpminitialize
+ ****************************************************************************/
+
+#ifdef CONFIG_PM
+void up_ledpminitialize(void)
+{
+ /* Register to receive power management callbacks */
+
+ int ret = pm_register(&g_ledscb);
+ if (ret != OK)
+ {
+ up_ledon(LED_ASSERTION);
+ }
+}
+#endif /* CONFIG_PM */
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/stm32f4discovery/src/up_watchdog.c b/nuttx/configs/stm32f4discovery/src/up_watchdog.c
new file mode 100644
index 000000000..4bef40f78
--- /dev/null
+++ b/nuttx/configs/stm32f4discovery/src/up_watchdog.c
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * configs/stm32f4discovery/src/up_watchdog.c
+ * arch/arm/src/board/up_watchdog.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/watchdog.h>
+#include <arch/board/board.h>
+
+#include "stm32_wdg.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Configuration *******************************************************************/
+/* Wathdog hardware should be enabled */
+
+#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
+# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
+#endif
+
+/* Select the path to the registered watchdog timer device */
+
+#ifndef CONFIG_STM32_WDG_DEVPATH
+# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
+# else
+# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
+# endif
+#endif
+
+/* Use the un-calibrated LSI frequency if we have nothing better */
+
+#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
+# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
+#endif
+
+/* Debug ***************************************************************************/
+/* Non-standard debug that may be enabled just for testing the watchdog timer */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_WATCHDOG
+#endif
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+# define wdgdbg dbg
+# define wdglldbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define wdgvdbg vdbg
+# define wdgllvdbg llvdbg
+# else
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+# endif
+#else
+# define wdgdbg(x...)
+# define wdglldbg(x...)
+# define wdgvdbg(x...)
+# define wdgllvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecuture-specific initialization of the Watchdog hardware.
+ * This interface must be provided by all configurations using
+ * apps/examples/watchdog
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void)
+{
+ /* Initialize tha register the watchdog timer device */
+
+#if defined(CONFIG_STM32_WWDG)
+ stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
+ return OK;
+#elif defined(CONFIG_STM32_IWDG)
+ stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
+ return OK;
+#else
+ return -ENODEV;
+#endif
+}
+
+#endif /* CONFIG_WATCHDOG */
diff --git a/nuttx/configs/sure-pic32mx/Kconfig b/nuttx/configs/sure-pic32mx/Kconfig
new file mode 100644
index 000000000..03753893d
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_SUREPIC32MX
+endif
diff --git a/nuttx/configs/sure-pic32mx/README.txt b/nuttx/configs/sure-pic32mx/README.txt
new file mode 100644
index 000000000..ad9835698
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/README.txt
@@ -0,0 +1,716 @@
+configs/pic32mx README
+=====================
+
+This README file discusses the port of NuttX to the "Advanced USB Storage
+Demo Board," Model DB-DP11215, from Sure Electronics
+(http://www.sureelectronics.net/). This board features the MicroChip
+PIC32MX440F512H. See also http://www.sureelectronics.net/goods.php?id=1168
+for further information about the Sure DB-DP11215 board.
+
+DB_DP11215 PIC32 Storage Demo Board
+
+ - PIC32MX44F512H
+ - SD card slot
+ - RS-2323 Interface
+ - USB (MINI-B)
+ - 2x16 LCD display
+ - Three tactile switches
+ - Four user LEDs
+
+Also available (but not yet supported).
+
+DB-DP11212 PIC32 General Purpose Demo Board
+
+ - PIC32MX44F512H
+ - LM75A temperature sensor and temperature resistor (NTC-SMD thermistor)
+ - SPI FLASH: AT25DF041A
+ - USB (MINI-B)
+ - 2x16 LCD display
+ - 4 digit, 8 segment LED display
+ - Three tactile switches
+ - Four user LEDs
+
+Contents
+========
+
+ PIC32MX440F512H Pin Out
+ Toolchains
+ Loading NuttX with PICkit2
+ PIC32MX Configuration Options
+ Configurations
+
+PIC32MX440F512H Pin Out
+=======================
+
+ DB_DP11215 PIC32 Storage Demo Board
+ -----------------------------------
+ PIC32MX440F512H 64-Pin QFN (USB) Pin Out as used on the DB_DP11215 PIC32 Storage
+ Demo Board.
+
+ LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 1 PMD5/RE5 PMPD5 Display, JP1-12, DB4
+ 2 PMD6/RE6 PMPD6 Display, JP1-13, DB6
+ 3 PMD7/RE7 PMPD7 Display, JP1-14, DB7
+ 4 SCK2/PMA5/CN8/RG6 SCK SD connector SCK, FLASH (U1) SCK*
+ 5 SDI2/PMA4/CN9/RG7 SDI SD connector DO, FLASH (U1) SO*
+ 6 SDO2/PMA3/CN10/RG8 SDO SD connector DI, FLASH (U1) SI*
+ 7 MCLR\ PIC_MCLR Pulled high, J7-1, ICSP
+ 8 SS2/PMA2/CN11/RG9 UTIL_CS FLASH (U1) CS*
+ 9 Vss Grounded
+ 10 Vdd +3.3V ---
+ 11 AN5/C1IN+/Vbuson/CN7/RB5 Vbuson/AN5/RB5 To USB VBUS circuitry
+ 12 AN4/C1IN-/CN6/RB4 SW_OK SW3, Pull high, low means SW3 closed
+ 13 AN3/C2IN+/CN5/RB3 SW_UP SW1, Pull high, low means SW1 closed
+ 14 AN2/C2IN-/CN4/RB2 SW_Down SW2, Pull high, low means SW2 closed
+ 15 PGEC1/AN1/Vref-/CVref-/CN3/ ADC_SENSE_SWITCHED_+VBUS To USB VBUS circuitry
+ RB1
+ 16 PGED1/AN0/VREF+/CVREF+/PMA6/ N/C Not connected
+ CN2/RB0
+
+ *FLASH (U1, SOIC) not populated
+
+ BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 17 PGEC2/AN6/OCFA/RB6 PIC_PGC2 J7-5, ICSP
+ 18 PGED2/AN7/RB7 PIC_PGD2 J7-4, ICSP
+ 19 AVdd +3.3V ---
+ 20 AVss Grounded
+ 21 AN8/U2CTS/C1OUT/RB8 N/C Not connected
+ 22 AN9/C2OUT/PMA7/RB9 N/C Not connected
+ 23 TMS/AN10/CVREFOUT/PMA13/RB10 UTIL_WP FLASH (U1) WP*
+ 24 TDO/AN11/PMA12/RB11 SD_CS SD connector CS
+ 25 Vss Grounded
+ 26 Vdd +3.3V ---
+ 27 TCK/AN12/PMA11/RB12 SD_CD SD connector CD
+ 28 TDI/AN13/PMA10/RB13 SD_WD SD connector WD
+ 29 AN14/U2RTS/PMALH/PMA1/RB14 N/C Not connected
+ 30 AN15/OCFB/PMALL/PMA0/CN12/ PMPA0 Display, JP1-4, RS
+ RB15
+ 31 SDA2/U2RX/PMA9/CN17/RF4 RXD2_MCU J5 DB9 via RS232 driver
+ 32 SCL2/U2TX/PMA8/CN18/RF5 TXD2_MCU J5 DB9 via RS232 driver
+
+ *FLASH (U1, SOIC) not populated
+
+ RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 48 SOSCO/T1CK/CN0/RC14 SOSCO 32.768KHz XTAL (Y1)
+ 47 SOSCI/CN1/RC13 SOSCI 32.768KHz XTAL (Y1)
+ 46 OC1/INT0/RD0 PWM1 Used to control backlight level (K)
+ 45 IC4/PMCS1/PMA14/INT4/RD11 PMPCS1 Display, JP1-6, E
+ 44 SCL1/IC3/PMCS2/PMA15/INT3/ USB_OPT USB PHY
+ RD10
+ 43 U1CTS/SDA1/IC2/INT2/RD9 USB_OPTEN USB PHY
+ 42 RTCC/IC1/INT1/RD8 N/C Not connected
+ 41 Vss Grounded
+ 40 OSC2/CLKO/RC15 OSC2 20MHz XTAL (Y2)
+ 39 OSC1/CLKI/RC12 OSC1 20MHz XTAL (Y2)
+ 38 Vdd +3.3V ---
+ 37 D+/RG2 APPS_D+ USB connectors via PHY
+ 36 D-/RG3 APPS_D- USB connectors via PHY
+ 35 Vusb +3.3V ---
+ 34 Vbus VBUS_DEVICE_MODE Display, USB Mini-B, USB Type A, JP1-1, +5V
+ 33 USBID/RF3 N/C Not connected
+
+ TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 64 PMPD4/RE4 PMPD4 Display, JP1-11, DB4
+ 63 PMPD3/RE3 PMPD3 Display, JP1-10, DB3
+ 62 PMPD2/RE2 PMPD2 Display, JP1-9, DB2
+ 61 PMPD1/RE1 PMPD1 Display, JP1-8, DB1
+ 60 PMPD0/RE0 PMPD0 Display, JP1-7, DB0
+ 59 RF1 RF1 Low illuminates LED/R/ERR
+ 58 RF0 RF0 Low illuminates LED/Y/flash
+ 57 ENVREG ENVREG Pulled high
+ 56 Vcap/Vddcore VDDCORE Capactors to ground
+ 55 CN16/RD7 RD7 Low illuminates LED/Y/USB
+ 54 CN15/RD6 RD6 Low illuminates LED/Y/SD
+ 53 PMRD/CN14/RD5 PMPRD Display, JP1-5, R/W
+ 52 OC5/IC5/PMWR/CN13/RD4 N/C Not connected
+ 51 U1TX/OC4/RD3 CP2102_RXD J6-3, UART1 (also CP2102*)
+ 50 U1RX/OC3/RD2 CP2102_TXD J6-2, UART1 (also CP2102*)
+ 49 U1RTS/OC2/RD1 PWM2 Used to control backlight level (Vo)
+
+ *USB-to-UART bridge (U1, CP2102) not populated
+
+ DB-DP11212 PIC32 General Purpose Demo Board
+ -------------------------------------------
+ PIC32MX440F512H 64-Pin QFN (USB) Pin Out as used on the DB-DP11212 PIC32 General
+ Purpose Demo Board
+
+ LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 1 PMD5/RE5 PMPD5 Display, JP1-12, DB5
+ 2 PMD6/RE6 PMPD6 Display, JP1-13, DB6
+ 3 PMD7/RE7 PMPD7 Display, JP1-14, DB7
+ 4 SCK2/PMA5/CN8/RG6 SCK FLASH (U4) SCK*
+ 5 SDI2/PMA4/CN9/RG7 SDI FLASH (U4) SO*
+ 6 SDO2/PMA3/CN10/RG8 SDO FLASH (U4) SI*
+ 7 MCLR\ PIC_MCLR Pulled high, J2-1, ICSP
+ 8 SS2/PMA2/CN11/RG9 N/C Not connected
+ 9 Vss Grounded
+ 10 Vdd +3.3V ---
+ 11 Vbuson/AN5/CN7/RB5 RB5 LCD SEG5 (F), U5-10
+ 12 AN4/CN6/RB4 RB4 LCD SEG4 (E), U5-1
+ 13 AN3/CN5/RB3 RB3 LCD SEG3 (D), U5-2
+ 14 AN2/CN4/RB2 RB2 LCD SEG2 (C), U5-4
+ 15 PGEC1/AN1/Vref-/CN3/RB1 RB1 LCD SEG1 (B), U5-7
+ 16 PGED1/AN0/VREF+/CVREF+/PMA6/ RB0 LCD SEG0 (A), U5-11
+ CN2/RB0
+
+ *FLASH (U4, SOIC) not populated
+
+ BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 17 PGEC2/AN6/OCFA/RB6 PIC_PGC2 J2-5, ICSP
+ 18 PGED2/AN7/RB7 PIC_PGD2 J2-4, ICSP
+ 19 AVdd +3.3V ---
+ 20 AVss Grounded
+ 21 AN8/U2CTS/RB8 RB8 LCD SEG6 (G), U5-5
+ 22 AN9/PMA7/RB9 RB9 LCD SEG7 (DP), U5-3
+ 23 TMS/AN10/PMA13/RB10 UTIL_WP FLASH (U4) WP*
+ 24 TDO/AN11/PMA12/RB11 UTIL_CS FLASH (U4) CS*
+ 25 Vss Grounded
+ 26 Vdd +3.3V ---
+ 27 TCK/AN12/PMA11/RB12 N/C Not connected
+ 28 TDI/AN13/PMA10/RB13 N/C Not connected
+ 29 AN14/U2RTS/PMA1/RB14 temp_AD temp_AD
+ 30 AN15/PMA0/CN12/RB15 PMPA0 Display, JP1-4, RS
+ 31 SDA2/U2RX/PMA9/CN17/RF4 SDA LM75/SO, U3-1, SDA
+ 32 SCL2/U2TX/PMA8/CN18/RF5 SCL LM75/SO, U3-2, SCL
+
+ *FLASH (U4, SOIC) not populated
+
+ RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 48 SOSCO/T1CK/CN0/RC14 SOSCO 32.768KHz XTAL (Y1)
+ 47 SOSCI/CN1/RC13 SOSCI 32.768KHz XTAL (Y1)
+ 46 OC1/INT0/RD0 RD0 LCD DIG1, U5-12
+ 45 IC4/PMCS1/PMA14/RD11 PMCS1 Display, JP1-6, E
+ 44 SCL1/PMCS2/PMA15 RD10 LCD DIG2, U5-9
+ 43 SDA1/RD9 RD9 LCD DIG3, U5-8
+ 42 RTCC/RD8 RD8 LCD DIG4, U5-6
+ 41 Vss Grounded
+ 40 OSC2/CLKO/RC15 OSC2 20MHz XTAL (Y2)
+ 39 OSC1/CLKI/RC12 OSC1 20MHz XTAL (Y2)
+ 38 Vdd +3.3V ---
+ 37 D+ MCU_D+ USB connectors via PHY
+ 36 D- MCU_D- USB connectors via PHY
+ 35 Vusb +3.3V ---
+ 34 Vbus +5V_DUSB Display, USB Mini-B, USB Type A, JP1-1, +5V
+ 33 USBID/RF3 N/C Not connected
+
+ TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ PIN NAME SIGNAL NOTES
+ ---- ----------------------------- -------------- -------------------------------
+ 64 PMPD4/RD4 PMPD4 Display, JP1-11, DB4
+ 63 PMPD3/RD3 PMPD3 Display, JP1-10, DB3
+ 62 PMPD2/RD2 PMPD2 Display, JP1-9, DB2
+ 61 PMPD1/RD1 PMPD1 Display, JP1-8, DB1
+ 60 PMPD0/RE0 PMPD0 Display, JP1-7, DB0
+ 59 RF1 Key3 SW3-1
+ 58 RF0 Key2 SW2-1
+ 57 ENVREG ENVREG Pulled high
+ 56 Vcap/Vddcore VDDCORE Capacitors to ground
+ 55 CN16/RD7 N/C Not connected
+ 54 CN15/RD6 Key5 SW5-1
+ 53 PMRD/CN14/RD5 PMPRD ---
+ 52 OC5/PMWR/CN13/RD4 PWM2 Used to control backlight level (Vo)
+ 51 U1TX/OC4/RD3 N/C Not connected
+ 50 U1RX/OC3/RD2 N/C Not connected
+ 49 OC2/RD1 PWM1 Used to control backlight level (K)
+
+Toolchains
+==========
+
+ MPLAB/C32
+ ---------
+
+ I am using the free, "Lite" version of the PIC32MX toolchain available
+ for download from the microchip.com web site. I am using the Windows
+ version. The MicroChip toolchain is the only toolchain currently
+ supported in these configurations, but it should be a simple matter to
+ adapt to other toolchains by modifying the Make.defs file include in
+ each configuration.
+
+ C32 Toolchain Options:
+
+ CONFIG_PIC32MX_MICROCHIPW - MicroChip full toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL - MicroChip full toolchain for Linux
+ CONFIG_PIC32MX_MICROCHIPW_LITE - MicroChip "Lite" toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL_LITE - MicroChip "Lite" toolchain for Linux
+
+ NOTE: The "Lite" versions of the toolchain does not support C++. Also
+ certain optimization levels are not supported by the "Lite" toolchain.
+
+ MicrochipOpen
+ -------------
+
+ An alternative, build-it-yourself toolchain is available here:
+ http://sourceforge.net/projects/microchipopen/ . These tools were
+ last updated circa 2010. NOTE: C++ support still not available
+ in this toolchain.
+
+ Building MicrochipOpen (on Linux)
+
+ 1) Get the build script from this location:
+
+ http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
+
+ 2) Build the code using the build script, for example:
+
+ ./build.sh -b v105_freeze
+
+ This will check out the selected branch and build the tools.
+
+ 3) Binaries will then be available in a subdirectory with a name something like
+ pic32-v105-freeze-20120622/install-image/bin (depending on the current data
+ and the branch that you selected.
+
+ Note that the tools will have the prefix, mypic32- so, for example, the
+ compiler will be called mypic32-gcc.
+
+ Penguino mips-elf Toolchain
+ ---------------------------
+
+ Another option is the mips-elf toolchain used with the Penguino project. This
+ is a relatively current mips-elf GCC and should provide free C++ support as
+ well. This toolchain can be downloded from the Penguino website:
+ http://wiki.pinguino.cc/index.php/Main_Page#Download . There is some general
+ information about using the Penguino mips-elf toolchain in this thread:
+ http://tech.groups.yahoo.com/group/nuttx/message/1821
+
+ See also configs/mirtoo/README.txt. There is an experimental (untested)
+ configuration for the Mirtoo platform in that directory.
+
+ MPLAB/C32 vs MPLABX/X32
+ -----------------------
+
+ It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
+ it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
+ with the NuttX build scripts. Here are some of the issues that I see when trying
+ to build with XC32:
+
+ 1) Make.def changes: You have to change the tool prefix:
+
+ CROSSDEV=xc32-
+
+ 2) debug.ld/release.ld: The like expect some things that are not present in
+ the current linker scripts (or are expected with different names). Here
+ are some partial fixes:
+
+ Rename: kseg0_progmem to kseg0_program_mem
+ Rename: kseg1_datamem to kseg1_data_mem
+
+ Even then, there are more warnings from the linker and some undefined symbols
+ for non-NuttX code that resides in the unused Microchip libraries. See this
+ email thread at http://tech.groups.yahoo.com/group/nuttx/message/1458 for more
+ information. You will have to solve at least this undefined symbol problem if
+ you want to used the XC32 toolchain.
+
+ Windows Native Toolchains
+ -------------------------
+
+ NOTE: There are several limitations to using a Windows based toolchain in a
+ Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+Loading NuttX with PICkit2
+==========================
+
+ NOTE: You need a PICKit3 if you plan to use the MPLAB debugger! The PICKit2
+ can, however, still be used to load programs. Instructions for the PICKit3
+ are similar.
+
+ Intel Hex Forma Files:
+ ----------------------
+
+ When NuttX is built it will produce two files in the top-level NuttX
+ directory:
+
+ 1) nuttx - This is an ELF file, and
+ 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
+ the setting CONFIG_INTELHEX_BINARY in the .config file.
+
+ The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
+ there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
+ file to contain physical addresses. But the nuttx.hex file generated from the
+ top-level make will have address in the KSEG0 and KSEG1 regions.
+
+ tools/pic32mx/mkpichex:
+ ----------------------
+
+ There is a simple tool in the NuttX tools/pic32mx directory that can be
+ used to solve both issues with the nuttx.hex file. But, first, you must
+ build the tool:
+
+ cd tools/pic32mx
+ make
+
+ Now you will have an excecutable file call mkpichex (or mkpichex.exe on
+ Cygwin). This program will take the nutt.hex file as an input, it will
+ convert all of the KSEG0 and KSEG1 addresses to physical address, and
+ it will write the modified file, replacing the original nuttx.hex.
+
+ To use this file, you need to do the following things:
+
+ . ./setenv.sh # Source setenv.sh. Among other this, this script
+ # will add the NuttX tools/pic32mx directory to your
+ # PATH variable
+ make # Build nuttx and nuttx.hex
+ mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
+ # to the top-level build directory. It is the only
+ # required input to mkpichex.
+
+PIC32MX Configuration Options
+=============================
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=mips
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_MIPS=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_MIPS32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=pic32mx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_PIC32MX440F512H=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=sure-pic32mx
+
+ CONFIG_ARCH_DBDP11215 Distinguishes the DB_DP11215 PIC32 Storage
+ Demo Board
+
+ CONFIG_ARCH_DBDP11212 Distingustes the DB-DP11212 PIC32 General
+ Purpose Demo Board
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_SUREPIC32MX=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0xa0000000
+
+ CONFIG_ARCH_IRQPRIO - The PIC32MXx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ PIC32MX Configuration
+
+ CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
+
+ Individual subsystems can be enabled:
+
+ CONFIG_PIC32MX_WDT - Watchdog timer
+ CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
+ CONFIG_PIC32MX_T3 - Timer 3
+ CONFIG_PIC32MX_T4 - Timer 4
+ CONFIG_PIC32MX_T5 - Timer 5
+ CONFIG_PIC32MX_IC1 - Input Capture 1
+ CONFIG_PIC32MX_IC2 - Input Capture 2
+ CONFIG_PIC32MX_IC3 - Input Capture 3
+ CONFIG_PIC32MX_IC4 - Input Capture 4
+ CONFIG_PIC32MX_IC5 - Input Capture 5
+ CONFIG_PIC32MX_OC1 - Output Compare 1
+ CONFIG_PIC32MX_OC2 - Output Compare 2
+ CONFIG_PIC32MX_OC3 - Output Compare 3
+ CONFIG_PIC32MX_OC4 - Output Compare 4
+ CONFIG_PIC32MX_OC5 - Output Compare 5
+ CONFIG_PIC32MX_I2C1 - I2C 1
+ CONFIG_PIC32MX_I2C2 - I2C 2
+ CONFIG_PIC32MX_SPI2 - SPI 2
+ CONFIG_PIC32MX_UART1 - UART 1
+ CONFIG_PIC32MX_UART2 - UART 2
+ CONFIG_PIC32MX_ADC - ADC 1
+ CONFIG_PIC32MX_PMP - Parallel Master Port
+ CONFIG_PIC32MX_CM1 - Comparator 1
+ CONFIG_PIC32MX_CM2 - Comparator 2
+ CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA - DMA
+ CONFIG_PIC32MX_FLASH - FLASH
+ CONFIG_PIC32MX_USBDEV - USB device
+ CONFIG_PIC32MX_USBHOST - USB host
+
+ PIC32MX Configuration Settings
+ DEVCFG0:
+ CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
+ value 2 enables.
+ CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
+ Default 1 (PG2)
+ CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
+ CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
+ CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
+ DEVCFG1: (All settings determined by selections in board.h)
+ DEVCFG2: (All settings determined by selections in board.h)
+ DEVCFG3:
+ CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
+ (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
+ (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
+ can be enabled later by software).
+
+ The priority of interrupts may be specified. The value ranage of
+ priority is 4-31. The default (16) will be used if these any of these
+ are undefined.
+
+ CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
+ CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
+ CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
+ CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
+ CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
+ CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
+ CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
+ CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
+ CONFIG_PIC32MX_T2PRIO - Timer 2 priority
+ CONFIG_PIC32MX_T3PRIO - Timer 3 priority
+ CONFIG_PIC32MX_T4PRIO - Timer 4 priority
+ CONFIG_PIC32MX_T5PRIO - Timer 5 priority
+ CONFIG_PIC32MX_IC1PRIO - Input Capture 1
+ CONFIG_PIC32MX_IC2PRIO - Input Capture 2
+ CONFIG_PIC32MX_IC3PRIO - Input Capture 3
+ CONFIG_PIC32MX_IC4PRIO - Input Capture 4
+ CONFIG_PIC32MX_IC5PRIO - Input Capture 5
+ CONFIG_PIC32MX_OC1PRIO - Output Compare 1
+ CONFIG_PIC32MX_OC2PRIO - Output Compare 2
+ CONFIG_PIC32MX_OC3PRIO - Output Compare 3
+ CONFIG_PIC32MX_OC4PRIO - Output Compare 4
+ CONFIG_PIC32MX_OC5PRIO - Output Compare 5
+ CONFIG_PIC32MX_I2C1PRIO - I2C 1
+ CONFIG_PIC32MX_I2C2PRIO - I2C 2
+ CONFIG_PIC32MX_SPI2PRIO - SPI 2
+ CONFIG_PIC32MX_UART1PRIO - UART 1
+ CONFIG_PIC32MX_UART2PRIO - UART 2
+ CONFIG_PIC32MX_CN - Input Change Interrupt
+ CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
+ CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
+ CONFIG_PIC32MX_CM1PRIO - Comparator 1
+ CONFIG_PIC32MX_CM2PRIO - Comparator 2
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
+ CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
+ CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
+ CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
+ CONFIG_PIC32MX_FCEPRIO - Flash Control Event
+ CONFIG_PIC32MX_USBPRIO - USB
+
+ PIC32MXx specific device driver settings. NOTE: For the Sure board,
+ UART2 is brought out to the DB9 connector and serves as the serial
+ console.
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ PIC32MXx USB Device Configuration
+
+ PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
+
+Configurations
+==============
+
+Each PIC32MX configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh sure-pic32mx/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ =======
+ Description.
+ ------------
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ nsh:
+ ====
+ Description.
+ ------------
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables only the serial NSH interface.
+
+ USB Configuations.
+ -----------------
+ Several USB device configurations can be enabled and included
+ as NSH built-in built in functions. All require the following
+ basic setup in your .config to enable USB device support:
+
+ CONFIG_USBDEV=y : Enable basic USB device support
+ CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
+
+ examples/usbterm - This option can be enabled by uncommenting
+ the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/usbterm
+
+ And by enabling one of the USB serial devices:
+
+ CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
+ CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
+
+ examples/cdcacm - The examples/cdcacm program can be included as an
+ function by uncommenting the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/cdcacm
+
+ and defining the following in your .config file:
+
+ CONFIG_CDCACM=y : Enable the CDCACM device
+
+ examples/usbstorage - There are some hooks in the appconfig file
+ to enable the USB mass storage device. However, this device cannot
+ work until support for the SD card is also incorporated.
+
+ SD Card Support.
+ ----------------
+ Support for the on-board, SPI-based SD card is available but is
+ not yet functional (at least at the time of this writing). SD
+ card support can be enabled for testing by simply enabling SPI2
+ support in the configuration file:
+
+ -CONFIG_PIC32MX_SPI2=n
+ +CONFIG_PIC32MX_SPI2=y
+
+ Debug output for testing the SD card can be enabled using:
+
+ -CONFIG_DEBUG_FS=n
+ -CONFIG_DEBUG_SPI=n
+ +CONFIG_DEBUG_FS=y
+ +CONFIG_DEBUG_SPI=y
+
+ usbnsh:
+ =======
+ Description.
+ ------------
+ This is another NSH example. If differs from the 'nsh' configuration
+ above in that this configurations uses a USB serial device for console
+ I/O. This configuration was created to support the "DB-DP11212 PIC32
+ General Purpose Demo Board" which has no easily accessible serial port.
+ However, as of this writing, the configuration has set for the
+ "DB_DP11215 PIC32 Storage Demo Board" and has only be testing on that
+ board.
+
+ Comparison to nsh
+ -----------------
+ Below summarizes the key configuration differences between the 'nsh'
+ and the 'upnsh' configurations:
+
+ CONFIG_USBDEV=y : NuttX USB device support is enabled
+ CONFIG_PIC32MX_USBDEV=y : The PIC32MX USB device driver is built
+ CONFIG_UART1_SERIAL_CONSOLE=n : There is no serial console
+ CONFIG_UART2_SERIAL_CONSOLE=n :
+ CONFIG_CDCACM=y : The CDC/ACM serial device class is enabled
+ CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is the console
+
+ Using the Prolifics PL2303 Emulation
+ ------------------------------------
+ You could also use the non-standard PL2303 serial device instead of
+ the standard CDC/ACM serial device by changing:
+
+ CONFIG_CDCACM=y : Disable the CDC/ACM serial device class
+ CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is NOT the console
+ CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled
+ CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console
+
+ Why would you want to use a non-standard USB serial driver? You might
+ to use the PL2303 driver with a Windows host because it should
+ automatically install the PL2303 driver (you might have to go through
+ some effort to get Windows to recognize the CDC/ACM device).
diff --git a/nuttx/configs/sure-pic32mx/include/board.h b/nuttx/configs/sure-pic32mx/include/board.h
new file mode 100644
index 000000000..3b4d7f798
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/include/board.h
@@ -0,0 +1,214 @@
+/****************************************************************************
+ * configs/sure-pic32mx/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_SURE_PIC32MX_INCLUDE_BOARD_H
+#define __CONFIGS_SURE_PIC32MX_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Crystal frequencies */
+
+#define BOARD_POSC_FREQ 20000000 /* Primary OSC XTAL frequency (20MHz) */
+#define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz) */
+
+/* Oscillator modes */
+
+#define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
+#define BOARD_POSC_HSMODE 1 /* High-speed crystal (HS) mode */
+
+/* PLL configuration and resulting CPU clock.
+ * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
+ */
+
+#define BOARD_PLL_INPUT BOARD_POSC_FREQ
+#define BOARD_PLL_IDIV 5 /* PLL input divider */
+#define BOARD_PLL_MULT 15 /* PLL multiplier */
+#define BOARD_PLL_ODIV 1 /* PLL output divider */
+
+#define BOARD_CPU_CLOCK 60000000 /* CPU clock (60MHz = (20MHz / 5) * 15 / 1) */
+
+/* USB PLL configuration.
+ * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
+ */
+
+#define BOARD_UPLL_IDIV 5 /* USB PLL divider */
+#define BOARD_USB_CLOCK 48000000 /* USB clock ((20MHz / 5) * 24) / 2 */
+
+/* Peripheral clock is *not* divided down from CPU clock.
+ * PBCLOCK = CPU_CLOCK / PBDIV
+ */
+
+#define BOARD_PBDIV 1 /* Peripheral clock divisor (PBDIV) */
+#define BOARD_PBCLOCK 60000000 /* Peripheral clock (PBCLK = 60MHz/1) */
+
+/* Watchdog pre-scaler (re-visit) */
+
+#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
+#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
+
+/* Timer 1 is a type A timer and is used as system clock. It can be clocked
+ * with either the SOSC or the PBCLOCK. We will use the PBCLOCK because it
+ * is much more accurate.
+ */
+
+#undef BOARD_TIMER1_SOSC
+
+/* LED definitions **********************************************************/
+/* The Sure DB_DP11215 PIC32 Storage Demo Board board has five LEDs. One
+ * (D4, lablel "Power") is not controllable by software. Four are
+ * controllable by software:
+ *
+ * D7 "USB" Yellow RD7 Low illuminates
+ * D8 "SD" Yellow RD6 Low illuminates
+ * D9 "Flash" Yellow RF0 Low illuminates
+ * D10 "Error" Red RF1 Low illuminates
+ */
+ /* ON OFF */
+ /* USB SD FLASH ERROR USB SD FLASH ERROR */
+#define LED_STARTED 0 /* OFF OFF OFF OFF --- --- --- --- */
+#define LED_HEAPALLOCATE 1 /* ON OFF N/C N/C --- --- --- --- */
+#define LED_IRQSENABLED 2 /* OFF ON N/C N/C --- --- --- --- */
+#define LED_STACKCREATED 3 /* ON ON N/C N/C --- --- --- --- */
+#define LED_INIRQ 4 /* N/C N/C ON N/C N/C N/C OFF N/C */
+#define LED_SIGNAL 4 /* N/C N/C ON N/C N/C N/C OFF N/C */
+#define LED_ASSERTION 4 /* N/C N/C ON N/C N/C N/C OFF N/C */
+#define LED_PANIC 5 /* N/C N/C N/C ON N/C N/C N/C OFF */
+#define LED_NVALUES 6
+
+/* The Sure DB-DP11212 PIC32 General Purpose Demo Board does not have any user
+ * controllable LEDs, but does does have a segment LED display. That display is
+ * however, obscured by the larger segment display attached to the board and, so,
+ * is not supported.
+ */
+
+/* For distinguishing individual LEDs */
+
+#define LED_USB 0
+#define LED_SD 1
+#define LED_FLASH 2
+#define LED_ERROR 3
+
+/* Button Definitions *******************************************************/
+/* The Sure PIC32MX board has three buttons.
+ *
+ * SW1 (SW_UP, left arrow) RB3 Pulled high, Grounded/low when depressed
+ * SW2 (SW_DOWN, down/right arrow) RB2 Pulled high, Grounded/low when depressed
+ * SW3 (SW_OK, right arrow) RB4 Pulled high, Grounded/low when depressed
+ */
+
+#define BUTTON_SW1 0
+#define BUTTON_SW2 1
+#define BUTTON_SW3 2
+#define NUM_BUTTONS 3
+
+#define BUTTON_SW1_BIT (1 << BUTTON_SW1)
+#define BUTTON_SW2_BIT (1 << BUTTON_SW2)
+#define BUTTON_SW3_BIT (1 << BUTTON_SW3)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource.
+ * See the BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it
+ * may restored, if so desired).
+ *
+ * When an interrupt occurs, it is due to a change on the GPIO input pin
+ * associated with the button. In that case, all attached change
+ * notification handlers will be called. Each handler must maintain state
+ * and determine if the unlying GPIO button input value changed.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SURE_PIC32MX_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/sure-pic32mx/nsh/Make.defs b/nuttx/configs/sure-pic32mx/nsh/Make.defs
new file mode 100644
index 000000000..9d22039f9
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/nsh/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/sure-pic32mx/nsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sure-pic32mx/nsh/appconfig b/nuttx/configs/sure-pic32mx/nsh/appconfig
new file mode 100644
index 000000000..2263c5a3e
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/nsh/appconfig
@@ -0,0 +1,77 @@
+############################################################################
+# configs/sure-pic32mx/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+############################################################################
+# Path to example in apps/examples containing the user_start entry point
+############################################################################
+
+CONFIGURED_APPS += examples/nsh
+
+############################################################################
+# The NSH application library
+############################################################################
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+############################################################################
+# USB device configurations
+############################################################################
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+
+# USB Mass Storage Class device configurations
+
+ifeq ($(CONFIG_USBMSC),y)
+# Uncomment to enable the examples/usbstorage built-in
+# CONFIGURED_APPS += examples/usbstorage
+endif
+
+# USB CDC/ACM serial device configurations
+
+ifeq ($(CONFIG_CDCACM),y)
+# Uncomment to enable the examples/cdcacm built-in
+# CONFIGURED_APPS += examples/cdcacm
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+
+# Prolifics PL2303 emulation configurations
+
+ifeq ($(CONFIG_PL2303),y)
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+endif
diff --git a/nuttx/configs/sure-pic32mx/nsh/defconfig b/nuttx/configs/sure-pic32mx/nsh/defconfig
new file mode 100644
index 000000000..ded591f3e
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/nsh/defconfig
@@ -0,0 +1,532 @@
+############################################################################
+# configs/sure-pic32mx/nsh/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX440F512H=y
+CONFIG_ARCH_BOARD="sure-pic32mx"
+CONFIG_ARCH_BOARD_SUREPIC32MX=y
+CONFIG_ARCH_DBDP11215=y
+CONFIG_ARCH_DBDP11212=n
+CONFIG_BOARD_LOOPSPERMSEC=4275
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=n
+CONFIG_PIC32MX_UART2=y
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=y
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_USB=n
+CONFIG_DEBUG_FS=n
+CONFIG_DEBUG_SPI=n
+CONFIG_SPI_REGDEBUG=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=12
+CONFIG_START_DAY=22
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=2
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sure-pic32mx/nsh/ld.script b/nuttx/configs/sure-pic32mx/nsh/ld.script
new file mode 100644
index 000000000..a88bdc2c8
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/nsh/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/sure-pic32mx/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX440F512H has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX440F512H has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX440F512H has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/sure-pic32mx/nsh/setenv.sh b/nuttx/configs/sure-pic32mx/nsh/setenv.sh
new file mode 100755
index 000000000..8c4df233b
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/nsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/sure-pic32mx/nsh/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sure-pic32mx/ostest/Make.defs b/nuttx/configs/sure-pic32mx/ostest/Make.defs
new file mode 100644
index 000000000..3a41786e4
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/ostest/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/sure-pic32mx/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sure-pic32mx/ostest/appconfig b/nuttx/configs/sure-pic32mx/ostest/appconfig
new file mode 100644
index 000000000..3b96b3d6d
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/sure-pic32mx/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/sure-pic32mx/ostest/defconfig b/nuttx/configs/sure-pic32mx/ostest/defconfig
new file mode 100644
index 000000000..d6e3f894f
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/ostest/defconfig
@@ -0,0 +1,462 @@
+############################################################################
+# configs/sure-pic32mx/ostest/defconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX440F512H=y
+CONFIG_ARCH_BOARD="sure-pic32mx"
+CONFIG_ARCH_BOARD_SUREPIC32MX=y
+CONFIG_ARCH_DBDP11215=y
+CONFIG_ARCH_DBDP11212=n
+CONFIG_BOARD_LOOPSPERMSEC=4275
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=n
+CONFIG_PIC32MX_UART2=y
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=y
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=8
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=2
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sure-pic32mx/ostest/ld.script b/nuttx/configs/sure-pic32mx/ostest/ld.script
new file mode 100644
index 000000000..7b5ffa3c4
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/ostest/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/sure-pic32mx/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX440F512H has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX440F512H has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX440F512H has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/sure-pic32mx/ostest/setenv.sh b/nuttx/configs/sure-pic32mx/ostest/setenv.sh
new file mode 100755
index 000000000..b26ea960e
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/sure-pic32mx/ostest/setenv.sh
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/sure-pic32mx/src/Makefile b/nuttx/configs/sure-pic32mx/src/Makefile
new file mode 100644
index 000000000..f5f9a89ea
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/Makefile
@@ -0,0 +1,108 @@
+############################################################################
+# configs/sure-pic32mx/src/Makefile
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_spi.c
+
+# Only the DB_DP11215 PIC32 Storage Demo Board board has user controllable
+# LEDs
+
+ifeq ($(CONFIG_ARCH_DBDP11215),y)
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+CSRCS += up_usbdev.c
+ifeq ($(CONFIG_EXAMPLES_USBTERM_DEVINIT),y)
+CSRCS += up_usbterm.c
+endif
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/sure-pic32mx/src/sure-internal.h b/nuttx/configs/sure-pic32mx/src/sure-internal.h
new file mode 100644
index 000000000..34e881f41
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/sure-internal.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * configs/sure-pic32mx/src/sure-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_SURE_PIC32MX_SRC_SURE_INTERNAL_H
+#define __CONFIGS_SURE_PIC32MX_SRC_SURE_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* The Sure PIC32MX board has five LEDs. One (D4, lablel "Power") is not
+ * controllable by software. Four are controllable by software:
+ *
+ * D7 "USB" Yellow RD7 Low illuminates
+ * D8 "SD" Yellow RD6 Low illuminates
+ * D9 "Flash" Yellow RF0 Low illuminates
+ * D10 "Error" Red RF1 Low illuminates
+ */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Sure PIC32MX Logic board.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PIC32MX_SPI2)
+EXTERN void weak_function pic32mx_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_usbdevinitialize
+ *
+ * Description:
+ * Called to configure the mini-B PHY on the Sure PIC32MX board for the USB device
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PIC32MX_USBDEV)
+EXTERN void weak_function pic32mx_usbdevinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_SURE_PIC32MX_SRC_SURE_INTERNAL_H */
diff --git a/nuttx/configs/sure-pic32mx/src/up_boot.c b/nuttx/configs/sure-pic32mx/src/up_boot.c
new file mode 100644
index 000000000..2982cdbf4
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_boot.c
@@ -0,0 +1,102 @@
+/************************************************************************************
+ * configs/sure-pic32mx/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "sure-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_boardinitialize
+ *
+ * Description:
+ * All PIC32MX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void pic32mx_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak
+ * function pic32mx_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_PIC32MX_SPI2)
+ if (pic32mx_spiinitialize)
+ {
+ pic32mx_spiinitialize();
+ }
+#endif
+
+ /* Configure the mini-B PHY on the Sure PIC32MX board for the USB device */
+
+#if defined(CONFIG_PIC32MX_USBDEV)
+ if (pic32mx_usbdevinitialize)
+ {
+ pic32mx_usbdevinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ pic32mx_ledinit();
+#endif
+}
diff --git a/nuttx/configs/sure-pic32mx/src/up_buttons.c b/nuttx/configs/sure-pic32mx/src/up_buttons.c
new file mode 100644
index 000000000..80fb35fdb
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_buttons.c
@@ -0,0 +1,223 @@
+/****************************************************************************
+ * configs/sure-pic32mx/src/up_buttons.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "pic32mx-internal.h"
+#include "pic32mx-ioport.h"
+#include "pic32mx-adc.h"
+#include "sure-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* The Sure DB_DP11215 PIC32 Storage Demo Board has three buttons.
+ *
+ * SW1 (SW_UP, left arrow) RB3 Pulled high, Grounded/low when depressed
+ * SW2 (SW_DOWN, down/right arrow) RB2 Pulled high, Grounded/low when depressed
+ * SW3 (SW_OK, right arrow) RB4 Pulled high, Grounded/low when depressed
+ *
+ * The Sure DB-DP11212 PIC32 General Purpose Demo Board also has three buttons,
+ * but these are connected differently:
+ *
+ * SW2-1 RF0 Pulled high, Grounded/low when depressed
+ * SW3-1 RF1 Pulled high, Grounded/low when depressed
+ * SW5-1 RD6 Pulled high, Grounded/low when depressed
+ *
+ * Internal pull-ups are not required since the LEDs are pull-up externally.
+ * Change notification interrupts are not *automatically* enabled. Change
+ * notification will be enabled when pic32mx_gpioattach() is called.
+ */
+
+#ifdef CONFIG_ARCH_DBDP11215
+# define GPIO_SW1 (GPIO_INPUT|GPIO_INT|GPIO_PORTB|GPIO_PIN3)
+# define GPIO_SW2 (GPIO_INPUT|GPIO_INT|GPIO_PORTB|GPIO_PIN2)
+# define GPIO_SW3 (GPIO_INPUT|GPIO_INT|GPIO_PORTB|GPIO_PIN4)
+#else /* CONFIG_ARCH_DBDP11212 */
+# define GPIO_SW1 (GPIO_INPUT|GPIO_INT|GPIO_PORTF|GPIO_PIN0)
+# define GPIO_SW2 (GPIO_INPUT|GPIO_INT|GPIO_PORTF|GPIO_PIN1)
+# define GPIO_SW3 (GPIO_INPUT|GPIO_INT|GPIO_PORTD|GPIO_PIN6)
+#endif
+
+/* Change notification numbers:
+ * RB3 -> CN5
+ * RB2 -> CN2
+ * RB4 -> CN6
+ */
+
+#define CN_SW1 5
+#define CN_SW2 2
+#define CN_SW3 6
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Pin configuration for each button */
+
+static const uint16_t g_buttonset[NUM_BUTTONS] =
+{
+ GPIO_SW1 GPIO_SW2, GPIO_SW3
+}
+
+/* Change notification number for each button */
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static const uint8_t g_buttoncn[NUM_BUTTONS] =
+{
+ CN_SW1, CN_SW2, CN_SW3
+}
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure input pins */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ pic32mx_configgpio(g_buttonset[i]);
+ }
+
+ /* Change AN2/AN3/AN4 to digital */
+
+ putreg32(0xffff, PIC32MX_ADC_CFG);
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int id;
+
+ /* Configure input pins */
+
+ for (id = 0; id < NUM_BUTTONS; id++)
+ {
+ if (pic32mx_gpioread(g_buttonset[id]))
+ {
+ ret |= (1 << id);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ * Interrupts are automatically enabled when the button handler is attached and
+ * automatically disabled when the button handler is detached.
+ *
+ * When an interrupt occurs, it is due to a change on the GPIO input pin
+ * associated with the button. In that case, all attached change
+ * notification handlers will be called. Each handler must maintain state
+ * and determine if the unlying GPIO button input value changed.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ if (id < NUM_BUTTONS)
+ {
+ oldhandler = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], irqhandler);
+ if (irqbuttron)
+ {
+ pic32mx_gpioirqenable(g_buttoncn[id]);
+ }
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/sure-pic32mx/src/up_leds.c b/nuttx/configs/sure-pic32mx/src/up_leds.c
new file mode 100644
index 000000000..49905bb4a
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_leds.c
@@ -0,0 +1,218 @@
+/****************************************************************************
+ * configs/sure-pic32mx/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "pic32mx-ioport.h"
+#include "sure-internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED Configuration ********************************************************/
+/* The Sure PIC32MX board has five LEDs. One (D4, lablel "Power") is not
+ * controllable by software. Four are controllable by software:
+ *
+ * D7 "USB" Yellow RD7 Low illuminates
+ * D8 "SD" Yellow RD6 Low illuminates
+ * D9 "Flash" Yellow RF0 Low illuminates
+ * D10 "Error" Red RF1 Low illuminates
+ *
+ * ON OFF
+ * USB SD FLASH ERROR USB SD FLASH ERROR
+ * LED_STARTED 0 OFF OFF OFF OFF --- --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C N/C --- --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C N/C --- --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C N/C --- --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C N/C OFF N/C
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C N/C OFF N/C
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C N/C OFF N/C
+ * LED_PANIC 5 N/C N/C N/C ON N/C N/C N/C OFF
+ */
+
+#define GPIO_USB_LED (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTD|GPIO_PIN7)
+#define GPIO_SD_LED (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTD|GPIO_PIN6)
+#define GPIO_FLASH_LED (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTF|GPIO_PIN0)
+#define GPIO_ERROR_LED (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTF|GPIO_PIN1)
+
+/* LED Management Definitions ***********************************************/
+
+#define LED_OFF 0
+#define LED_ON 1
+#define LED_NC 2
+
+/* Debug ********************************************************************/
+
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_LEDS)
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_LEDS
+# undef CONFIG_DEBUG_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private types
+ ****************************************************************************/
+
+struct led_setting_s
+{
+ uint8_t usb : 2;
+ uint8_t sd : 2;
+ uint8_t flash : 2;
+ uint8_t error : 2;
+};
+
+ /****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct led_setting_s g_ledonvalues[LED_NVALUES] =
+{
+ {LED_OFF, LED_OFF, LED_OFF, LED_OFF},
+ {LED_ON, LED_OFF, LED_NC, LED_NC},
+ {LED_OFF, LED_ON, LED_NC, LED_NC},
+ {LED_ON, LED_ON, LED_NC, LED_NC},
+ {LED_NC, LED_NC, LED_ON, LED_NC},
+ {LED_NC, LED_NC, LED_NC, LED_ON},
+};
+
+static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
+{
+ {LED_NC, LED_NC, LED_NC, LED_NC},
+ {LED_NC, LED_NC, LED_NC, LED_NC},
+ {LED_NC, LED_NC, LED_NC, LED_NC},
+ {LED_NC, LED_NC, LED_NC, LED_NC},
+ {LED_NC, LED_NC, LED_OFF, LED_NC},
+ {LED_NC, LED_NC, LED_NC, LED_OFF}
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+void up_setleds(FAR const struct led_setting_s *setting)
+{
+ if (setting->usb != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_USB_LED, setting->usb != LED_ON);
+ }
+
+ if (setting->sd != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_SD_LED, setting->sd != LED_ON);
+ }
+
+ if (setting->flash != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_FLASH_LED, setting->flash != LED_ON);
+ }
+
+ if (setting->error != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_ERROR_LED, setting->error != LED_ON);
+ }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pic32mx_ledinit
+ ****************************************************************************/
+
+void pic32mx_ledinit(void)
+{
+ /* Configure output pins */
+
+ pic32mx_configgpio(GPIO_USB_LED);
+ pic32mx_configgpio(GPIO_SD_LED);
+ pic32mx_configgpio(GPIO_FLASH_LED);
+ pic32mx_configgpio(GPIO_ERROR_LED);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ if (led < LED_NVALUES)
+ {
+ up_setleds(&g_ledonvalues[led]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ if (led < LED_NVALUES)
+ {
+ up_setleds(&g_ledoffvalues[led]);
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/sure-pic32mx/src/up_nsh.c b/nuttx/configs/sure-pic32mx/src/up_nsh.c
new file mode 100644
index 000000000..4b68350ed
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_nsh.c
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * config/sure-pic32mx/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+#include <nuttx/usb/usbhost.h>
+
+#include "pic32mx-internal.h"
+#include "sure-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_SUREPIC32MX
+# define NSH_HAVEMMCSD 1
+# define NSH_HAVEUSBHOST 1
+# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 2
+# error "The Sure PIC32MX MMC/SD is on SPI2"
+# undef CONFIG_NSH_MMCSDSPIPORTNO
+# define CONFIG_NSH_MMCSDSPIPORTNO 2
+# endif
+# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
+# error "The Sure PIC32MX MMC/SD has only one slot (0)"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+# ifndef CONFIG_PIC32MX_SPI2
+# warning "CONFIG_PIC32MX_SPI2 is not enabled"
+# undef NSH_HAVEMMCSD
+# endif
+#else
+# error "Unrecognized board"
+# undef NSH_HAVEMMCSD
+# undef NSH_HAVEUSBHOST
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* USB Host */
+
+#ifdef CONFIG_USBHOST
+# ifndef CONFIG_PIC32MX_USBHOST
+# error "CONFIG_PIC32MX_USBHOST is not selected"
+# endif
+#endif
+
+#ifdef CONFIG_PIC32MX_USBHOST
+# ifndef CONFIG_USBHOST
+# warning "CONFIG_USBHOST is not selected"
+# endif
+#endif
+
+#if !defined(CONFIG_USBHOST) || !defined(CONFIG_PIC32MX_USBHOST)
+# undef NSH_HAVEUSBHOST
+#endif
+
+#ifdef NSH_HAVEUSBHOST
+# ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 50
+# endif
+# ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 1024
+# endif
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static struct usbhost_driver_s *g_drvr;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_waiter(int argc, char *argv[])
+{
+ bool connected = false;
+ int ret;
+
+ message("nsh_waiter: Running\n");
+ for (;;)
+ {
+ /* Wait for the device to change state */
+
+ ret = DRVR_WAIT(g_drvr, connected);
+ DEBUGASSERT(ret == OK);
+
+ connected = !connected;
+ message("nsh_waiter: %s\n", connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)DRVR_ENUMERATE(g_drvr);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Name: nsh_sdinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int nsh_sdinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("nsh_archinitialize: Failed to initialize SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+ ret = -ENODEV;
+ goto errout;
+ }
+
+ message("Successfully initialized SPI port %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO);
+
+ /* The SPI should be in 8-bit (default) and mode2: CKP=1, CKE=0.
+ * The MMC/SD driver will control the SPI frequency. WARNING:
+ * this is not the right way to do this... this should be done
+ * the MMC/SD driver: Other device on SPI1 may need other mode
+ * settings.
+ */
+
+ SPI_SETMODE(spi, SPIDEV_MODE2);
+
+ /* Bind the SPI port to the slot */
+
+ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR,
+ CONFIG_NSH_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("nsh_sdinitialize: "
+ "Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO, ret);
+ goto errout;
+ }
+
+ message("Successfuly bound SPI port %d to MMC/SD slot %d\n",
+ CONFIG_NSH_MMCSDSPIPORTNO,
+ CONFIG_NSH_MMCSDSLOTNO);
+ return OK;
+
+errout:
+ return ret;
+}
+#else
+# define nsh_sdinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbhostinitialize
+ *
+ * Description:
+ * Initialize USB Host
+ *
+ ****************************************************************************/
+
+#ifdef NSH_HAVEUSBHOST
+static int nsh_usbhostinitialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ message("nsh_usbhostinitialize: Register class drivers\n");
+ ret = usbhost_storageinit();
+ if (ret != OK)
+ {
+ message("nsh_usbhostinitialize: Failed to register the mass storage class\n");
+ }
+
+ /* Then get an instance of the USB host interface */
+
+ message("nsh_usbhostinitialize: Initialize USB host\n");
+ g_drvr = usbhost_initialize(0);
+ if (g_drvr)
+ {
+ /* Start a thread to handle device connection. */
+
+ message("nsh_usbhostinitialize: Start nsh_waiter\n");
+
+#ifndef CONFIG_CUSTOM_STACK
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)nsh_waiter, (const char **)NULL);
+#else
+ pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ (main_t)nsh_waiter, (const char **)NULL);
+#endif
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+ return -ENODEV;
+}
+#else
+# define nsh_usbhostinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Name: nsh_usbdevinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBDEV
+static int nsh_usbdevinitialize(void)
+{
+ /* The Sure board has no way to know when the USB is connected. So we
+ * will fake it and tell the USB driver that the USB is connected now.
+ */
+
+ pic32mx_usbattach();
+ return OK;
+}
+#else
+# define nsh_usbdevinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ int ret;
+
+ /* Initialize SPI-based microSD */
+
+ ret = nsh_sdinitialize();
+ if (ret == OK)
+ {
+ /* Initialize USB host */
+
+ ret = nsh_usbhostinitialize();
+ }
+
+ if (ret == OK)
+ {
+ /* Initialize USB device */
+
+ ret = nsh_usbdevinitialize();
+ }
+ return ret;
+}
diff --git a/nuttx/configs/sure-pic32mx/src/up_spi.c b/nuttx/configs/sure-pic32mx/src/up_spi.c
new file mode 100644
index 000000000..02ffa4f48
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_spi.c
@@ -0,0 +1,272 @@
+/************************************************************************************
+ * configs/sure-pic32mx/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "pic32mx-internal.h"
+#include "sure-internal.h"
+
+#if defined(CONFIG_PIC32MX_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_DBDP11215
+
+/* The Sure DB_DP11215 PIC32 Storage Demo Board has an SD slot connected on SPI2:
+ *
+ * SCK2/PMA5/CN8/RG6 SCK SD connector SCK, FLASH (U1) SCK*
+ * SDI2/PMA4/CN9/RG7 SDI SD connector DO, FLASH (U1) SO*
+ * SDO2/PMA3/CN10/RG8 SDO SD connector DI, FLASH (U1) SI*
+ *
+ * Chip Select. Pulled up on-board
+ * TDO/AN11/PMA12/RB11 SD_CS SD connector CS
+ *
+ * Status inputs. All pulled up on-board
+ *
+ * TCK/AN12/PMA11/RB12 SD_CD SD connector CD
+ * TDI/AN13/PMA10/RB13 SD_WD SD connector WD
+ */
+
+# define PIC32_HAVE_SD 1
+
+# define GPIO_SD_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN11)
+# define GPIO_SD_CD (GPIO_INPUT|GPIO_INT|GPIO_PORTB|GPIO_PIN12)
+# define GPIO_SD_WD (GPIO_INPUT|GPIO_PORTB|GPIO_PIN13)
+
+/* The Sure DB_DP11215 PIC32 Storage Demo Board has pads an SOIC (Flash or
+ * EEPROM) connected on SPI2, however, U4 is not populated on my board.
+ *
+ *
+ * TMS/AN10/CVREFOUT/PMA13/RB10 UTIL_WP FLASH (U1) WP
+ * SS2/PMA2/CN11/RG9 UTIL_CS FLASH (U1) CS
+ */
+
+# undef PIC32_HAVE_SOIC
+
+# define GPIO_SOIC_WP (GPIO_INPUT|GPIO_PORTB|GPIO_PIN10)
+# define GPIO_SOIC_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTG|GPIO_PIN0)
+
+/* Change notification numbers -- Not available for SD_CD. */
+
+#endif
+
+#ifdef CONFIG_ARCH_DBDP11212
+
+/* The Sure DB-DP11212 PIC32 General Purpose Demo Board does not have an
+ * SD slot.
+ */
+
+# undef PIC32_HAVE_SD
+
+ /* The Sure DB-DP11212 PIC32 General Purpose Demo Board has an SOIC (Flash or
+ * EEPROM) connected on SPI2:
+ *
+ *
+ * TMS/AN10/PMA13/RB10 UTIL_WP FLASH (U4) WP
+ * TDO/AN11/PMA12/RB11 UTIL_CS FLASH (U4) CS
+ */
+
+# define PIC32_HAVE_SOIC 1
+
+# define GPIO_SOIC_WP (GPIO_INPUT|GPIO_PORTB|GPIO_PIN10)
+# define GPIO_SOIC_CS (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTB|GPIO_PIN11)
+#endif
+
+/* The following enable debug output from this file.
+ *
+ * CONFIG_DEBUG_SPI && CONFIG_DEBUG - Define to enable basic SPI debug
+ * CONFIG_DEBUG_VERBOSE - Define to enable verbose SPI debug
+ */
+
+#ifndef CONFIG_DEBUG
+# undef CONFIG_DEBUG_SPI
+# undef CONFIG_DEBUG_VERBOSE
+#endif
+
+#ifdef CONFIG_DEBUG_SPI
+# define spidbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Sure PIC32MX board.
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_spiinitialize(void)
+{
+ /* Configure the SPI2 chip select (CS) GPIO output, and the card detect (CD) and
+ * write protect (WP) inputs.
+ */
+
+#ifdef PIC32_HAVE_SD
+ pic32mx_configgpio(GPIO_SD_CS);
+ pic32mx_configgpio(GPIO_SD_CD);
+ pic32mx_configgpio(GPIO_SD_WD);
+#endif
+
+#ifdef PIC32_HAVE_SOIC
+ pic32mx_configgpio(GPIO_SOIC_WP);
+ pic32mx_configgpio(GPIO_SOIC_CS);
+#endif
+}
+
+/************************************************************************************
+ * Name: pic32mx_spi2select and pic32mx_spi2status
+ *
+ * Description:
+ * The external functions, pic32mx_spi2select and pic32mx_spi2status
+ * must be provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common PIC32MX logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in pic32mx_boardinitialize() to configure SPI/SPI chip select
+ * pins.
+ * 2. Provide pic32mx_spi2select() and pic32mx_spi2status() functions
+ * in your board-specific logic. These functions will perform chip selection
+ * and status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_PIC32MX_SPI2
+void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spivdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ /* The SD card chip select is pulled high and active low */
+
+#ifdef PIC32_HAVE_SD
+ if (devid == SPIDEV_MMCSD)
+ {
+ pic32mx_gpiowrite(GPIO_SD_CS, !selected);
+ }
+#endif
+
+#ifdef PIC32_HAVE_SOIC
+ if (devid == SPIDEV_FLASH)
+ {
+ pic32mx_gpiowrite(GPIO_SOIC_CS, !selected);
+ }
+#endif
+}
+
+uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ uint8_t ret = 0;
+
+ /* Card detect is pull up on-board. If a low value is sensed then the
+ * card must be present.
+ */
+
+#ifdef PIC32_HAVE_SD
+ if (devid == SPIDEV_MMCSD)
+ {
+ if (!pic32mx_gpioread(GPIO_SD_CD))
+ {
+ ret = SPI_STATUS_PRESENT;
+
+ /* It seems that a high value indicates the the card is write
+ * protected.
+ */
+
+ if (pic32mx_gpioread(GPIO_SD_WD))
+ {
+ ret |= SPI_STATUS_WRPROTECTED;
+ }
+ }
+ }
+#endif
+
+#ifdef PIC32_HAVE_SOIC
+ if (devid == SPIDEV_FLASH)
+ {
+ ret = SPI_STATUS_PRESENT;
+
+ /* Write protect is indicated with a low value. */
+
+ if (pic32mx_gpioread(GPIO_SOIC_WP))
+ {
+ ret |= SPI_STATUS_WRPROTECTED;
+ }
+ }
+#endif
+
+ spivdbg("Returning %d\n", ret);
+ return ret;
+}
+#endif
+#endif /* CONFIG_PIC32MX_SPI2 */
diff --git a/nuttx/configs/sure-pic32mx/src/up_usbdev.c b/nuttx/configs/sure-pic32mx/src/up_usbdev.c
new file mode 100644
index 000000000..bb175f664
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_usbdev.c
@@ -0,0 +1,175 @@
+/************************************************************************************
+ * configs/sure-pic32mx/src/up_usbdev.c
+ * arch/arm/src/board/up_usbdev.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * References:
+ * - Sample code and schematics provided with the Sure Electronics PIC32 board.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "sure-internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* The Sure DB_DP11215 PIC32 Storage Demo Board has a CP2102 PHY that is shared
+ * between the USB and the UART-to-USB logic. That PHY must be programmed during
+ * boot up for USB functionality (since the UART-to-USB is not populated).
+ *
+ * PIN NAME SIGNAL NOTES
+ * ---- ------------------------------- -------------- ------------------------------
+ * 11 AN5/C1IN+/Vbuson/CN7/RB5 Vbuson/AN5/RB5 To USB VBUS circuitry
+ * 43 U1CTS/SDA1/IC2/INT2/RD9 USB_OPTEN USB PHY
+ * 44 SCL1/IC3/PMCS2/PMA15/INT3/RD10 USB_OPT USB PHY
+ */
+
+#ifdef CONFIG_ARCH_DBDP11215
+# define GPIO_USB_VBUSON (GPIO_INPUT|GPIO_PORTB|GPIO_PIN5)
+# define GPIO_USB_OPTEN (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN9)
+# define GPIO_USB_OPT (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTD|GPIO_PIN10)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_usbdevinitialize
+ *
+ * Description:
+ * Called to configure the mini-B PHY on the Sure PIC32MX board for the USB device
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_usbdevinitialize(void)
+{
+ /* Connect the PHY to the USB mini-B port. Order and timing matter! */
+
+#ifdef CONFIG_ARCH_DBDP11215
+ pic32mx_configgpio(GPIO_USB_OPTEN);
+ pic32mx_configgpio(GPIO_USB_OPT);
+#endif
+
+ /* Notes from the Sure Electronics sample code:
+ *
+ * "The USB specifications require that USB peripheral devices must never source
+ * current onto the Vbus pin. Additionally, USB peripherals should not source
+ * current on D+ or D- when the host/hub is not actively powering the Vbus line.
+ * When designing a self powered (as opposed to bus powered) USB peripheral
+ * device, the firmware should make sure not to turn on the USB module and D+
+ * or D- pull up resistor unless Vbus is actively powered. Therefore, the
+ * firmware needs some means to detect when Vbus is being powered by the host.
+ * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and
+ * can be used to detect when Vbus is high (host actively powering), or low
+ * (host is shut down or otherwise not supplying power). The USB firmware
+ * can then periodically poll this I/O pin to know when it is okay to turn on
+ * the USB module/D+/D- pull up resistor. When designing a purely bus powered
+ * peripheral device, it is not possible to source current on D+ or D- when the
+ * host is not actively providing power on Vbus. Therefore, implementing this
+ * bus sense feature is optional. ..."
+ */
+
+#ifdef CONFIG_USBHOST
+ // pic32mx_configgpio(GPIO_USB_VBUSON);
+#endif
+
+ /* "If the host PC sends a GetStatus (device) request, the firmware must respond
+ * and let the host know if the USB peripheral device is currently bus powered
+ * or self powered. See chapter 9 in the official USB specifications for details
+ * regarding this request. If the peripheral device is capable of being both
+ * self and bus powered, it should not return a hard coded value for this request.
+ * Instead, firmware should check if it is currently self or bus powered, and
+ * respond accordingly. If the hardware has been configured like demonstrated
+ * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the
+ * currently selected power source. ..."
+ */
+
+#ifdef CONFIG_USB_PWRSENSE
+ // pic32mx_configgpio(GPIO_USB_PWRSENSE);
+#endif
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB
+ * software connect and disconnect), then the board software must provide
+ * stm32_pullup. See include/nuttx/usb/usbdev.h for additional description
+ * of this method. Alternatively, if no pull-up GPIO the following EXTERN
+ * can be redefined to be NULL.
+ *
+ ************************************************************************************/
+
+int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ /* The Sure PIC32MX does not have a USB pull-up */
+
+ return OK;
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver
+ * is used. This function is called whenever the USB enters or leaves
+ * suspend mode. This is an opportunity for the board logic to shutdown
+ * clocks, power, etc. while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ /* Do nothing */
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV */
diff --git a/nuttx/configs/sure-pic32mx/src/up_usbterm.c b/nuttx/configs/sure-pic32mx/src/up_usbterm.c
new file mode 100644
index 000000000..9ff333ce2
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/src/up_usbterm.c
@@ -0,0 +1,108 @@
+/************************************************************************************
+ * configs/sure-pic32mx/src/up_usbterm.c
+ * arch/arm/src/board/up_usbterm.c
+ *
+ * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * References:
+ * - Sample code and schematics provided with the Sure Electronics PIC32 board.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "sure-internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV) && defined(CONFIG_EXAMPLES_USBTERM_DEVINIT)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its initialization.
+ *
+ ****************************************************************************/
+
+int usbterm_devinit(void)
+{
+ /* The Sure board has no way to know when the USB is connected. So we
+ * will fake it and tell the USB driver that the USB is connected now.
+ *
+ * If examples/usbterm is built as an NSH built-in application, then
+ * pic32mx_usbattach() will be called in nsh_archinitialize().
+ */
+
+#ifndef CONFIG_EXAMPLES_USBTERM_BUILTIN
+ pic32mx_usbattach();
+#endif
+ return OK;
+}
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its termination sequence.
+ *
+ ****************************************************************************/
+
+void usbterm_devuninit(void)
+{
+ /* Tell the USB driver that the USB is no longer connected */
+
+ pic32mx_usbdetach();
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV && CONFIG_EXAMPLES_USBTERM_DEVINIT */
diff --git a/nuttx/configs/sure-pic32mx/usbnsh/Make.defs b/nuttx/configs/sure-pic32mx/usbnsh/Make.defs
new file mode 100644
index 000000000..f9968573a
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/usbnsh/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/sure-pic32mx/usbnsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbnsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbnsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/sure-pic32mx/usbnsh/appconfig b/nuttx/configs/sure-pic32mx/usbnsh/appconfig
new file mode 100644
index 000000000..1b76789b6
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/usbnsh/appconfig
@@ -0,0 +1,47 @@
+############################################################################
+# configs/sure-pic32mx/usbnsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+############################################################################
+# Path to example in apps/examples containing the user_start entry point
+############################################################################
+
+CONFIGURED_APPS += examples/nsh
+
+############################################################################
+# The NSH application library
+############################################################################
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
diff --git a/nuttx/configs/sure-pic32mx/usbnsh/defconfig b/nuttx/configs/sure-pic32mx/usbnsh/defconfig
new file mode 100644
index 000000000..e1873b4c7
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/usbnsh/defconfig
@@ -0,0 +1,529 @@
+############################################################################
+# configs/sure-pic32mx/usbnsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX440F512H=y
+CONFIG_ARCH_BOARD="sure-pic32mx"
+CONFIG_ARCH_BOARD_SUREPIC32MX=y
+CONFIG_ARCH_DBDP11215=y
+CONFIG_ARCH_DBDP11212=n
+CONFIG_BOARD_LOOPSPERMSEC=4275
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=n
+CONFIG_PIC32MX_UART2=y
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=y
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# PIC32MX-specific USB device setup
+#
+CONFIG_PIC32MX_USBDEV_REGDEBUG=n
+CONFIG_PIC32MX_USBDEV_BDTDEBUG=n
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_USB=n
+
+CONFIG_HAVE_CXX=n
+CONFIG_HAVE_CXXINITIALIZE=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=3
+CONFIG_START_DAY=6
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=y
+CONFIG_CDCACM_CONSOLE=y
+#CONFIG_CDCACM_EP0MAXPACKET
+#CONFIG_CDCACM_EPINTIN
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+#CONFIG_CDCACM_EPBULKOUT
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+#CONFIG_CDCACM_EPBULKIN
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=2
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbterm
+#
+CONFIG_EXAMPLES_USBTERM_BUILTIN=y
+CONFIG_EXAMPLES_USBTERM_DEVINIT=y
+#CONFIG_EXAMPLES_USBTERM_BUFLEN
+CONFIG_EXAMPLES_USBTERM_TRACEINIT=n
+CONFIG_EXAMPLES_USBTERM_TRACECLASS=n
+CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/sure-pic32mx/usbnsh/ld.script b/nuttx/configs/sure-pic32mx/usbnsh/ld.script
new file mode 100644
index 000000000..5bdc5af6f
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/usbnsh/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/sure-pic32mx/usbnsh/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX440F512H has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX440F512H has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX440F512H has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/sure-pic32mx/usbnsh/setenv.sh b/nuttx/configs/sure-pic32mx/usbnsh/setenv.sh
new file mode 100755
index 000000000..263dfc596
--- /dev/null
+++ b/nuttx/configs/sure-pic32mx/usbnsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/sure-pic32mx/usbnsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/teensy/Kconfig b/nuttx/configs/teensy/Kconfig
new file mode 100644
index 000000000..5b751c285
--- /dev/null
+++ b/nuttx/configs/teensy/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_TEENSY
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/teensy/README.txt b/nuttx/configs/teensy/README.txt
new file mode 100644
index 000000000..979d8e0e7
--- /dev/null
+++ b/nuttx/configs/teensy/README.txt
@@ -0,0 +1,544 @@
+README
+^^^^^
+
+This is the README file for the port of NuttX to the PJRC Teensy++ 2.0 board.
+This board is developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
+on an Atmel AT90USB1286 MCU.
+
+Contents
+^^^^^^^^
+
+ o Teensy++ 2.0 Features
+ o Pin Usage
+ o Halfkey Bootloader
+ o Serial Console
+ o SD Connection
+ o Toolchains
+ o Windows Native Toolchains
+ o NuttX buildroot Toolchain
+ o avr-libc
+ o Teensy++ Configuration Options
+ o Configurations
+
+Teensy++ 2.0 Features
+^^^^^^^^^^^^^^^^^^^^^
+
+ o Based on the 64-pin USB AVR Microcontroller AT90USB1286.
+ o USB Full Speed (12Mbit/s)
+ o USB Device Mode
+ o 120kbof available FLASH memory for programs.
+ o 8 kbytes SRAM and 4 kbytes of EEPROM
+ o USB powered
+ o 16MHz crystal
+ o 48 General Purpose IO Pins
+
+Pin Usage
+^^^^^^^^^
+
+ AT90USB1286 TQFP64
+ -- ------------------------ ---------------------------------------------
+ PIN SIGNAL BOARD CONNECTION
+ -- ------------------------ ---------------------------------------------
+ (left)
+ 1 (INT.6/AIN.0) PE6 Pad E6
+ 2 (INT.7/AIN.1/UVcon) PE7 Pad E7
+ 3 UVcc (Voltage circutry)
+ 4 D- USB DP
+ 5 D+ USB DM
+ 6 UGnd GND
+ 7 UCap GND (via cap)
+ 8 VBus USB VBUS
+ 9 (IUID) PE3 N/C
+ 10 (SS/PCINT0) PB0 Pad B0
+ 11 (PCINT1/SCLK) PB1 Pad B1
+ 12 (PDI/PCINT2/MOSI) PB2 Pad B2
+ 13 (PDO/PCINT3/MISO) PB3 Pad B3
+ 14 (PCINT4/OC.2A) PB4 Pad B4
+ 15 (PCINT5/OC.1A) PB5 Pad B5
+ 16 (PCINT6/OC.1B) PB6 Pad B6
+ (bottom)
+ 17 (PCINT7/OC.0A/OC.1C) PB7 Pad B7
+ 18 (INT4/TOSC1) PE4 Pad E4
+ 19 (INT.5/TOSC2) PE5 Pad E5
+ 20 RESET Switch pulls to ground
+ 21 VCC VCC
+ 22 GND GND
+ 23 XTAL2 XTAL (16MHz)
+ 24 XTAL1 XTAL (16MHz)
+ 25 (OC0B/SCL/INT0) PD0 Pad D0
+ 26 (OC2B/SDA/INT1) PD1 Pad D1
+ 27 (RXD1/INT2) PD2 Pad D2
+ 28 (TXD1/INT3) PD3 Pad D3
+ 29 (ICP1) PD4 Pad D4
+ 30 (XCK1) PD5 Pad D5
+ 31 (T1) PD6 Pad D6, LED
+ 32 (T0) PD7 Pad D7
+ (right)
+ 48 PA3 (AD3) Pad A3
+ 47 PA4 (AD4) Pad A4
+ 46 PA5 (AD5) Pad A5
+ 45 PA6 (AD6) Pad A6
+ 44 PA7 (AD7) Pad A7
+ 43 PE2 (ALE/HWB) Pad ALE (Pulled down)
+ 42 PC7 (A15/IC.3/CLKO) Pad C7
+ 41 PC6 (A14/OC.3A) Pad C6
+ 40 PC5 (A13/OC.3B) Pad C5
+ 39 PC4 (A12/OC.3C) Pad C4
+ 38 PC3 (A11/T.3) Pad C3
+ 37 PC2 (A10) Pad C2
+ 36 PC1 (A9) Pad C1
+ 35 PC0 (A8) Pad C0
+ 34 PE1 (RD) Pad E1
+ 33 PE0 (WR) Pad E0
+ (top)
+ 64 AVCC VCC
+ 63 GND GND
+ 62 AREF Pad Ref (Capacitor to ground)
+ 61 PF0 (ADC0) Pad F0
+ 60 PF1 (ADC1) Pad F1
+ 59 PF2 (ADC2) Pad F2
+ 58 PF3 (ADC3) Pad F3
+ 57 PF4 (ADC4/TCK) Pad F4
+ 56 PF5 (ADC5/TMS) Pad F5
+ 55 PF6 (ADC6/TDO) Pad F6
+ 54 PF7 (ADC7/TDI) Pad F7
+ 53 GND GND
+ 52 VCC VCC
+ 51 PA0 (AD0) Pad A0
+ 50 PA1 (AD1) Pad A1
+ 49 PA2 (AD2) Pad A2
+
+Halfkey Bootloader
+^^^^^^^^^^^^^^^^^^
+
+o Download the Teensy application from http://pjrc.com/teensy/loader.html
+o Instructions are available for your OS at that places as well.
+
+Summary:
+
+1. Start Teensy
+2. Press button on the Teensy board
+3. Select a HEX file (File menu)
+4. Select "program" (Operations menu)
+5. Reboot (Operations menu).
+
+Serial Console
+^^^^^^^^^^^^^^
+
+ A serial console is supported on an external MAX232/MAX3232 Connected
+ on PD2 and PD3:
+
+ Port D, Bit 2: RXD1, Receive Data (Data input pin for the USART1). When
+ the USART1 receiver is enabled this pin is configured as an input
+ regardless of the value of DDD2. When the USART forces this pin to
+ be an input, the pull-up can still be controlled by the PORTD2 bit.
+ Port D, Bit 3: TXD1, Transmit Data (Data output pin for the USART1).
+ When the USART1 Transmitter is enabled, this pin is configured as
+ an output regardless of the value of DDD3.
+
+ AT90USB90128/64 TQFP64
+ -- ------------------------ ---------------------------------------------
+ PIN SIGNAL BOARD CONNECTION
+ -- ------------------------ ---------------------------------------------
+ 27 (RXD1/INT2) PD2 Pad D2
+ 28 (TXD1/INT3) PD3 Pad D3
+
+ Plus power and ground. There are numerous ground points and both USB 5V
+ and Vcc are available.
+
+SD Connection
+^^^^^^^^^^^^^
+
+I have the SD-ADP SD/MMC Card Adaptor from www.gravitech.com
+(http://www.gravitech.us/sdcaad.html). Features:
+
+ o On-board 3.3V regulator
+ o Connect directly to 3.3V or 5.0V microcontroller
+ o Card detect LED
+ o Includes 11-pin male header
+ o Board dimension: 2.0”x1.3”
+
+SD-ADP Pinout / SD Connection
+
+ -- ---- ----------- -------------------------------------------------------
+ J2 NAME SD CARD DESCRIPTION
+ -- ---- ----------- -------------------------------------------------------
+ 1 VIN (reguator) Input power to the SD card (3.3V to 6.0V)
+ 2 GND 3,6,12,13 Common (Connects to the housing of the SD socket)
+ 3 3V3 4 3.3V Output voltage from the on-board 3.3V regulator (250mA)
+ 4 NC 9 NC Connect to pin 9 on the SD card (not used in SPI mode)
+ 5 CS 1 DAT3/CS Chip select *
+ 6 DI 2 CMD/DI Serial input data *
+ 7 SCK 5 SCK Serial clock *
+ 8 DO 7 DAT0/DO Serial output data
+ 9 IRQ 8 DAT1/IRQ Interrupt request, connect to pin 8 on the SD card (not used in SPI mode)
+ 10 CD 10 CD Card detect (active low)
+ 11 WP 11 WP Write protect
+ -- ---- ----------- -------------------------------------------------------
+
+ * Via a 74LCX245 level translator / buff
+
+Teensy SPI Connection
+
+ -- ---- -- ------------------------- -------
+ J2 NAME PIN NAME PAD
+ -- ---- -- ------------------------- -------
+ 1 VIN -- Connected to USB +5V
+ 2 GND -- Connected to USB GND
+ 3 3V3 -- Not used ---
+ 4 NC -- Not used
+ 5 CS 10 (SS/PCINT0) PB0 Pad B0
+ 6 DI 12 (PDI/PCINT2/MOSI) PB2 Pad B2
+ 7 SCK 11 (PCINT1/SCLK) PB1 Pad B1
+ 8 DO 13 (PDO/PCINT3/MISO) PB3 Pad B3
+ 9 IRQ -- Not used ---
+ 10 CD 14 (PCINT4/OC.2A) PB4 Pad B4
+ 11 WP 15 (PCINT5/OC.1A) PB5 Pad B5
+ -- ---- -- ------------------------- -------
+
+Toolchains
+^^^^^^^^^^
+
+There are several toolchain options. However, testing has been performed
+using *only* the NuttX buildroot toolchain described below. Therefore,
+the NuttX buildroot toolchain is the recommended choice:
+
+Buildroot:
+
+ There is a DIY buildroot version for the AVR boards here:
+ http://sourceforge.net/projects/nuttx/files/buildroot/. See the
+ following section for details on building this toolchain.
+
+ It is assumed in some places that buildroot toolchain is available
+ at ../misc/buildroot/build_avr. Edit the setenv.sh file if
+ this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT=y is set in your
+ .config file.
+
+WinAVR:
+
+ For Cygwin development environment on Windows machines, you can use
+ WinAVR: http://sourceforge.net/projects/winavr/files/
+
+ It is assumed in some places that WinAVR is installed at C:/WinAVR. Edit the
+ setenv.sh file if this is not the case.
+
+ After configuring NuttX, make sure that CONFIG_AVR_WINAVR=y is set in your
+ .config file.
+
+ WARNING: There is an incompatible version of cygwin.dll in the WinAVR/bin
+ directory! Make sure that the path to the correct cygwin.dll file precedes
+ the path to the WinAVR binaries!
+
+Linux:
+
+ For Linux, there are widely available avr-gcc packages. On Ubuntu, use:
+ sudo apt-get install gcc-avr gdb-avr avr-libc
+
+ After configuring NuttX, make sure that CONFIG_AVR_LINUXGCC=y is set in your
+ .config file.
+
+Windows Native Toolchains
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ The WinAVR toolchain is a Windows native toolchain. There are several
+ limitations to using a Windows native toolchain in a Cygwin environment.
+ The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath'
+ utility but you might easily find some new path problems. If so, check
+ out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic
+ links are used in Nuttx (e.g., include/arch). The make system works
+ around these problems for the Windows tools by copying directories
+ instead of linking them. But this can also cause some confusion for
+ you: For example, you may edit a file in a "linked" directory and find
+ that your changes had no effect. That is because you are building the
+ copy of the file in the "fake" symbolic directory. If you use a
+ Windows toolchain, you should get in the habit of making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This
+ is because the dependencies are generated using Windows pathes which do
+ not work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native
+ toolchains. That support can be enabled by modifying your Make.defs
+ file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are
+ not building on C:), then you may need to modify tools/mkdeps.sh
+
+ An additional issue with the WinAVR toolchain, in particular, is that it
+ contains an incompatible version of the Cygwin DLL in its bin/ directory.
+ You must take care that the correct Cygwin DLL is used.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ If NuttX buildroot toolchain source tarball cne can be downloaded from the
+ NuttX SourceForge download site (https://sourceforge.net/projects/nuttx/files/).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh Teensy++/<sub-dir>
+
+ NOTE: you also must copy avr-libc header files into the NuttX include
+ directory with command perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/avr-defconfig-4.5.2 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you
+ are building a toolchain for Cygwin under Windows.
+
+avr-libc
+^^^^^^^^
+
+Header Files
+
+ In any case, header files from avr-libc are required: http://www.nongnu.org/avr-libc/.
+ A snapshot of avr-lib is included in the WinAVR installation. For Linux
+ development platforms, avr-libc package is readily available (and would
+ be installed in the apt-get command shown above). But if you are using
+ the NuttX buildroot configuration on Cygwin, then you will have to build
+ get avr-libc from binaries.
+
+Header File Installation
+
+ The NuttX build will required that the AVR header files be available via
+ the NuttX include directory. This can be accomplished by either copying
+ the avr-libc header files into the NuttX include directory:
+
+ cp -a <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+ Or simply using a symbolic link:
+
+ ln -s <avr-libc-path>/include/avr <nuttx-path>/include/.
+
+Build Notes:
+
+ It may not necessary to have a built version of avr-lib; only header files
+ are required. Bu if you choose to use the optimized libraru functions of
+ the flowing point library, then you may have to build avr-lib from sources.
+ Below are instructions for building avr-lib from fresh sources:
+
+ 1. Download the avr-libc package from:
+
+ http://savannah.nongnu.org/projects/avr-libc/
+
+ I am using avr-lib-1.7.1.tar.bz2
+
+ 2. Upack the tarball and cd into the
+
+ tar jxf avr-lib-1.7.1.tar.bz2
+ cd avr-lib-1.7.1
+
+ 3. Configure avr-lib. Assuming that WinAVR is installed at the following
+ location:
+
+ export PATH=/cygdrive/c/WinAVR/bin:$PATH
+ ./configure --build=`./config.guess` --host=avr
+
+ This takes a *long* time.
+
+ 4. Make avr-lib.
+
+ make
+
+ This also takes a long time because it generates variants for nearly
+ all AVR chips.
+
+ 5. Install avr-lib.
+
+ make install
+
+Teensy++ Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=avr
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_AVR=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_AT90USB=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=at90usb
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip.
+
+ CONFIG_ARCH_CHIP_AT90USB1286=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=teensy
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_TEENSY=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM. One of:
+
+ CONFIG_DRAM_SIZE=(8*1024) - (8Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x800100
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_AVR_INT0=n
+ CONFIG_AVR_INT1=n
+ CONFIG_AVR_INT2=n
+ CONFIG_AVR_INT3=n
+ CONFIG_AVR_INT4=n
+ CONFIG_AVR_INT5=n
+ CONFIG_AVR_INT6=n
+ CONFIG_AVR_INT7=n
+ CONFIG_AVR_USBHOST=n
+ CONFIG_AVR_USBDEV=n
+ CONFIG_AVR_WDT=n
+ CONFIG_AVR_TIMER0=n
+ CONFIG_AVR_TIMER1=n
+ CONFIG_AVR_TIMER2=n
+ CONFIG_AVR_TIMER3=n
+ CONFIG_AVR_SPI=n
+ CONFIG_AVR_USART1=y
+ CONFIG_AVR_ANACOMP=n
+ CONFIG_AVR_ADC=n
+ CONFIG_AVR_TWI=n
+
+ If the watchdog is enabled, this specifies the initial timeout. Default
+ is maximum supported value.
+
+ CONFIG_WDTO_15MS
+ CONFIG_WDTO_30MS
+ CONFIG_WDTO_60MS
+ CONFIG_WDTO_120MS
+ CONFIG_WDTO_1250MS
+ CONFIG_WDTO_500MS
+ CONFIG_WDTO_1S
+ CONFIG_WDTO_2S
+ CONFIG_WDTO_4S
+ CONFIG_WDTO_8S
+
+ AT90USB specific device driver settings
+
+ CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
+ console and ttys0 (default is no serial console).
+ CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
+ CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_USARTn_2STOP - Two stop bits
+
+ AT90USB specific USB device configuration
+
+ CONFIG_USB_DISABLE_PADREGULATOR
+ CONFIG_USB_LOWSPEED
+ CONFIG_USB_NOISYVBUS
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each Teensy++ configuration is maintained in a sudirectory and can
+be selected as follow:
+
+ cd tools
+ ./configure.sh teensy/<subdir>
+ cd -
+ . ./setenv.sh
+
+NOTE: You must also copy avr-libc header files, perhaps like:
+
+ cp -a /cygdrive/c/WinAVR/include/avr include/.
+
+Where <subdir> is one of the following:
+
+ hello:
+ The simple apps/examples/hello "Hello, World!" example.
+
+ ostest:
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest. NOTE: The OS test is quite large. In order
+ to get it to fit within AVR memory constraints, it will probably be
+ necessary to disable some OS features.
+
+ usbstorage:
+ This configuration directory exercises the USB mass storage
+ class driver at apps/examples/usbstorage. See apps/examples/README.txt
+ for more information. NOTE: THIS CONFIGURATION HAS NOT YET BEEN
+ DEBUGGED AND DOES NOT WORK!!! ISSUES: (1) THE SPI DRIVER IS UNTESTED,
+ (2) THE USB DRIVER IS UNTESTED, AND (3) THE RAM USAGE MIGHT BE EXCESSIVE.
+
+ Update 7/11: (1) The SPI/SD driver has been verified, however, (2) I
+ believe that the current teensy/usbstorage configuration uses too
+ much SRAM for the system to behave sanely. A lower memory footprint
+ version of the mass storage driver will be required before this can
+ be debugged
diff --git a/nuttx/configs/teensy/hello/Make.defs b/nuttx/configs/teensy/hello/Make.defs
new file mode 100644
index 000000000..da2a9e212
--- /dev/null
+++ b/nuttx/configs/teensy/hello/Make.defs
@@ -0,0 +1,150 @@
+############################################################################
+# configs/teensy/hello/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR_WINAVR),y)
+ # WinAVR toolchain under Windows/Cygwin
+ CROSSDEV = avr-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_LINUXGCC),y)
+ # GCC toolchain under Linux
+ CROSSDEV = avr-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_BUILDROOT),y)
+ # NuttX buildroot GCC toolchain under Linux or Cygwin
+ CROSSDEV = avr-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/teensy/hello/appconfig b/nuttx/configs/teensy/hello/appconfig
new file mode 100644
index 000000000..c3440d827
--- /dev/null
+++ b/nuttx/configs/teensy/hello/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/teensy/hello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/hello
+
diff --git a/nuttx/configs/teensy/hello/defconfig b/nuttx/configs/teensy/hello/defconfig
new file mode 100644
index 000000000..29c7194e3
--- /dev/null
+++ b/nuttx/configs/teensy/hello/defconfig
@@ -0,0 +1,411 @@
+############################################################################
+# configs/teensy/hello/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_AT90USB=y
+CONFIG_ARCH_CHIP="at90usb"
+CONFIG_ARCH_CHIP_AT90USB1286=y
+CONFIG_ARCH_BOARD="teensy"
+CONFIG_ARCH_BOARD_TEENSY=y
+CONFIG_BOARD_LOOPSPERMSEC=864
+CONFIG_DRAM_SIZE=8192
+CONFIG_DRAM_START=0x800100
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_AVR_WINAVR=n
+CONFIG_AVR_LINUXGCC=n
+CONFIG_AVR_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_AVR_INT0=n
+CONFIG_AVR_INT1=n
+CONFIG_AVR_INT2=n
+CONFIG_AVR_INT3=n
+CONFIG_AVR_INT4=n
+CONFIG_AVR_INT5=n
+CONFIG_AVR_INT6=n
+CONFIG_AVR_INT7=n
+CONFIG_AVR_USBHOST=n
+CONFIG_AVR_USBDEV=n
+CONFIG_AVR_WDT=n
+CONFIG_AVR_TIMER0=n
+CONFIG_AVR_TIMER1=n
+CONFIG_AVR_TIMER2=n
+CONFIG_AVR_TIMER3=n
+CONFIG_AVR_SPI=n
+CONFIG_AVR_USART1=y
+CONFIG_AVR_ANACOMP=n
+CONFIG_AVR_ADC=n
+CONFIG_AVR_TWI=n
+
+#
+# AT90USB specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART1_BAUD=38400
+CONFIG_USART1_BITS=8
+CONFIG_USART1_PARITY=0
+CONFIG_USART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="hello_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=16
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=4
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=4
+CONFIG_NFILE_STREAMS=4
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=1024
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/teensy/hello/ld.script b/nuttx/configs/teensy/hello/ld.script
new file mode 100644
index 000000000..2115c848f
--- /dev/null
+++ b/nuttx/configs/teensy/hello/ld.script
@@ -0,0 +1,210 @@
+/************************************************************************************
+ * configs/teensy/hello/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/* Memory Regions *******************************************************************/
+/* ------------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * ------------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * AT90USB1286 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 8Kb | 0x0000 4Kb
+ * ------------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 8K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/teensy/hello/setenv.sh b/nuttx/configs/teensy/hello/setenv.sh
new file mode 100755
index 000000000..d0100778a
--- /dev/null
+++ b/nuttx/configs/teensy/hello/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/teensy/hello/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/teensy/include/board.h b/nuttx/configs/teensy/include/board.h
new file mode 100644
index 000000000..4fe691118
--- /dev/null
+++ b/nuttx/configs/teensy/include/board.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+ * configs/teensy/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_TEENSY_INCLUDE_BOARD_H
+#define __CONFIGS_TEENSY_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */
+
+#define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */
+#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */
+
+/* LED definitions **********************************************************/
+/* The Teensy++ 2.0 has a single on-board LEDs connected to PortD, Pin 6 */
+ /* ON OFF */
+#define LED_STARTED 0 /* OFF ON (never happens) */
+#define LED_HEAPALLOCATE 0 /* OFF ON (never happens) */
+#define LED_IRQSENABLED 0 /* OFF ON (never happens) */
+#define LED_STACKCREATED 1 /* ON ON (never happens) */
+#define LED_INIRQ 2 /* OFF NC (momentary) */
+#define LED_SIGNAL 2 /* OFF NC (momentary) */
+#define LED_ASSERTION 2 /* OFF NC (momentary) */
+#define LED_PANIC 0 /* OFF ON (1Hz flashing) */
+
+/* Button definitions *******************************************************/
+/* SW1 = Connects to AT90USBxx RESET pin and is not available to software */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_TEENSY_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/teensy/nsh/Make.defs b/nuttx/configs/teensy/nsh/Make.defs
new file mode 100644
index 000000000..92458c12e
--- /dev/null
+++ b/nuttx/configs/teensy/nsh/Make.defs
@@ -0,0 +1,150 @@
+############################################################################
+# configs/teensy/nsh/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR_WINAVR),y)
+ # WinAVR toolchain under Windows/Cygwin
+ CROSSDEV = avr-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_LINUXGCC),y)
+ # GCC toolchain under Linux
+ CROSSDEV = avr-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_BUILDROOT),y)
+ # NuttX buildroot GCC toolchain under Linux or Cygwin
+ CROSSDEV = avr-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/teensy/nsh/appconfig b/nuttx/configs/teensy/nsh/appconfig
new file mode 100644
index 000000000..14b6bd960
--- /dev/null
+++ b/nuttx/configs/teensy/nsh/appconfig
@@ -0,0 +1,55 @@
+############################################################################
+# configs/teensy/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Networking support
+
+ifeq ($(CONFIG_NET),y)
+CONFIGURED_APPS += netutils/uiplib
+CONFIGURED_APPS += netutils/dhcpc
+CONFIGURED_APPS += netutils/resolv
+CONFIGURED_APPS += netutils/tftpc
+CONFIGURED_APPS += netutils/webclient
+endif
+
+
diff --git a/nuttx/configs/teensy/nsh/defconfig b/nuttx/configs/teensy/nsh/defconfig
new file mode 100755
index 000000000..4f13b9351
--- /dev/null
+++ b/nuttx/configs/teensy/nsh/defconfig
@@ -0,0 +1,410 @@
+############################################################################
+# configs/teensy/nsh/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_AT90USB=y
+CONFIG_ARCH_CHIP="at90usb"
+CONFIG_ARCH_CHIP_AT90USB1286=y
+CONFIG_ARCH_BOARD="teensy"
+CONFIG_ARCH_BOARD_TEENSY=y
+CONFIG_BOARD_LOOPSPERMSEC=864
+CONFIG_DRAM_SIZE=8192
+CONFIG_DRAM_START=0x800100
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_AVR_WINAVR=n
+CONFIG_AVR_LINUXGCC=n
+CONFIG_AVR_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_AVR_INT0=n
+CONFIG_AVR_INT1=n
+CONFIG_AVR_INT2=n
+CONFIG_AVR_INT3=n
+CONFIG_AVR_INT4=n
+CONFIG_AVR_INT5=n
+CONFIG_AVR_INT6=n
+CONFIG_AVR_INT7=n
+CONFIG_AVR_USBHOST=n
+CONFIG_AVR_USBDEV=n
+CONFIG_AVR_WDT=n
+CONFIG_AVR_TIMER0=n
+CONFIG_AVR_TIMER1=n
+CONFIG_AVR_TIMER2=n
+CONFIG_AVR_TIMER3=n
+CONFIG_AVR_SPI=n
+CONFIG_AVR_USART1=y
+CONFIG_AVR_ANACOMP=n
+CONFIG_AVR_ADC=n
+CONFIG_AVR_TWI=n
+
+#
+# AT90USB specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART1_BAUD=38400
+CONFIG_USART1_BITS=8
+CONFIG_USART1_PARITY=0
+CONFIG_USART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2010
+CONFIG_START_MONTH=6
+CONFIG_START_DAY=17
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=2
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=n
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=512
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=y
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=512
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/teensy/nsh/ld.script b/nuttx/configs/teensy/nsh/ld.script
new file mode 100755
index 000000000..eaeccd9ef
--- /dev/null
+++ b/nuttx/configs/teensy/nsh/ld.script
@@ -0,0 +1,210 @@
+/**************************************************************************************
+ * configs/teensy/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/* Memory Regions *********************************************************************/
+/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * AT90USB1286 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 8Kb | 0x0000 4Kb
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 8K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/teensy/nsh/setenv.sh b/nuttx/configs/teensy/nsh/setenv.sh
new file mode 100755
index 000000000..f0c035bba
--- /dev/null
+++ b/nuttx/configs/teensy/nsh/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/teensy/nsh/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/teensy/src/Makefile b/nuttx/configs/teensy/src/Makefile
new file mode 100644
index 000000000..6b68e63bb
--- /dev/null
+++ b/nuttx/configs/teensy/src/Makefile
@@ -0,0 +1,103 @@
+############################################################################
+# configs/teensy/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ASRCS =
+CSRCS = up_boot.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+ifeq ($(CONFIG_AVR_SPI),y)
+CSRCS += up_spi.c
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(CONFIG_ARCH_AVR32),y)
+ARCH_SUBDIR = avr32
+endif
+ifeq ($(CONFIG_ARCH_AVR),y)
+ARCH_SUBDIR = avr
+endif
+
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(TOPDIR)/sched}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
+else
+ CFLAGS += -I "$(TOPDIR)/sched"
+ CFLAGS += -I "$(ARCH_SRCDIR)/chip"
+ CFLAGS += -I "$(ARCH_SRCDIR)/common"
+ CFLAGS += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/teensy/src/teensy_internal.h b/nuttx/configs/teensy/src/teensy_internal.h
new file mode 100644
index 000000000..f253b590f
--- /dev/null
+++ b/nuttx/configs/teensy/src/teensy_internal.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/teensy/src/pcblogic-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_TEENSY_SRC_TEENSY_INTERNAL_H
+#define __CONFIGS_TEENSY_SRC_TEENSY_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: at90usb_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Teensy++ 2.0 board.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_AVR_SPI
+EXTERN void weak_function at90usb_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: at90usb_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void at90usb_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_TEENSY_SRC_TEENSY_INTERNAL_H */
diff --git a/nuttx/configs/teensy/src/up_boot.c b/nuttx/configs/teensy/src/up_boot.c
new file mode 100644
index 000000000..7c8811272
--- /dev/null
+++ b/nuttx/configs/teensy/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/teensy/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "at90usb_internal.h"
+#include "teensy_internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_boardinitialize
+ *
+ * Description:
+ * All AT90USB architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void up_boardinitialize(void)
+{
+ /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
+ * function at90usb_spiinitialize() has been brought into the link.
+ */
+
+#ifdef CONFIG_AVR_SPI
+ if (at90usb_spiinitialize)
+ {
+ at90usb_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ at90usb_ledinit();
+#endif
+}
diff --git a/nuttx/configs/teensy/src/up_leds.c b/nuttx/configs/teensy/src/up_leds.c
new file mode 100644
index 000000000..ce83b4999
--- /dev/null
+++ b/nuttx/configs/teensy/src/up_leds.c
@@ -0,0 +1,194 @@
+/****************************************************************************
+ * configs/teensy/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+#include <avr/io.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "at90usb_internal.h"
+#include "teensy_internal.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+#undef LED_VERBOSE /* Define to enable verbose debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# ifdef LED_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef LED_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static bool g_ncoff;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: at90usb_ledinit
+ ****************************************************************************/
+
+void at90usb_ledinit(void)
+{
+ /* The Teensy's single LED is on Port D, Pin 6. Configur this pin as an
+ * output and turn it OFF. The "other" side of the LED is onnected to
+ * ground through a resistor. Therefore, a logic value of 0 should turn
+ * the LED off.
+ */
+
+ DDRD |= (1 << 6);
+ PORTD &= ~(1 << 6);
+ g_ncoff = true;
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ /* ON OFF
+ * LED_STARTED 0 OFF ON (never happens)
+ * LED_HEAPALLOCATE 0 OFF ON (never happens)
+ * LED_IRQSENABLED 0 OFF ON (never happens)
+ * LED_STACKCREATED 1 ON ON (never happens)
+ * LED_INIRQ 2 OFF NC (momentary)
+ * LED_SIGNAL 2 OFF NC (momentary)
+ * LED_ASSERTION 2 OFF NC (momentary)
+ * LED_PANIC 0 OFF ON (1Hz flashing)
+ */
+
+ switch (led)
+ {
+ case 0:
+ /* The steady state is OFF */
+
+ g_ncoff = true;
+
+ case 2:
+ /* Turn the LED off */
+
+ PORTD &= ~(1 << 6);
+ break;
+
+ case 1:
+ /* The steady state is ON */
+
+ PORTD |= (1 << 6);
+ g_ncoff = false;
+ break;
+
+ default:
+ return;
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ /* ON OFF
+ * LED_STARTED 0 OFF ON (never happens)
+ * LED_HEAPALLOCATE 0 OFF ON (never happens)
+ * LED_IRQSENABLED 0 OFF ON (never happens)
+ * LED_STACKCREATED 1 ON ON (never happens)
+ * LED_INIRQ 2 OFF NC (momentary)
+ * LED_SIGNAL 2 OFF NC (momentary)
+ * LED_ASSERTION 2 OFF NC (momentary)
+ * LED_PANIC 0 OFF ON (1Hz flashing)
+ */
+
+ switch (led)
+ {
+ case 2:
+ /* If the "no-change" state is OFF, then turn the LED off */
+
+ if (g_ncoff)
+ {
+ PORTD &= ~(1 << 6);
+ break;
+ }
+
+ /* Otherwise, fall through to turn the LED ON */
+
+ case 0:
+ case 1:
+ /* Turn the LED on */
+
+ PORTD |= (1 << 6);
+ break;
+
+ default:
+ return;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/teensy/src/up_spi.c b/nuttx/configs/teensy/src/up_spi.c
new file mode 100644
index 000000000..a4eed9836
--- /dev/null
+++ b/nuttx/configs/teensy/src/up_spi.c
@@ -0,0 +1,202 @@
+/************************************************************************************
+ * configs/teensy/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+#include <avr/io.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "at90usb_internal.h"
+#include "teensy_internal.h"
+
+#ifdef CONFIG_AVR_SPI
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+/* Teensy SPI Connection
+ *
+ * -- ---- -- ------------------------- -------
+ * J2 NAME PIN NAME PAD
+ * -- ---- -- ------------------------- -------
+ * 1 VIN -- Connected to USB +RV
+ * 2 GND -- Connected to USB GND
+ * 3 3V3 -- Not used ---
+ * 4 NC -- Not used
+ * 5 CS 10 (SS/PCINT0) PB0 Pad B0
+ * 6 DI 12 (PDI/PCINT2/MOSI) PB2 Pad B2
+ * 7 SCK 11 (PCINT1/SCLK) PB1 Pad B1
+ * 8 DO 13 (PDO/PCINT3/MISO) PB3 Pad B3
+ * 9 IRQ -- Not used ---
+ * 10 CD 14 (PCINT4/OC.2A) PB4 Pad B4
+ * 11 WP 15 (PCINT5/OC.1A) PB5 Pad B5
+ * -- ---- -- ------------------------- -------
+ */
+
+#define TEENSY_CS (1 << 0)
+#define TEENSY_CD (1 << 4)
+#define TEENSY_WP (1 << 5)
+
+/* The following enable debug output from this file (needs CONFIG_DEBUG too).
+ *
+ * CONFIG_SPI_DEBUG - Define to enable basic SSP debug
+ * CONFIG_SPI_VERBOSE - Define to enable verbose SSP debug
+ */
+
+#ifdef CONFIG_SPI_DEBUG
+# define sspdbg lldbg
+# ifdef CONFIG_SPI_VERBOSE
+# define sspvdbg lldbg
+# else
+# define sspvdbg(x...)
+# endif
+#else
+# undef CONFIG_SPI_VERBOSE
+# define sspdbg(x...)
+# define sspvdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: at90usb_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the LPC1766-STK.
+ *
+ ************************************************************************************/
+
+void weak_function at90usb_spiinitialize(void)
+{
+ /* The Teensy board has no dedicated SPI devices so we assume that SS is used
+ * for chip select:
+ *
+ * "When the SPI is configured as a Master (MSTR in SPCR is set), the user
+ * can determine the direction of the SS pin. If SS is configured as an
+ * output, the pin is a general output pin which does not affect the SPI
+ * system. ...
+ *
+ * "If SS is configured as an input, it must be held high to ensure Master
+ * SPI operation. If the SS pin is driven low by peripheral circuitry when
+ * the SPI is configured as a Master with the SS pin defined as an input,
+ * the SPI system interprets this as another master selecting the SPI ...
+ */
+
+ DDRB |= TEENSY_CS; /* B0 is an output */
+ PORTB |= TEENSY_CS; /* Low de-selects */
+ DDRB &= ~(TEENSY_CD | TEENSY_WP); /* B4 and B5 are inputs */
+ PORTB |= (TEENSY_CD | TEENSY_WP); /* Pull high */
+}
+
+/************************************************************************************
+ * Name: avr_spiselect and avr_spistatus
+ *
+ * Description:
+ * The external functions, avr_spiselect and avr_spistatus must be provided by
+ * board-specific logic. They are implementations of the select and status methods
+ * of the SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h). All
+ * other methods (including up_spiinitialize()) are provided by common AVR logic.
+ * To use this common SPI logic on your board:
+ *
+ * 1. Provide logic in avr_sspinitialize() to configure SPI chip select pins.
+ * 2. Provide avr_spiselect() and avr_spistatus() functions in your board-specific
+ * logic. These functions will perform chip selection and status operations
+ * in the way your board is configured.
+ * 3. Add a calls to at90usb_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
+ * for example, will bind the SPI driver to the SPI MMC/SD driver).
+ *
+ ************************************************************************************/
+
+void avr_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ /* Assert/de-assert the CS pin to the card */
+
+ if (selected)
+ {
+ PORTB &= ~TEENSY_CS;
+ }
+ else
+ {
+ PORTB |= TEENSY_CS;
+ }
+}
+
+uint8_t avr_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ uint8_t ret = 0;
+ uint8_t regval = PINB;
+
+ /* Both the CD and WP pins are pull high by the AT90USB and will be
+ * grounded it a card is inserted or write protected.
+ */
+
+ if ((regval & TEENSY_CD) == 0)
+ {
+ ret |= SPI_STATUS_PRESENT;
+ }
+
+ if ((regval & TEENSY_WP) == 0)
+ {
+ ret |= SPI_STATUS_WRPROTECTED;
+ }
+
+ sspdbg("Returning %02x\n", ret);
+ return ret;
+}
+
+#endif /* CONFIG_AVR_SPI */
diff --git a/nuttx/configs/teensy/src/up_usbmsc.c b/nuttx/configs/teensy/src/up_usbmsc.c
new file mode 100644
index 000000000..fcf7fe2f5
--- /dev/null
+++ b/nuttx/configs/teensy/src/up_usbmsc.c
@@ -0,0 +1,137 @@
+/****************************************************************************
+ * configs/teensy/src/up_usbmsc.c
+ * arch/arm/src/board/up_usbmsc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the AVR MMC/SD SPI block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/mmcsd.h>
+
+#include "at90usb_internal.h"
+#include "teensy_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_TEENSY
+# undef AVR_MMCSDSPIPORTNO
+# define AVR_MMCSDSPIPORTNO 0
+# undef AVR_MMCSDSLOTNO
+# define AVR_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new AVR boards here */
+# error "Unrecognized AVR board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct spi_dev_s *spi;
+ int ret;
+
+ /* Get the SPI port */
+
+ message("Initializing SPI port\n");
+
+ spi = up_spiinitialize(AVR_MMCSDSPIPORTNO);
+ if (!spi)
+ {
+ message("up_spiinitialize failed\n");
+ return -ENODEV;
+ }
+
+ /* Bind the SPI port to the slot */
+
+ message("Binding SPI port to MMC/SD slot\n");
+
+ ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, AVR_MMCSDSLOTNO, spi);
+ if (ret < 0)
+ {
+ message("mmcsd_spislotinitialize failed: %d\n", ret);
+ return ret;
+ }
+
+ return OK;
+}
diff --git a/nuttx/configs/teensy/usbstorage/Make.defs b/nuttx/configs/teensy/usbstorage/Make.defs
new file mode 100644
index 000000000..74da8d78f
--- /dev/null
+++ b/nuttx/configs/teensy/usbstorage/Make.defs
@@ -0,0 +1,150 @@
+############################################################################
+# configs/teensy/usbstorage/Make.defs
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_AVR_WINAVR),y)
+ # WinAVR toolchain under Windows/Cygwin
+ CROSSDEV = avr-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_LINUXGCC),y)
+ # GCC toolchain under Linux
+ CROSSDEV = avr-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(CONFIG_AVR_BUILDROOT),y)
+ # NuttX buildroot GCC toolchain under Linux or Cygwin
+ CROSSDEV = avr-elf-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mmcu=at90usb1286
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
+ ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/teensy/usbstorage/appconfig b/nuttx/configs/teensy/usbstorage/appconfig
new file mode 100644
index 000000000..76df13884
--- /dev/null
+++ b/nuttx/configs/teensy/usbstorage/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/teensy/usbstorage/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/usbstorage
+
diff --git a/nuttx/configs/teensy/usbstorage/defconfig b/nuttx/configs/teensy/usbstorage/defconfig
new file mode 100755
index 000000000..a0f906665
--- /dev/null
+++ b/nuttx/configs/teensy/usbstorage/defconfig
@@ -0,0 +1,430 @@
+############################################################################
+# configs/teensy/usbstorage/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="avr"
+CONFIG_ARCH_AVR=y
+CONFIG_ARCH_AT90USB=y
+CONFIG_ARCH_CHIP="at90usb"
+CONFIG_ARCH_CHIP_AT90USB1286=y
+CONFIG_ARCH_BOARD="teensy"
+CONFIG_ARCH_BOARD_TEENSY=y
+CONFIG_BOARD_LOOPSPERMSEC=864
+CONFIG_DRAM_SIZE=8192
+CONFIG_DRAM_START=0x800100
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=n
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_AVR_WINAVR=n
+CONFIG_AVR_LINUXGCC=n
+CONFIG_AVR_BUILDROOT=y
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_AVR_INT0=n
+CONFIG_AVR_INT1=n
+CONFIG_AVR_INT2=n
+CONFIG_AVR_INT3=n
+CONFIG_AVR_INT4=n
+CONFIG_AVR_INT5=n
+CONFIG_AVR_INT6=n
+CONFIG_AVR_INT7=n
+CONFIG_AVR_USBHOST=n
+CONFIG_AVR_USBDEV=y
+CONFIG_AVR_WDT=n
+CONFIG_AVR_TIMER0=n
+CONFIG_AVR_TIMER1=n
+CONFIG_AVR_TIMER2=n
+CONFIG_AVR_TIMER3=n
+CONFIG_AVR_SPI=y
+CONFIG_AVR_USART1=y
+CONFIG_AVR_ANACOMP=n
+CONFIG_AVR_ADC=n
+CONFIG_AVR_TWI=n
+
+#
+# AT90USB specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART1_BAUD=38400
+CONFIG_USART1_BITS=8
+CONFIG_USART1_PARITY=0
+CONFIG_USART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="msconn_main"
+#CONFIG_USER_ENTRYPOINT="msdis_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_USB=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=7
+CONFIG_START_DAY=2
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# Settings for NXFLAT
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=2
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=562
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=8
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=y
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=y
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# AVR-Specific USB Device Configuration
+#
+#CONFIG_USB_DISABLE_PADREGULATOR
+CONFIG_USB_LOWSPEED=n
+CONFIG_USB_NOISYVBUS=n
+
+#
+# USB Host Configuration
+#
+CONFIG_USBHOST=n
+CONFIG_USBHOST_NPREALLOC=0
+CONFIG_USBHOST_BULK_DISABLE=n
+CONFIG_USBHOST_INT_DISABLE=y
+CONFIG_USBHOST_ISOC_DISABLE=y
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=y
+CONFIG_USBMSC_EP0MAXPACKET=8
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=512
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=y
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=y
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=512
+CONFIG_USERMAIN_STACKSIZE=512
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=512
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/teensy/usbstorage/ld.script b/nuttx/configs/teensy/usbstorage/ld.script
new file mode 100755
index 000000000..54163f002
--- /dev/null
+++ b/nuttx/configs/teensy/usbstorage/ld.script
@@ -0,0 +1,210 @@
+/**************************************************************************************
+ * configs/teensy/usbstorage/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************************/
+
+/* Memory Regions *********************************************************************/
+/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
+ * | REGISTERS REGISTERS |
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ * AT90USB1286 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 8Kb | 0x0000 4Kb
+ * -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0, LENGTH = 128K
+ sram (rw!x) : ORIGIN = 0x800100, LENGTH = 8K
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
+}
+
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+
+ .text :
+ {
+ _stext = . ;
+ *(.vectors)
+ *(.init)
+ *(.handlers)
+ *(.text)
+ *(.text.*)
+ _etext = . ;
+ } > flash
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Global data not cleared after reset. */
+
+ .noinit :
+ {
+ _snoinit = ABSOLUTE(.);
+ *(.noinit*)
+ _enoinit = ABSOLUTE(.);
+ } > sram
+
+ .eeprom :
+ {
+ _seeprom = ABSOLUTE(.);
+ *(.eeprom*)
+ _eeeprom = ABSOLUTE(.);
+ } > eeprom
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/nuttx/configs/teensy/usbstorage/setenv.sh b/nuttx/configs/teensy/usbstorage/setenv.sh
new file mode 100755
index 000000000..a455f560a
--- /dev/null
+++ b/nuttx/configs/teensy/usbstorage/setenv.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# configs/teensy/usbstorage/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the WinAVR
+# toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install the Linux AVR toolchain as well
+#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/twr-k60n512/Kconfig b/nuttx/configs/twr-k60n512/Kconfig
new file mode 100644
index 000000000..94e6b725a
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_TWR_K60N512
+endif
diff --git a/nuttx/configs/twr-k60n512/README.txt b/nuttx/configs/twr-k60n512/README.txt
new file mode 100644
index 000000000..5cb273a39
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/README.txt
@@ -0,0 +1,640 @@
+README.txt
+==========
+
+This is the README file for the port of NuttX to the Freescale Kinetis
+TWR-K60N512. Refer to the Freescale web site for further information
+about this part:
+http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K60N512-KIT
+
+The TWR-K60N51 includes with the FreeScale Tower System which provides (among
+other things) a simple UART connection.
+
+Contents
+========
+
+ o Kinetis TWR-K60N512 Features
+ o Kinetis TWR-K60N512 Pin Configuration
+ - On-Board Connections
+ - Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ - Connections via the Tower Primary Connector Side A
+ - Connections via the Tower Primary Connector Side B
+ - TWR-SER Serial Board Connection
+ o LEDs
+ o Development Environment
+ o GNU Toolchain Options
+ o IDEs
+ o NuttX buildroot Toolchain
+
+Kinetis TWR-K60N512 Features:
+=============================
+
+ o K60N512 in 144 MAPBGA, K60N512VMD100
+ o Capacitive Touch Pads
+ o Integrated, Open-Source JTAG
+ o SD Card Slot
+ o MMA7660 3-axis accelerometer
+ o Tower Plug-In (TWRPI) Socket for expansion (sensors, etc.)
+ o Touch TWRPI Socket adds support for various capacitive touch boards
+ (e.g. keypads, rotary dials, sliders, etc.)
+ o Tower connectivity for access to USB, Ethernet, RS232/RS485, CAN, SPI,
+ I²C, Flexbus, etc.
+ o Plus: Potentiometer, 4 LEDs, 2 pushbuttons, infrared port
+
+Kinetis TWR-K60N512 Pin Configuration
+=====================================
+
+On-Board Connections
+-------------------- ------------------------- -------- -------------------
+FEATURE CONNECTION PORT/PIN PIN FUNCTION
+-------------------- ------------------------- -------- -------------------
+OSJTAG USB-to-serial OSJTAG Bridge RX Data PTE9 UART5_RX
+Bridge OSJTAG Bridge TX Data PTE8 UART5_TX
+SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ SD Command PTE3 SDHC0_CMD
+ SD Data0 PTE1 SDHC0_D0
+ SD Data1 PTE0 SDHC0_D1
+ SD Data2 PTE5 SDHC0_D2
+ SD Data3 PTE4 SDHC0_D3
+ SD Card Detect PTE28 PTE28
+ SD Write Protect PTE27 PTE27
+Infrared Port IR Transmit PTD7 CMT_IRO
+ IR Receive PTC6 CMP0_IN0
+Pushbuttons SW1 (IRQ0) PTA19 PTA19
+ SW2 (IRQ1) PTE26 PTE26
+ SW3 (RESET) RESET_b RESET_b
+Touch Pads E1 / Touch PTA4 TSI0_CH5
+ E2 / Touch PTB3 TSI0_CH8
+ E3 / Touch PTB2 TSI0_CH7
+ E4 / Touch PTB16 TSI0_CH9
+LEDs E1 / Orange LED PTA11 PTA11
+ E2 / Yellow LED PTA28 PTA28
+ E3 / Green LED PTA29 PTA29
+ E4 / Blue LED PTA10 PTA10
+Potentiometer Potentiometer (R71) ? ADC1_DM1
+Accelerometer I2C SDA PTD9 I2C0_SDA
+ I2C SCL PTD8 I2C0_SCL
+ IRQ PTD10 PTD10
+Touch Pad / Segment Electrode 0 (J3 Pin 3) PTB0 TSI0_CH0
+LCD TWRPI Socket Electrode 1 (J3 Pin 5) PTB1 TSI0_CH6
+ Electrode 2 (J3 Pin 7) PTB2 TSI0_CH7
+ Electrode 3 (J3 Pin 8) PTB3 TSI0_CH8
+ Electrode 4 (J3 Pin 9) PTC0 TSI0_CH13
+ Electrode 5 (J3 Pin 10) PTC1 TSI0_CH14
+ Electrode 6 (J3 Pin 11) PTC2 TSI0_CH15
+ Electrode 7 (J3 Pin 12) PTA4 TSI0_CH5
+ Electrode 8 (J3 Pin 13) PTB16 TSI0_CH9
+ Electrode 9 (J3 Pin 14) PTB17 TSI0_CH10
+ Electrode 10 (J3 Pin 15) PTB18 TSI0_CH11
+ Electrode 11 (J3 Pin 16) PTB19 TSI0_CH12
+ TWRPI ID0 (J3 Pin 17) ? ADC1_DP1
+ TWRPI ID1 (J3 Pin 18) ? ADC1_SE16
+
+Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+-------------------- ------------------------- -------- -------------------
+FEATURE CONNECTION PORT/PIN PIN FUNCTION
+-------------------- ------------------------- -------- -------------------
+General Purpose TWRPI AN0 (J4 Pin 8) ? ADC0_DP0/ADC1_DP3
+TWRPI Socket TWRPI AN1 (J4 Pin 9) ? ADC0_DM0/ADC1_DM3
+ TWRPI AN2 (J4 Pin 12) ? ADC1_DP0/ADC0_DP3
+ TWRPI ID0 (J4 Pin 17) ? ADC0_DP1
+ TWRPI ID1 (J4 Pin 18) ? ADC0_DM1
+ TWRPI I2C SCL (J5 Pin 3) PTD8 I2C0_SCL
+ TWRPI I2C SDA (J5 Pin 4) PTD9 I2C0_SDA
+ TWRPI SPI MISO (J5 Pin 9) PTD14 SPI2_SIN
+ TWRPI SPI MOSI (J5 Pin 10) PTD13 SPI2_SOUT
+ TWRPI SPI SS (J5 Pin 11) PTD15 SPI2_PCS0
+ TWRPI SPI CLK (J5 Pin 12) PTD12 SPI2_SCK
+ TWRPI GPIO0 (J5 Pin 15) PTD10 PTD10
+ TWRPI GPIO1 (J5 Pin 16) PTB8 PTB8
+ TWRPI GPIO2 (J5 Pin 17) PTB9 PTB9
+ TWRPI GPIO3 (J5 Pin 18) PTA19 PTA19
+ TWRPI GPIO4 (J5 Pin 19) PTE26 PTE26
+
+The TWR-K60N512 features two expansion card-edge connectors that interface
+to the Primary and Secondary Elevator boards in a Tower system. The Primary
+Connector (comprised of sides A and B) is utilized by the TWR-K60N512 while
+the Secondary Connector (comprised of sides C and D) only makes connections
+to the GND pins.
+
+Connections via the Tower Primary Connector Side A
+--- -------------------- --------------------------------
+PIN NAME USAGE
+--- -------------------- --------------------------------
+A7 SCL0 PTD8
+A8 SDA0 PTD9
+A9 GPIO9 / CTS1 PTC19
+A10 GPIO8 / SDHC_D2 PTE5
+A11 GPIO7 / SD_WP_DET PTE27
+A13 ETH_MDC PTB1
+A14 ETH_MDIO PTB0
+A16 ETH_RXDV PTA14
+A19 ETH_RXD1 PTA12
+A20 ETH_RXD0 PTA13
+A21 SSI_MCLK PTE6
+A22 SSI_BCLK PTE12
+A23 SSI_FS PTE11
+A24 SSI_RXD PTE7
+A25 SSI_TXD PTE10
+A27 AN3 PGA0_DP/ADC0_DP0/ADC1_DP3
+A28 AN2 PGA0_DM/ADC0_DM0/ADC1_DM3
+A29 AN1 PGA1_DP/ADC1_DP0/ADC0_DP3
+A30 AN0 PGA1_DM/ADC1_DM0/ADC0_DM3
+A33 TMR1 PTA9
+A34 TMR0 PTA8
+A35 GPIO6 PTB9
+A37 PWM3 PTA6
+A38 PWM2 PTC3
+A39 PWM1 PTC2
+A40 PWM0 PTC1
+A41 RXD0 PTE25
+A42 TXD0 PTE24
+A43 RXD1 PTC16
+A44 TXD1 PTC17
+A64 CLKOUT0 PTC3
+A66 EBI_AD14 PTC0
+A67 EBI_AD13 PTC1
+A68 EBI_AD12 PTC2
+A69 EBI_AD11 PTC4
+A70 EBI_AD10 PTC5
+A71 EBI_AD9 PTC6
+A71 EBI_R/W_b PTC11
+A72 EBI_AD8 PTC7
+A73 EBI_AD7 PTC8
+A74 EBI_AD6 PTC9
+A75 EBI_AD5 PTC10
+A76 EBI_AD4 PTD2
+A77 EBI_AD3 PTD3
+A78 EBI_AD2 PTD4
+A79 EBI_AD1 PTD5
+A80 EBI_AD0 PTD6
+
+Connections via the Tower Primary Connector Side B
+--- -------------------- --------------------------------
+PIN NAME USAGE
+--- -------------------- --------------------------------
+B7 SDHC_CLK / SPI1_CLK PTE2
+B9 SDHC_D3 / SPI1_CS0_b PTE4
+B10 SDHC_CMD / SPI1_MOSI PTE1
+B11 SDHC_D0 / SPI1_MISO PTE3
+B13 ETH_RXER PTA5
+B15 ETH_TXEN PTA15
+B19 ETH_TXD1 PTA17
+B20 ETH_TXD0 PTA16
+B21 GPIO1 / RTS1 PTC18
+B22 GPIO2 / SDHC_D1 PTE0
+B23 GPIO3 PTE28
+B24 CLKIN0 PTA18
+B25 CLKOUT1 PTE26
+B27 AN7 PTB7
+B28 AN6 PTB6
+B29 AN5 PTB5
+B30 AN4 PTB4
+B34 TMR2 PTD6
+B35 GPIO4 PTB8
+B37 PWM7 PTA2
+B38 PWM6 PTA1
+B39 PWM5 PTD5
+B40 PWM4 PTA7
+B41 CANRX0 PTE25
+B42 CANTX0 PTE24
+B44 SPI0_MISO PTD14
+B45 SPI0_MOSI PTD13
+B46 SPI0_CS0_b PTD11
+B47 SPI0_CS1_b PTD15
+B48 SPI0_CLK PTD12
+B50 SCL1 PTD8
+B51 SDA1 PTD9
+B52 GPIO5 / SD_CARD_DET PTE28
+B55 IRQ_H PTA24
+B56 IRQ_G PTA24
+B57 IRQ_F PTA25
+B58 IRQ_E PTA25
+B59 IRQ_D PTA26
+B60 IRQ_C PTA26
+B61 IRQ_B PTA27
+B62 IRQ_A PTA27
+B63 EBI_ALE / EBI_CS1_b PTD0
+B64 EBI_CS0_b PTD1
+B66 EBI_AD15 PTB18
+B67 EBI_AD16 PTB17
+B68 EBI_AD17 PTB16
+B69 EBI_AD18 PTB11
+B70 EBI_AD19 PTB10
+B72 EBI_OE_b PTB19
+B73 EBI_D7 PTB20
+B74 EBI_D6 PTB21
+B75 EBI_D5 PTB22
+B76 EBI_D4 PTB23
+B77 EBI_D3 PTC12
+B78 EBI_D2 PTC13
+B79 EBI_D1 PTC14
+B80 EBI_D0 PTC15
+
+TWR-SER Serial Board Connection
+===============================
+
+The serial board connects into the tower and then maps to the tower pins to
+yet other functions (see TWR-SER.pdf).
+
+For the serial port, the following jumpers are required:
+
+ J15: 1-2 (default)
+ J17: 1-2 (default)
+ J18: 1-2 (default)
+ J19: 1-2 (default)
+
+The two connections map as follows:
+
+ A41 RXD0 - Not connected
+ A42 TXD0 - Not connected
+ A43 RXD1 - ELE_RXD (connects indirectory to DB-9 connector J8)
+ A44 TXD1 - ELE_TXD (connects indirectory to DB-9 connector J8)
+
+Finally, we can conclude that:
+
+ UART4 (PTE24/25) is not connected, and
+ UART3 (PTC16/17) is associated with the DB9 connector
+
+NOTE: UART5 is associated with OSJTAG bridge and may also be usable.
+
+LEDs
+====
+
+The TWR-K60N100 board has four LEDs labeled D2..D4 on the board. Usage of
+these LEDs is defined in include/board.h and src/up_leds.c. They are encoded
+as follows:
+
+ SYMBOL Meaning LED1* LED2 LED3 LED4
+ ------------------- ----------------------- ------- ------- ------- ------
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
+
+ * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
+ and these LEDs will give you some indication of where the failure was
+ ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
+ is because of timer interupts that result in the LED being illuminated
+ on a small proportion of the time.
+*** LED2 may also flicker normally if signals are processed.
+
+Development Environment
+=======================
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment.
+
+GNU Toolchain Options
+=====================
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the CodeSourcery Windows toolchain. To
+ use the devkitARM or the NuttX GNU toolchain, you simply need to change the
+ the following configuration options to your .config (or defconfig) file:
+
+ CONFIG_KINETIS_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_KINETIS_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_KINETIS_DEVKITARM=y : devkitARM under Windows
+ CONFIG_KINETIS_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_KINETIS_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows) and devkitARM toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+====
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project.
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/k40,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/kinetis/k40_vectors.S.
+
+NuttX buildroot Toolchain
+=========================
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M4 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M4 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ NOTE: The NuttX toolchain is an OABI toolchain (vs. the more common EABI)
+ and does not include optimizations for Cortex-M4 (ARMv7E-M).
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh twr-k60n512/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M4 toolchain for Cygwin under Windows.
+
+TWR-K60N512-specific Configuration Options
+==========================================
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This sould
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM4=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=k40
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_MK60N512VMD100
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=twr-k60n512 (for the TWR-K60N512 development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_TWR_K60N512=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The Kinetis K60 supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ Individual subsystems can be enabled:
+
+ CONFIG_KINETIS_TRACE -- Enable trace clocking on power up.
+ CONFIG_KINETIS_FLEXBUS -- Enable flexbus clocking on power up.
+ CONFIG_KINETIS_UART0 -- Support UART0
+ CONFIG_KINETIS_UART1 -- Support UART1
+ CONFIG_KINETIS_UART2 -- Support UART2
+ CONFIG_KINETIS_UART3 -- Support UART3
+ CONFIG_KINETIS_UART4 -- Support UART4
+ CONFIG_KINETIS_UART5 -- Support UART5
+ CONFIG_KINETIS_ENET -- Support Ethernet (K60 only)
+ CONFIG_KINETIS_RNGB -- Support the random number generator(K60 only)
+ CONFIG_KINETIS_FLEXCAN0 -- Support FlexCAN0
+ CONFIG_KINETIS_FLEXCAN1 -- Support FlexCAN1
+ CONFIG_KINETIS_SPI0 -- Support SPI0
+ CONFIG_KINETIS_SPI1 -- Support SPI1
+ CONFIG_KINETIS_SPI2 -- Support SPI2
+ CONFIG_KINETIS_I2C0 -- Support I2C0
+ CONFIG_KINETIS_I2C1 -- Support I2C1
+ CONFIG_KINETIS_I2S -- Support I2S
+ CONFIG_KINETIS_DAC0 -- Support DAC0
+ CONFIG_KINETIS_DAC1 -- Support DAC1
+ CONFIG_KINETIS_ADC0 -- Support ADC0
+ CONFIG_KINETIS_ADC1 -- Support ADC1
+ CONFIG_KINETIS_CMP -- Support CMP
+ CONFIG_KINETIS_VREF -- Support VREF
+ CONFIG_KINETIS_SDHC -- Support SD host controller
+ CONFIG_KINETIS_FTM0 -- Support FlexTimer 0
+ CONFIG_KINETIS_FTM1 -- Support FlexTimer 1
+ CONFIG_KINETIS_FTM2 -- Support FlexTimer 2
+ CONFIG_KINETIS_LPTIMER -- Support the low power timer
+ CONFIG_KINETIS_RTC -- Support RTC
+ CONFIG_KINETIS_SLCD -- Support the segment LCD (K60 only)
+ CONFIG_KINETIS_EWM -- Support the external watchdog
+ CONFIG_KINETIS_CMT -- Support Carrier Modulator Transmitter
+ CONFIG_KINETIS_USBOTG -- Support USB OTG (see also CONFIG_USBHOST and CONFIG_USBDEV)
+ CONFIG_KINETIS_USBDCD -- Support the USB Device Charger Detection module
+ CONFIG_KINETIS_LLWU -- Support the Low Leakage Wake-Up Unit
+ CONFIG_KINETIS_TSI -- Support the touch screeen interface
+ CONFIG_KINETIS_FTFL -- Support FLASH
+ CONFIG_KINETIS_DMA -- Support DMA
+ CONFIG_KINETIS_CRC -- Support CRC
+ CONFIG_KINETIS_PDB -- Support the Programmable Delay Block
+ CONFIG_KINETIS_PIT -- Support Programmable Interval Timers
+ CONFIG_ARMV7M_MPU -- Support the MPU
+
+ Kinetis interrupt priorities (Default is the mid priority)
+
+ CONFIG_KINETIS_UART0PRIO
+ CONFIG_KINETIS_UART1PRIO
+ CONFIG_KINETIS_UART2PRIO
+ CONFIG_KINETIS_UART3PRIO
+ CONFIG_KINETIS_UART4PRIO
+ CONFIG_KINETIS_UART5PRIO
+
+ CONFIG_KINETIS_EMACTMR_PRIO
+ CONFIG_KINETIS_EMACTX_PRIO
+ CONFIG_KINETIS_EMACRX_PRIO
+ CONFIG_KINETIS_EMACMISC_PRIO
+
+ CONFIG_KINETIS_SDHC_PRIO
+
+ PIN Interrupt Support
+
+ CONFIG_GPIO_IRQ -- Enable pin interrtup support. Also needs
+ one or more of the following:
+ CONFIG_KINETIS_PORTAINTS -- Support 32 Port A interrupts
+ CONFIG_KINETIS_PORTBINTS -- Support 32 Port B interrupts
+ CONFIG_KINETIS_PORTCINTS -- Support 32 Port C interrupts
+ CONFIG_KINETIS_PORTDINTS -- Support 32 Port D interrupts
+ CONFIG_KINETIS_PORTEINTS -- Support 32 Port E interrupts
+
+ Kinetis K60 specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn (n=0..5) for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART.
+ CONFIG_UARTn_BITS - The number of bits. Must be either 8 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+
+ Kenetis ethernet controller settings
+
+ CONFIG_ENET_NRXBUFFERS - Number of RX buffers. The size of one
+ buffer is determined by CONFIG_NET_BUFSIZE. Default: 6
+ CONFIG_ENET_NTXBUFFERS - Number of TX buffers. The size of one
+ buffer is determined by CONFIG_NET_BUFSIZE. Default: 2
+ CONFIG_ENET_USEMII - Usee MII mode. Default: RMII mode.
+ CONFIG_ENET_PHYADDR - PHY address
+
+Configurations
+==============
+
+Each TWR-K60N512 configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh twr-k60n512/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ ------
+ This configuration directory, performs a simple OS test using
+ examples/ostest. By default, this project assumes that you are
+ using the DFU bootloader.
+
+ CONFIG_KINETIS_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+
+ nsh:
+ ---
+ Configures the NuttShell (nsh) located at apps/examples/nsh. The
+ Configuration enables both the serial and telnet NSH interfaces.
+ Support for the board's SPI-based MicroSD card is included
+ (but not passing tests as of this writing).
+
+ NOTE: An SDHC driver is underwork and can be enabled in the NSH
+ configuration for further testing be setting the following
+ configuration faluesas follows:
+
+ -CONFIG_KINETIS_SDHC=n
+ +CONFIG_KINETIS_SDHC=y # Enable the SDHC driver
+
+ -CONFIG_GPIO_IRQ=n
+ +CONFIG_GPIO_IRQ=y # Enable GPIO interrupts
+
+ -CONFIG_KINETIS_PORTEINTS=n
+ +CONFIG_KINETIS_PORTEINTS=y # Enable PortE GPIO interrupts
+
+ -CONFIG_SCHED_WORKQUEUE=n
+ +CONFIG_SCHED_WORKQUEUE=y # Enable the NuttX workqueue
+
+ -CONFIG_NSH_ARCHINIT=n
+ +CONFIG_NSH_ARCHINIT=y # Provide NSH intialization logic
+
+
diff --git a/nuttx/configs/twr-k60n512/include/board.h b/nuttx/configs/twr-k60n512/include/board.h
new file mode 100644
index 000000000..ca060c654
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/include/board.h
@@ -0,0 +1,438 @@
+/************************************************************************************
+ * configs/twr-k60n512/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+/* The K60 tower board uses a 50MHz external clock */
+
+#define BOARD_EXTCLOCK 1 /* External clock */
+#define BOARD_EXTAL_FREQ 50000000 /* 50MHz Oscillator */
+#define BOARD_XTAL32_FREQ 32768 /* 32KHz RTC Oscillator */
+
+/* PLL Configuration. Either the external clock or crystal frequency is used to
+ * select the PRDIV value. Only reference clock frequencies are supported that will
+ * produce a 2MHz reference clock to the PLL.
+ *
+ * PLL Input frequency: PLLIN = REFCLK/PRDIV = 50MHz/25 = 2MHz
+ * PLL Output frequency: PLLOUT = PLLIN*VDIV = 2Mhz*48 = 96MHz
+ * MCG Frequency: PLLOUT = 96MHz
+ */
+
+#define BOARD_PRDIV 25 /* PLL External Reference Divider */
+#define BOARD_VDIV 48 /* PLL VCO Divider (frequency multiplier) */
+
+#define BOARD_PLLIN_FREQ (BOARD_EXTAL_FREQ / BOARD_PRDIV)
+#define BOARD_PLLOUT_FREQ (BOARD_PLLIN_FREQ * BOARD_VDIV)
+#define BOARD_MCG_FREQ BOARD_PLLOUT_FREQ
+
+/* SIM CLKDIV1 dividers */
+
+#define BOARD_OUTDIV1 1 /* Core = MCG, 96MHz */
+#define BOARD_OUTDIV2 2 /* Bus = MCG/2, 48MHz */
+#define BOARD_OUTDIV3 2 /* FlexBus = MCG/2, 48MHz */
+#define BOARD_OUTDIV4 4 /* Flash clock = MCG/4, 24MHz */
+
+#define BOARD_CORECLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV1)
+#define BOARD_BUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV2)
+#define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3)
+#define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4)
+
+/* SDHC clocking ********************************************************************/
+
+/* SDCLK configurations corresponding to various modes of operation. Formula is:
+ *
+ * SDCLK frequency = (base clock) / (prescaler * divisor)
+ *
+ * The SDHC module is always configure configured so that the core clock is the base
+ * clock.
+ */
+
+/* Identification mode: 400KHz = 96MHz / ( 16 * 15) */
+
+#define BOARD_SDHC_IDMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV16
+#define BOARD_SDHC_IDMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
+
+/* MMC normal mode: 16MHz = 96MHz / (2 * 3) */
+
+#define BOARD_SDHC_MMCMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+#define BOARD_SDHC_MMCMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
+
+/* SD normal mode (1-bit): 16MHz = 96MHz / (2 * 3) */
+
+#define BOARD_SDHC_SD1MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+#define BOARD_SDHC_SD1MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
+
+/* SD normal mode (4-bit): 24MHz = 96MHz / (2 * 2) (with DMA)
+ * SD normal mode (4-bit): 16MHz = 96MHz / (2 * 3) (no DMA)
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(2)
+#else
+//# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
+//# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
+# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV16
+# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
+#endif
+
+/* LED definitions ******************************************************************/
+/* The TWR-K60N512 has four LEDs:
+ *
+ * 1. E1 / Orange LED PTA11
+ * 2. E2 / Yellow LED PTA28
+ * 3. E3 / Green LED PTA29
+ * 4 E4 / Blue LED PTA10
+ *
+ * The 4 LEDs are encoded as follows:
+ */
+
+#define LED_STARTED 0 /* LED1 */
+#define LED_HEAPALLOCATE 1 /* LED2 */
+#define LED_IRQSENABLED 2 /* LED1 + LED2 */
+#define LED_STACKCREATED 3 /* LED3 */
+#define LED_INIRQ 4 /* LED1 + LED3 */
+#define LED_SIGNAL 5 /* LED2 + LED3 */
+#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
+#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+
+/* Button definitions ***************************************************************/
+/* The TWR-K60N512 has user buttons (plus a reset button):
+ *
+ * 1. SW1 (IRQ0) PTA19
+ * 2. SW2 (IRQ1) PTE26
+ */
+
+#define BUTTON_SW1 0
+#define BUTTON_SW2 1
+
+#define BUTTON_SW1_BIT (1 << BUTTON_WAKEUP)
+#define BUTTON_SW2_BIT (1 << BUTTON_TAMPER)
+
+/* Alternative pin resolution *******************************************************/
+/* If there are alternative configurations for various pins in the
+ * kinetis_k60pinmux.h header file, those alternative pins will be labeled with a
+ * suffix like _1, _2, etc. The logic in this file must select the correct pin
+ * configuration for the board by defining a pin configuration (with no suffix) that
+ * maps to the correct alternative.
+ */
+
+/* On-Board Connections
+ * -------------------- ------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * -------------------- ------------------------- -------- -------------------
+ * OSJTAG USB-to-serial OSJTAG Bridge RX Data PTE9 UART5_RX
+ * Bridge OSJTAG Bridge TX Data PTE8 UART5_TX
+ * SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ * SD Command PTE3 SDHC0_CMD
+ * SD Data0 PTE1 SDHC0_D0
+ * SD Data1 PTE0 SDHC0_D1
+ * SD Data2 PTE5 SDHC0_D2
+ * SD Data3 PTE4 SDHC0_D3
+ * SD Card Detect PTE28 PTE28
+ * SD Write Protect PTE27 PTE27
+ * Infrared Port IR Transmit PTD7 CMT_IRO
+ * IR Receive PTC6 CMP0_IN0
+ * Pushbuttons SW1 (IRQ0) PTA19 PTA19
+ * SW2 (IRQ1) PTE26 PTE26
+ * SW3 (RESET) RESET_b RESET_b
+ * Touch Pads E1 / Touch PTA4 TSI0_CH5
+ * E2 / Touch PTB3 TSI0_CH8
+ * E3 / Touch PTB2 TSI0_CH7
+ * E4 / Touch PTB16 TSI0_CH9
+ * LEDs E1 / Orange LED PTA11 PTA11
+ * E2 / Yellow LED PTA28 PTA28
+ * E3 / Green LED PTA29 PTA29
+ * E4 / Blue LED PTA10 PTA10
+ * Potentiometer Potentiometer (R71) ? ADC1_DM1
+ * Accelerometer I2C SDA PTD9 I2C0_SDA
+ * I2C SCL PTD8 I2C0_SCL
+ * IRQ PTD10 PTD10
+ * Touch Pad / Segment Electrode 0 (J3 Pin 3) PTB0 TSI0_CH0
+ * LCD TWRPI Socket Electrode 1 (J3 Pin 5) PTB1 TSI0_CH6
+ * Electrode 2 (J3 Pin 7) PTB2 TSI0_CH7
+ * Electrode 3 (J3 Pin 8) PTB3 TSI0_CH8
+ * Electrode 4 (J3 Pin 9) PTC0 TSI0_CH13
+ * Electrode 5 (J3 Pin 10) PTC1 TSI0_CH14
+ * Electrode 6 (J3 Pin 11) PTC2 TSI0_CH15
+ * Electrode 7 (J3 Pin 12) PTA4 TSI0_CH5
+ * Electrode 8 (J3 Pin 13) PTB16 TSI0_CH9
+ * Electrode 9 (J3 Pin 14) PTB17 TSI0_CH10
+ * Electrode 10 (J3 Pin 15) PTB18 TSI0_CH11
+ * Electrode 11 (J3 Pin 16) PTB19 TSI0_CH12
+ * TWRPI ID0 (J3 Pin 17) ? ADC1_DP1
+ * TWRPI ID1 (J3 Pin 18) ? ADC1_SE16
+ */
+
+#define PIN_UART5_RX PIN_UART5_RX_2
+#define PIN_UART5_TX PIN_UART5_TX_2
+#define PIN_I2C0_SDA PIN_I2C0_SDA_3
+#define PIN_I2C0_SCL PIN_I2C0_SCL_3
+
+/* Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ * -------------------- ------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * -------------------- ------------------------- -------- -------------------
+ * General Purpose TWRPI AN0 (J4 Pin 8) ? ADC0_DP0/ADC1_DP3
+ * TWRPI Socket TWRPI AN1 (J4 Pin 9) ? ADC0_DM0/ADC1_DM3
+ * TWRPI AN2 (J4 Pin 12) ? ADC1_DP0/ADC0_DP3
+ * TWRPI ID0 (J4 Pin 17) ? ADC0_DP1
+ * TWRPI ID1 (J4 Pin 18) ? ADC0_DM1
+ * TWRPI I2C SCL (J5 Pin 3) PTD8 I2C0_SCL
+ * TWRPI I2C SDA (J5 Pin 4) PTD9 I2C0_SDA
+ * TWRPI SPI MISO (J5 Pin 9) PTD14 SPI2_SIN
+ * TWRPI SPI MOSI (J5 Pin 10) PTD13 SPI2_SOUT
+ * TWRPI SPI SS (J5 Pin 11) PTD15 SPI2_PCS0
+ * TWRPI SPI CLK (J5 Pin 12) PTD12 SPI2_SCK
+ * TWRPI GPIO0 (J5 Pin 15) PTD10 PTD10
+ * TWRPI GPIO1 (J5 Pin 16) PTB8 PTB8
+ * TWRPI GPIO2 (J5 Pin 17) PTB9 PTB9
+ * TWRPI GPIO3 (J5 Pin 18) PTA19 PTA19
+ * TWRPI GPIO4 (J5 Pin 19) PTE26 PTE26
+ */
+
+#define PIN_SPI2_SIN PIN_SPI2_SIN_2
+#define PIN_SPI2_SOUT PIN_SPI2_SOUT_2
+#define PIN_SPI2_SCK PIN_SPI2_SCK_2
+
+/* Connections via the Tower Primary Connector Side A
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * A7 SCL0 PTD8
+ * A8 SDA0 PTD9
+ * A9 GPIO9 / CTS1 PTC19
+ * A10 GPIO8 / SDHC_D2 PTE5
+ * A11 GPIO7 / SD_WP_DET PTE27
+ * A13 ETH_MDC PTB1
+ * A14 ETH_MDIO PTB0
+ * A16 ETH_RXDV PTA14
+ * A19 ETH_RXD1 PTA12
+ * A20 ETH_RXD0 PTA13
+ * A21 SSI_MCLK PTE6
+ * A22 SSI_BCLK PTE12
+ * A23 SSI_FS PTE11
+ * A24 SSI_RXD PTE7
+ * A25 SSI_TXD PTE10
+ * A27 AN3 PGA0_DP/ADC0_DP0/ADC1_DP3
+ * A28 AN2 PGA0_DM/ADC0_DM0/ADC1_DM3
+ * A29 AN1 PGA1_DP/ADC1_DP0/ADC0_DP3
+ * A30 AN0 PGA1_DM/ADC1_DM0/ADC0_DM3
+ * A33 TMR1 PTA9
+ * A34 TMR0 PTA8
+ * A35 GPIO6 PTB9
+ * A37 PWM3 PTA6
+ * A38 PWM2 PTC3
+ * A39 PWM1 PTC2
+ * A40 PWM0 PTC1
+ * A41 RXD0 PTE25
+ * A42 TXD0 PTE24
+ * A43 RXD1 PTC16
+ * A44 TXD1 PTC17
+ * A64 CLKOUT0 PTC3
+ * A66 EBI_AD14 PTC0
+ * A67 EBI_AD13 PTC1
+ * A68 EBI_AD12 PTC2
+ * A69 EBI_AD11 PTC4
+ * A70 EBI_AD10 PTC5
+ * A71 EBI_AD9 PTC6
+ * A71 EBI_R/W_b PTC11
+ * A72 EBI_AD8 PTC7
+ * A73 EBI_AD7 PTC8
+ * A74 EBI_AD6 PTC9
+ * A75 EBI_AD5 PTC10
+ * A76 EBI_AD4 PTD2
+ * A77 EBI_AD3 PTD3
+ * A78 EBI_AD2 PTD4
+ * A79 EBI_AD1 PTD5
+ * A80 EBI_AD0 PTD6
+ */
+
+/* PTE 26/27 */
+
+#define PIN_UART3_RX PIN_UART3_RX_2
+#define PIN_UART3_TX PIN_UART3_TX_2
+
+/* PTE 24/25 */
+
+#define PIN_UART4_RX PIN_UART4_RX_2
+#define PIN_UART4_TX PIN_UART4_TX_2
+
+/* Connections via the Tower Primary Connector Side B
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * B7 SDHC_CLK / SPI1_CLK PTE2
+ * B9 SDHC_D3 / SPI1_CS0_b PTE4
+ * B10 SDHC_CMD / SPI1_MOSI PTE1
+ * B11 SDHC_D0 / SPI1_MISO PTE3
+ * B13 ETH_RXER PTA5
+ * B15 ETH_TXEN PTA15
+ * B19 ETH_TXD1 PTA17
+ * B20 ETH_TXD0 PTA16
+ * B21 GPIO1 / RTS1 PTC18
+ * B22 GPIO2 / SDHC_D1 PTE0
+ * B23 GPIO3 PTE28
+ * B24 CLKIN0 PTA18
+ * B25 CLKOUT1 PTE26
+ * B27 AN7 PTB7
+ * B28 AN6 PTB6
+ * B29 AN5 PTB5
+ * B30 AN4 PTB4
+ * B34 TMR2 PTD6
+ * B35 GPIO4 PTB8
+ * B37 PWM7 PTA2
+ * B38 PWM6 PTA1
+ * B39 PWM5 PTD5
+ * B40 PWM4 PTA7
+ * B41 CANRX0 PTE25
+ * B42 CANTX0 PTE24
+ * B44 SPI0_MISO PTD14
+ * B45 SPI0_MOSI PTD13
+ * B46 SPI0_CS0_b PTD11
+ * B47 SPI0_CS1_b PTD15
+ * B48 SPI0_CLK PTD12
+ * B50 SCL1 PTD8
+ * B51 SDA1 PTD9
+ * B52 GPIO5 / SD_CARD_DET PTE28
+ * B55 IRQ_H PTA24
+ * B56 IRQ_G PTA24
+ * B57 IRQ_F PTA25
+ * B58 IRQ_E PTA25
+ * B59 IRQ_D PTA26
+ * B60 IRQ_C PTA26
+ * B61 IRQ_B PTA27
+ * B62 IRQ_A PTA27
+ * B63 EBI_ALE / EBI_CS1_b PTD0
+ * B64 EBI_CS0_b PTD1
+ * B66 EBI_AD15 PTB18
+ * B67 EBI_AD16 PTB17
+ * B68 EBI_AD17 PTB16
+ * B69 EBI_AD18 PTB11
+ * B70 EBI_AD19 PTB10
+ * B72 EBI_OE_b PTB19
+ * B73 EBI_D7 PTB20
+ * B74 EBI_D6 PTB21
+ * B75 EBI_D5 PTB22
+ * B76 EBI_D4 PTB23
+ * B77 EBI_D3 PTC12
+ * B78 EBI_D2 PTC13
+ * B79 EBI_D1 PTC14
+ * B80 EBI_D0 PTC15
+ */
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/twr-k60n512/nsh/Make.defs b/nuttx/configs/twr-k60n512/nsh/Make.defs
new file mode 100644
index 000000000..c055c9b45
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/nsh/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/twr-k60n512/nsh/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_KINETIS_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+endif
+ifeq ($(CONFIG_KINETIS_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_KINETIS_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+endif
+ifeq ($(CONFIG_KINETIS_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft -mlong-calls
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/twr-k60n512/nsh/appconfig b/nuttx/configs/twr-k60n512/nsh/appconfig
new file mode 100644
index 000000000..456ddc8e9
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/nsh/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/twr-k60n512/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/twr-k60n512/nsh/defconfig b/nuttx/configs/twr-k60n512/nsh/defconfig
new file mode 100644
index 000000000..0f91b6721
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/nsh/defconfig
@@ -0,0 +1,465 @@
+############################################################################
+# configs/twr-k60n512/nsh/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="kinetis"
+CONFIG_ARCH_CHIP_MK60N512VMD100=y
+CONFIG_ARCH_BOARD="twr-k60n512"
+CONFIG_ARCH_BOARD_TWR_K60N512=y
+CONFIG_BOARD_LOOPSPERMSEC=9535
+CONFIG_DRAM_START=0x1fff0000
+CONFIG_DRAM_SIZE=131072
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_KINETIS_CODESOURCERYW=n
+CONFIG_KINETIS_CODESOURCERYL=n
+CONFIG_KINETIS_DEVKITARM=n
+CONFIG_KINETIS_BUILDROOT=y
+CONFIG_KINETIS_DFU=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_KINETIS_TRACE=n
+CONFIG_KINETIS_FLEXBUS=n
+CONFIG_KINETIS_UART0=n
+CONFIG_KINETIS_UART1=n
+CONFIG_KINETIS_UART2=n
+CONFIG_KINETIS_UART3=y
+CONFIG_KINETIS_UART4=n
+CONFIG_KINETIS_UART5=n
+CONFIG_KINETIS_ENET=n
+CONFIG_KINETIS_RNGB=n
+CONFIG_KINETIS_FLEXCAN0=n
+CONFIG_KINETIS_FLEXCAN1=n
+CONFIG_KINETIS_SPI0=n
+CONFIG_KINETIS_SPI1=n
+CONFIG_KINETIS_SPI2=n
+CONFIG_KINETIS_I2C0=n
+CONFIG_KINETIS_I2C1=n
+CONFIG_KINETIS_I2S=n
+CONFIG_KINETIS_DAC0=n
+CONFIG_KINETIS_DAC1=n
+CONFIG_KINETIS_ADC0=n
+CONFIG_KINETIS_ADC1=n
+CONFIG_KINETIS_CMP=n
+CONFIG_KINETIS_VREF=n
+CONFIG_KINETIS_SDHC=n
+CONFIG_KINETIS_FTM0=n
+CONFIG_KINETIS_FTM1=n
+CONFIG_KINETIS_FTM2=n
+CONFIG_KINETIS_LPTIMER=n
+CONFIG_KINETIS_RTC=n
+CONFIG_KINETIS_SLCD=n
+CONFIG_KINETIS_EWM=n
+CONFIG_KINETIS_CMT=n
+CONFIG_KINETIS_USBOTG=n
+CONFIG_KINETIS_USBDCD=n
+CONFIG_KINETIS_LLWU=n
+CONFIG_KINETIS_TSI=n
+CONFIG_KINETIS_FTFL=n
+CONFIG_KINETIS_DMA=n
+CONFIG_KINETIS_CRC=n
+CONFIG_KINETIS_PDB=n
+CONFIG_KINETIS_PIT=n
+CONFIG_ARMV7M_MPU=n
+
+#
+# PIN Interrupt Support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_KINETIS_PORTAINTS=n
+CONFIG_KINETIS_PORTBINTS=n
+CONFIG_KINETIS_PORTCINTS=n
+CONFIG_KINETIS_PORTDINTS=n
+CONFIG_KINETIS_PORTEINTS=n
+
+#
+# K40X256VLQ100 specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_SDIO_XFRDEBUG=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_BOOT_RAMFUNCS=y
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/twr-k60n512/nsh/ld.script b/nuttx/configs/twr-k60n512/nsh/ld.script
new file mode 100644
index 000000000..e8e5e7de1
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/nsh/ld.script
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * configs/twr-k60n512/nsh/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The K60N512VMD100 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 128Kb of SRAM beginning at address 0x1800:0000 (SRAM_L) and 0x2000:000
+ * (SRAM_U).
+ *
+ * NOTE: that the first part of the K40 FLASH region is reserved for
+ * interrupt vectflash and, following that, is a region from 0x0000:0400
+ * to 0x0000:040f that is reserved for the FLASH control fields (FCF).
+ *
+ * NOTE: The on-chip RAM is split evenly among SRAM_L and SRAM_U. The RAM is
+ * also implemented such that the SRAM_L and SRAM_U ranges form a
+ * contiguous block in the memory map.
+ */
+
+MEMORY
+{
+ vectflash (rx) : ORIGIN = 0x00000000, LENGTH = 1K - 16
+ cfmprotect (rx) : ORIGIN = 0x00000400, LENGTH = 16
+ progflash (rx) : ORIGIN = 0x00000800, LENGTH = 512K - 2K
+ datasram (rwx) : ORIGIN = 0x1fff0000, LENGTH = 128K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectflash
+
+ .cfmprotect : {
+ *(.cfmconfig)
+ } > cfmprotect
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > progflash
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _eronly = LOADADDR(.data);
+
+ .ramfunc ALIGN(4): {
+ _sramfuncs = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfuncs = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _framfuncs = LOADADDR(.ramfunc);
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > datasram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > datasram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > datasram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/twr-k60n512/nsh/setenv.sh b/nuttx/configs/twr-k60n512/nsh/setenv.sh
new file mode 100644
index 000000000..a780a15a7
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/nsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/twr-k60n512/nsh/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/twr-k60n512/ostest/Make.defs b/nuttx/configs/twr-k60n512/ostest/Make.defs
new file mode 100644
index 000000000..8c4a629bb
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/ostest/Make.defs
@@ -0,0 +1,163 @@
+############################################################################
+# configs/twr-k60n512/ostest/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_KINETIS_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+endif
+ifeq ($(CONFIG_KINETIS_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_KINETIS_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mlong-calls
+endif
+ifeq ($(CONFIG_KINETIS_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft -mlong-calls
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/twr-k60n512/ostest/appconfig b/nuttx/configs/twr-k60n512/ostest/appconfig
new file mode 100644
index 000000000..d1ec3edb2
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/twr-k60n512/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/twr-k60n512/ostest/defconfig b/nuttx/configs/twr-k60n512/ostest/defconfig
new file mode 100644
index 000000000..461b795f1
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/ostest/defconfig
@@ -0,0 +1,462 @@
+############################################################################
+# configs/twr-k60n512/ostest/defconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM4=y
+CONFIG_ARCH_CHIP="kinetis"
+CONFIG_ARCH_CHIP_MK60N512VMD100=y
+CONFIG_ARCH_BOARD="twr-k60n512"
+CONFIG_ARCH_BOARD_TWR_K60N512=y
+CONFIG_BOARD_LOOPSPERMSEC=9535
+CONFIG_DRAM_START=0x1fff0000
+CONFIG_DRAM_SIZE=131072
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_KINETIS_CODESOURCERYW=n
+CONFIG_KINETIS_CODESOURCERYL=n
+CONFIG_KINETIS_DEVKITARM=n
+CONFIG_KINETIS_BUILDROOT=y
+CONFIG_KINETIS_DFU=y
+
+#
+# Individual subsystems can be enabled:
+#
+CONFIG_KINETIS_TRACE=n
+CONFIG_KINETIS_FLEXBUS=n
+CONFIG_KINETIS_UART0=n
+CONFIG_KINETIS_UART1=n
+CONFIG_KINETIS_UART2=n
+CONFIG_KINETIS_UART3=y
+CONFIG_KINETIS_UART4=n
+CONFIG_KINETIS_UART5=n
+CONFIG_KINETIS_ENET=n
+CONFIG_KINETIS_RNGB=n
+CONFIG_KINETIS_FLEXCAN0=n
+CONFIG_KINETIS_FLEXCAN1=n
+CONFIG_KINETIS_SPI0=n
+CONFIG_KINETIS_SPI1=n
+CONFIG_KINETIS_SPI2=n
+CONFIG_KINETIS_I2C0=n
+CONFIG_KINETIS_I2C1=n
+CONFIG_KINETIS_I2S=n
+CONFIG_KINETIS_DAC0=n
+CONFIG_KINETIS_DAC1=n
+CONFIG_KINETIS_ADC0=n
+CONFIG_KINETIS_ADC1=n
+CONFIG_KINETIS_CMP=n
+CONFIG_KINETIS_VREF=n
+CONFIG_KINETIS_SDHC=n
+CONFIG_KINETIS_FTM0=n
+CONFIG_KINETIS_FTM1=n
+CONFIG_KINETIS_FTM2=n
+CONFIG_KINETIS_LPTIMER=n
+CONFIG_KINETIS_RTC=n
+CONFIG_KINETIS_SLCD=n
+CONFIG_KINETIS_EWM=n
+CONFIG_KINETIS_CMT=n
+CONFIG_KINETIS_USBOTG=n
+CONFIG_KINETIS_USBDCD=n
+CONFIG_KINETIS_LLWU=n
+CONFIG_KINETIS_TSI=n
+CONFIG_KINETIS_FTFL=n
+CONFIG_KINETIS_DMA=n
+CONFIG_KINETIS_CRC=n
+CONFIG_KINETIS_PDB=n
+CONFIG_KINETIS_PIT=n
+CONFIG_ARMV7M_MPU=n
+
+#
+# PIN Interrupt Support
+#
+CONFIG_GPIO_IRQ=n
+CONFIG_KINETIS_PORTAINTS=n
+CONFIG_KINETIS_PORTBINTS=n
+CONFIG_KINETIS_PORTCINTS=n
+CONFIG_KINETIS_PORTDINTS=n
+CONFIG_KINETIS_PORTEINTS=n
+
+#
+# K40X256VLQ100 specific serial device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=n
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART2_SERIAL_CONSOLE=n
+CONFIG_UART3_SERIAL_CONSOLE=y
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+CONFIG_UART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+CONFIG_UART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+CONFIG_UART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+CONFIG_UART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_UART0_PARITY=0
+CONFIG_UART2_PARITY=0
+CONFIG_UART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=9
+CONFIG_START_DAY=21
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=n
+CONFIG_FAT_LFN=n
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_BOOT_RAMFUNCS=y
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/twr-k60n512/ostest/ld.script b/nuttx/configs/twr-k60n512/ostest/ld.script
new file mode 100644
index 000000000..717a45747
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/ostest/ld.script
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * configs/twr-k60n512/ostest/ld.script
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The K60N512VMD100 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 128Kb of SRAM beginning at address 0x1800:0000 (SRAM_L) and 0x2000:000
+ * (SRAM_U).
+ *
+ * NOTE: that the first part of the K40 FLASH region is reserved for
+ * interrupt vectflash and, following that, is a region from 0x0000:0400
+ * to 0x0000:040f that is reserved for the FLASH control fields (FCF).
+ *
+ * NOTE: The on-chip RAM is split evenly among SRAM_L and SRAM_U. The RAM is
+ * also implemented such that the SRAM_L and SRAM_U ranges form a
+ * contiguous block in the memory map.
+ */
+
+MEMORY
+{
+ vectflash (rx) : ORIGIN = 0x00000000, LENGTH = 1K - 16
+ cfmprotect (rx) : ORIGIN = 0x00000400, LENGTH = 16
+ progflash (rx) : ORIGIN = 0x00000800, LENGTH = 512K - 2K
+ datasram (rwx) : ORIGIN = 0x1fff0000, LENGTH = 128K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .vectors : {
+ _svectors = ABSOLUTE(.);
+ *(.vectors)
+ _evectors = ABSOLUTE(.);
+ } > vectflash
+
+ .cfmprotect : {
+ *(.cfmconfig)
+ } > cfmprotect
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > progflash
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _eronly = LOADADDR(.data);
+
+ .ramfunc ALIGN(4): {
+ _sramfuncs = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfuncs = ABSOLUTE(.);
+ } > datasram AT > progflash
+
+ _framfuncs = LOADADDR(.ramfunc);
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > datasram
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > datasram
+ __exidx_end = ABSOLUTE(.);
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > datasram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/twr-k60n512/ostest/setenv.sh b/nuttx/configs/twr-k60n512/ostest/setenv.sh
new file mode 100644
index 000000000..86b6099dc
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/twr-k60n512/ostest/setenv.sh
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+# This the Cygwin path to the location where I installed the CodeSourcery
+# toolchain under windows. You will also have to edit this if you install
+# the CodeSourcery toolchain in any other location
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
+
+# This the Cygwin path to the location where I build the buildroot
+# toolchain.
+export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/twr-k60n512/src/Makefile b/nuttx/configs/twr-k60n512/src/Makefile
new file mode 100644
index 000000000..6e43aa69a
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/Makefile
@@ -0,0 +1,105 @@
+############################################################################
+# configs/twr-k60n512/src/Makefile
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = up_boot.c up_spi.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += up_leds.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_USBDEV),y)
+CSRCS += up_usbdev.c
+endif
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += up_usbmsc.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/twr-k60n512/src/twrk60-internal.h b/nuttx/configs/twr-k60n512/src/twrk60-internal.h
new file mode 100644
index 000000000..9a8b16c9c
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/twrk60-internal.h
@@ -0,0 +1,309 @@
+/************************************************************************************
+ * configs/twr-k60n512/src/twrk60-internal.h
+ * arch/arm/src/board/twrk60-internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_TWR_K60N512_SRC_TWRK60_INTERNAL_H
+#define __CONFIGS_TWR_K60N512_SRC_TWRK60_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
+ * modules (others may support more -- in such case, the following must be
+ * expanded).
+ */
+
+#if KINETIS_NSPI < 1
+# undef CONFIG_KINETIS_SPI1
+# undef CONFIG_KINETIS_SPI2
+#elif KINETIS_NSPI < 2
+# undef CONFIG_KINETIS_SPI2
+#endif
+
+/* TWR-K60N512 GPIOs ****************************************************************/
+/* On-Board Connections
+ * -------------------- ------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * -------------------- ------------------------- -------- -------------------
+ * OSJTAG USB-to-serial OSJTAG Bridge RX Data PTE9 UART5_RX
+ * Bridge OSJTAG Bridge TX Data PTE8 UART5_TX
+ * SD Card Slot SD Clock PTE2 SDHC0_DCLK
+ * SD Command PTE3 SDHC0_CMD
+ * SD Data0 PTE1 SDHC0_D0
+ * SD Data1 PTE0 SDHC0_D1
+ * SD Data2 PTE5 SDHC0_D2
+ * SD Data3 PTE4 SDHC0_D3
+ * SD Card Detect PTE28 PTE28
+ * SD Write Protect PTE27 PTE27
+ * Infrared Port IR Transmit PTD7 CMT_IRO
+ * IR Receive PTC6 CMP0_IN0
+ * Pushbuttons SW1 (IRQ0) PTA19 PTA19
+ * SW2 (IRQ1) PTE26 PTE26
+ * SW3 (RESET) RESET_b RESET_b
+ * Touch Pads E1 / Touch PTA4 TSI0_CH5
+ * E2 / Touch PTB3 TSI0_CH8
+ * E3 / Touch PTB2 TSI0_CH7
+ * E4 / Touch PTB16 TSI0_CH9
+ * LEDs E1 / Orange LED PTA11 PTA11
+ * E2 / Yellow LED PTA28 PTA28
+ * E3 / Green LED PTA29 PTA29
+ * E4 / Blue LED PTA10 PTA10
+ * Potentiometer Potentiometer (R71) ? ADC1_DM1
+ * Accelerometer I2C SDA PTD9 I2C0_SDA
+ * I2C SCL PTD8 I2C0_SCL
+ * IRQ PTD10 PTD10
+ * Touch Pad / Segment Electrode 0 (J3 Pin 3) PTB0 TSI0_CH0
+ * LCD TWRPI Socket Electrode 1 (J3 Pin 5) PTB1 TSI0_CH6
+ * Electrode 2 (J3 Pin 7) PTB2 TSI0_CH7
+ * Electrode 3 (J3 Pin 8) PTB3 TSI0_CH8
+ * Electrode 4 (J3 Pin 9) PTC0 TSI0_CH13
+ * Electrode 5 (J3 Pin 10) PTC1 TSI0_CH14
+ * Electrode 6 (J3 Pin 11) PTC2 TSI0_CH15
+ * Electrode 7 (J3 Pin 12) PTA4 TSI0_CH5
+ * Electrode 8 (J3 Pin 13) PTB16 TSI0_CH9
+ * Electrode 9 (J3 Pin 14) PTB17 TSI0_CH10
+ * Electrode 10 (J3 Pin 15) PTB18 TSI0_CH11
+ * Electrode 11 (J3 Pin 16) PTB19 TSI0_CH12
+ * TWRPI ID0 (J3 Pin 17) ? ADC1_DP1
+ * TWRPI ID1 (J3 Pin 18) ? ADC1_SE16
+ */
+
+#define GPIO_SD_CARDDETECT (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTE | PIN28)
+#define GPIO_SD_WRPROTECT (GPIO_PULLUP | PIN_PORTE | PIN27)
+
+#define GPIO_SW1 (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTA | PIN19)
+#define GPIO_SW2 (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTE | PIN26)
+
+#define GPIO_LED1 (GPIO_LOWDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTA | PIN11)
+#define GPIO_LED2 (GPIO_LOWDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTA | PIN28)
+#define GPIO_LED3 (GPIO_LOWDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTA | PIN29)
+#define GPIO_LED4 (GPIO_LOWDRIVE | GPIO_OUTPUT_ZER0 | PIN_PORTA | PIN10)
+
+/* Connections via the General Purpose Tower Plug-in (TWRPI) Socket
+ * -------------------- ------------------------- -------- -------------------
+ * FEATURE CONNECTION PORT/PIN PIN FUNCTION
+ * -------------------- ------------------------- -------- -------------------
+ * General Purpose TWRPI AN0 (J4 Pin 8) ? ADC0_DP0/ADC1_DP3
+ * TWRPI Socket TWRPI AN1 (J4 Pin 9) ? ADC0_DM0/ADC1_DM3
+ * TWRPI AN2 (J4 Pin 12) ? ADC1_DP0/ADC0_DP3
+ * TWRPI ID0 (J4 Pin 17) ? ADC0_DP1
+ * TWRPI ID1 (J4 Pin 18) ? ADC0_DM1
+ * TWRPI I2C SCL (J5 Pin 3) PTD8 I2C0_SCL
+ * TWRPI I2C SDA (J5 Pin 4) PTD9 I2C0_SDA
+ * TWRPI SPI MISO (J5 Pin 9) PTD14 SPI2_SIN
+ * TWRPI SPI MOSI (J5 Pin 10) PTD13 SPI2_SOUT
+ * TWRPI SPI SS (J5 Pin 11) PTD15 SPI2_PCS0
+ * TWRPI SPI CLK (J5 Pin 12) PTD12 SPI2_SCK
+ * TWRPI GPIO0 (J5 Pin 15) PTD10 PTD10
+ * TWRPI GPIO1 (J5 Pin 16) PTB8 PTB8
+ * TWRPI GPIO2 (J5 Pin 17) PTB9 PTB9
+ * TWRPI GPIO3 (J5 Pin 18) PTA19 PTA19
+ * TWRPI GPIO4 (J5 Pin 19) PTE26 PTE26
+ */
+
+/* Connections via the Tower Primary Connector Side A
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * A7 SCL0 PTD8
+ * A8 SDA0 PTD9
+ * A9 GPIO9 / CTS1 PTC19
+ * A10 GPIO8 / SDHC_D2 PTE5
+ * A11 GPIO7 / SD_WP_DET PTE27
+ * A13 ETH_MDC PTB1
+ * A14 ETH_MDIO PTB0
+ * A16 ETH_RXDV PTA14
+ * A19 ETH_RXD1 PTA12
+ * A20 ETH_RXD0 PTA13
+ * A21 SSI_MCLK PTE6
+ * A22 SSI_BCLK PTE12
+ * A23 SSI_FS PTE11
+ * A24 SSI_RXD PTE7
+ * A25 SSI_TXD PTE10
+ * A27 AN3 PGA0_DP/ADC0_DP0/ADC1_DP3
+ * A28 AN2 PGA0_DM/ADC0_DM0/ADC1_DM3
+ * A29 AN1 PGA1_DP/ADC1_DP0/ADC0_DP3
+ * A30 AN0 PGA1_DM/ADC1_DM0/ADC0_DM3
+ * A33 TMR1 PTA9
+ * A34 TMR0 PTA8
+ * A35 GPIO6 PTB9
+ * A37 PWM3 PTA6
+ * A38 PWM2 PTC3
+ * A39 PWM1 PTC2
+ * A40 PWM0 PTC1
+ * A41 RXD0 PTE25
+ * A42 TXD0 PTE24
+ * A43 RXD1 PTC16
+ * A44 TXD1 PTC17
+ * A64 CLKOUT0 PTC3
+ * A66 EBI_AD14 PTC0
+ * A67 EBI_AD13 PTC1
+ * A68 EBI_AD12 PTC2
+ * A69 EBI_AD11 PTC4
+ * A70 EBI_AD10 PTC5
+ * A71 EBI_AD9 PTC6
+ * A71 EBI_R/W_b PTC11
+ * A72 EBI_AD8 PTC7
+ * A73 EBI_AD7 PTC8
+ * A74 EBI_AD6 PTC9
+ * A75 EBI_AD5 PTC10
+ * A76 EBI_AD4 PTD2
+ * A77 EBI_AD3 PTD3
+ * A78 EBI_AD2 PTD4
+ * A79 EBI_AD1 PTD5
+ * A80 EBI_AD0 PTD6
+ */
+
+/* Connections via the Tower Primary Connector Side B
+ * --- -------------------- --------------------------------
+ * PIN NAME USAGE
+ * --- -------------------- --------------------------------
+ * B7 SDHC_CLK / SPI1_CLK PTE2
+ * B9 SDHC_D3 / SPI1_CS0_b PTE4
+ * B10 SDHC_CMD / SPI1_MOSI PTE1
+ * B11 SDHC_D0 / SPI1_MISO PTE3
+ * B13 ETH_RXER PTA5
+ * B15 ETH_TXEN PTA15
+ * B19 ETH_TXD1 PTA17
+ * B20 ETH_TXD0 PTA16
+ * B21 GPIO1 / RTS1 PTC18
+ * B22 GPIO2 / SDHC_D1 PTE0
+ * B23 GPIO3 PTE28
+ * B24 CLKIN0 PTA18
+ * B25 CLKOUT1 PTE26
+ * B27 AN7 PTB7
+ * B28 AN6 PTB6
+ * B29 AN5 PTB5
+ * B30 AN4 PTB4
+ * B34 TMR2 PTD6
+ * B35 GPIO4 PTB8
+ * B37 PWM7 PTA2
+ * B38 PWM6 PTA1
+ * B39 PWM5 PTD5
+ * B40 PWM4 PTA7
+ * B41 CANRX0 PTE25
+ * B42 CANTX0 PTE24
+ * B44 SPI0_MISO PTD14
+ * B45 SPI0_MOSI PTD13
+ * B46 SPI0_CS0_b PTD11
+ * B47 SPI0_CS1_b PTD15
+ * B48 SPI0_CLK PTD12
+ * B50 SCL1 PTD8
+ * B51 SDA1 PTD9
+ * B52 GPIO5 / SD_CARD_DET PTE28
+ * B55 IRQ_H PTA24
+ * B56 IRQ_G PTA24
+ * B57 IRQ_F PTA25
+ * B58 IRQ_E PTA25
+ * B59 IRQ_D PTA26
+ * B60 IRQ_C PTA26
+ * B61 IRQ_B PTA27
+ * B62 IRQ_A PTA27
+ * B63 EBI_ALE / EBI_CS1_b PTD0
+ * B64 EBI_CS0_b PTD1
+ * B66 EBI_AD15 PTB18
+ * B67 EBI_AD16 PTB17
+ * B68 EBI_AD17 PTB16
+ * B69 EBI_AD18 PTB11
+ * B70 EBI_AD19 PTB10
+ * B72 EBI_OE_b PTB19
+ * B73 EBI_D7 PTB20
+ * B74 EBI_D6 PTB21
+ * B75 EBI_D5 PTB22
+ * B76 EBI_D4 PTB23
+ * B77 EBI_D3 PTC12
+ * B78 EBI_D2 PTC13
+ * B79 EBI_D1 PTC14
+ * B80 EBI_D0 PTC15
+ */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Initialize LED GPIOs so that LEDs can be controlled.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+extern void up_ledinit(void);
+#endif
+
+/************************************************************************************
+ * Name: kinetis_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the TWR-K60N512 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function kinetis_spiinitialize(void);
+
+/************************************************************************************
+ * Name: kinetis_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the TWR-K60N512 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function kinetis_usbinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_TWR_K60N512_SRC_TWRK60_INTERNAL_H */
+
diff --git a/nuttx/configs/twr-k60n512/src/up_boot.c b/nuttx/configs/twr-k60n512/src/up_boot.c
new file mode 100644
index 000000000..d811658c3
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_boot.c
@@ -0,0 +1,102 @@
+/************************************************************************************
+ * configs/twr-k60n512/src/up_boot.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "twrk60-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All Kinetis architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void kinetis_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * kinetis_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
+ if (kinetis_spiinitialize)
+ {
+ kinetis_spiinitialize();
+ }
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function kinetis_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_KINETIS_USB)
+ if (kinetis_usbinitialize)
+ {
+ kinetis_usbinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/twr-k60n512/src/up_buttons.c b/nuttx/configs/twr-k60n512/src/up_buttons.c
new file mode 100644
index 000000000..5b449dbe8
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_buttons.c
@@ -0,0 +1,168 @@
+/****************************************************************************
+ * configs/twr-k60n512/src/up_buttons.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/board/board.h>
+#include "twrk60-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* The TWR-K60N512 has user buttons (plus a reset button):
+ *
+ * 1. SW1 (IRQ0) PTA19
+ * 2. SW2 (IRQ1) PTE26
+ */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ /* Configure the two buttons as inputs */
+
+ kinetis_pinconfig(GPIO_SW1);
+ kinetis_pinconfig(GPIO_SW2);
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+
+ if (kinetis_gpioread(GPIO_SW1))
+ {
+ ret |= BUTTON_SW1_BIT;
+ }
+
+ if (kinetis_gpioread(GPIO_SW2))
+ {
+ ret |= BUTTON_SW2_BIT;
+ }
+
+ return ret
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it may
+ * restored, if so desired).
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+ uint32_t pinset;
+
+ /* Map the button id to the GPIO bit set. */
+
+ if (id == BUTTON_SW1)
+ {
+ pinset = GPIO_SW1;
+ }
+ else if (id == BUTTON_SW2)
+ {
+ pinset = GPIO_SW2;
+ }
+ else
+ {
+ return NULL;
+ }
+
+ /* The button has already been configured as an interrupting input (by
+ * up_buttoninit() above).
+ *
+ * Attach the new button handler.
+ */
+
+ oldhandler = knetis_pinirqattach(pinset, irqhandler);
+
+ /* Then make sure that interupts are enabled on the pin */
+
+ kinetis_pindmaenable(pinset);
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/twr-k60n512/src/up_leds.c b/nuttx/configs/twr-k60n512/src/up_leds.c
new file mode 100644
index 000000000..df7aeeaa5
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_leds.c
@@ -0,0 +1,263 @@
+/****************************************************************************
+ * configs/twr-k60n512/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "kinetis_internal.h"
+#include "twrk60-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* The TWR-K60N512 has four LEDs:
+ *
+ * 1. E1 / Orange LED PTA11
+ * 2. E2 / Yellow LED PTA28
+ * 3. E3 / Green LED PTA29
+ * 4 E4 / Blue LED PTA10
+ */
+
+/* The following definitions map the encoded LED setting to GPIO settings */
+
+#define K60_LED1 (1 << 0)
+#define K60_LED2 (1 << 1)
+#define K60_LED3 (1 << 2)
+#define K60_LED4 (1 << 3)
+
+#define ON_SETBITS_SHIFT (0)
+#define ON_CLRBITS_SHIFT (4)
+#define OFF_SETBITS_SHIFT (8)
+#define OFF_CLRBITS_SHIFT (12)
+
+#define ON_BITS(v) ((v) & 0xff)
+#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
+#define SETBITS(b) ((b) & 0x0f)
+#define CLRBITS(b) (((b) >> 4) & 0x0f)
+
+#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
+#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
+#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
+#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
+
+#define LED_STARTED_ON_SETBITS ((K60_LED1) << ON_SETBITS_SHIFT)
+#define LED_STARTED_ON_CLRBITS ((K60_LED2|K60_LED3|K60_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
+#define LED_STARTED_OFF_CLRBITS ((K60_LED1|K60_LED2|K60_LED3|K60_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_HEAPALLOCATE_ON_SETBITS ((K60_LED2) << ON_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_ON_CLRBITS ((K60_LED1|K60_LED3|K60_LED4) << ON_CLRBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_SETBITS ((K60_LED1) << OFF_SETBITS_SHIFT)
+#define LED_HEAPALLOCATE_OFF_CLRBITS ((K60_LED2|K60_LED3|K60_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_IRQSENABLED_ON_SETBITS ((K60_LED1|K60_LED2) << ON_SETBITS_SHIFT)
+#define LED_IRQSENABLED_ON_CLRBITS ((K60_LED3|K60_LED4) << ON_CLRBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_SETBITS ((K60_LED2) << OFF_SETBITS_SHIFT)
+#define LED_IRQSENABLED_OFF_CLRBITS ((K60_LED1|K60_LED3|K60_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_STACKCREATED_ON_SETBITS ((K60_LED3) << ON_SETBITS_SHIFT)
+#define LED_STACKCREATED_ON_CLRBITS ((K60_LED1|K60_LED2|K60_LED4) << ON_CLRBITS_SHIFT)
+#define LED_STACKCREATED_OFF_SETBITS ((K60_LED1|K60_LED2) << OFF_SETBITS_SHIFT)
+#define LED_STACKCREATED_OFF_CLRBITS ((K60_LED3|K60_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_INIRQ_ON_SETBITS ((K60_LED1) << ON_SETBITS_SHIFT)
+#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_INIRQ_OFF_CLRBITS ((K60_LED1) << OFF_CLRBITS_SHIFT)
+
+#define LED_SIGNAL_ON_SETBITS ((K60_LED2) << ON_SETBITS_SHIFT)
+#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_SIGNAL_OFF_CLRBITS ((K60_LED2) << OFF_CLRBITS_SHIFT)
+
+#define LED_ASSERTION_ON_SETBITS ((K60_LED4) << ON_SETBITS_SHIFT)
+#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_ASSERTION_OFF_CLRBITS ((K60_LED4) << OFF_CLRBITS_SHIFT)
+
+#define LED_PANIC_ON_SETBITS ((K60_LED4) << ON_SETBITS_SHIFT)
+#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
+#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
+#define LED_PANIC_OFF_CLRBITS ((K60_LED4) << OFF_CLRBITS_SHIFT)
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16_t g_ledbits[8] =
+{
+ (LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
+ LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
+
+ (LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
+ LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
+
+ (LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
+ LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
+
+ (LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
+ LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
+
+ (LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
+ LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
+
+ (LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
+ LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
+
+ (LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
+ LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
+
+ (LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
+ LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static inline void led_clrbits(unsigned int clrbits)
+{
+ if ((clrbits & K60_LED1) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED1, false);
+ }
+
+ if ((clrbits & K60_LED2) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED2, false);
+ }
+
+ if ((clrbits & K60_LED3) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED3, false);
+ }
+
+ if ((clrbits & K60_LED4) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED4, false);
+ }
+}
+
+static inline void led_setbits(unsigned int setbits)
+{
+ if ((setbits & K60_LED1) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED1, true);
+ }
+
+ if ((setbits & K60_LED2) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED2, true);
+ }
+
+ if ((setbits & K60_LED3) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED3, true);
+ }
+
+ if ((setbits & K60_LED4) != 0)
+ {
+ kinetis_gpiowrite(GPIO_LED4, true);
+ }
+}
+
+static void led_setonoff(unsigned int bits)
+{
+ led_clrbits(CLRBITS(bits));
+ led_setbits(SETBITS(bits));
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ *
+ * Description:
+ * Initialize LED GPIOs so that LEDs can be controlled.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* Configure LED1-4 GPIOs for output */
+
+ kinetis_pinconfig(GPIO_LED1);
+ kinetis_pinconfig(GPIO_LED2);
+ kinetis_pinconfig(GPIO_LED3);
+ kinetis_pinconfig(GPIO_LED4);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ led_setonoff(ON_BITS(g_ledbits[led]));
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ led_setonoff(OFF_BITS(g_ledbits[led]));
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/twr-k60n512/src/up_nsh.c b/nuttx/configs/twr-k60n512/src/up_nsh.c
new file mode 100644
index 000000000..3bb4e8527
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_nsh.c
@@ -0,0 +1,267 @@
+/****************************************************************************
+ * config/twr-k60n512/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#ifdef CONFIG_KINETIS_SDHC
+# include <nuttx/sdio.h>
+# include <nuttx/mmcsd.h>
+#endif
+
+#include "kinetis_internal.h"
+#include "twrk60-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* PORT and SLOT number probably depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_TWR_K60N512
+# define NSH_HAVEUSBDEV 1
+# define NSH_HAVEMMCSD 1
+# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
+# error "Only one MMC/SD slot, slot 0"
+# undef CONFIG_NSH_MMCSDSLOTNO
+# endif
+# ifndef CONFIG_NSH_MMCSDSLOTNO
+# define CONFIG_NSH_MMCSDSLOTNO 0
+# endif
+#else
+ /* Add configuration for new Kinetis boards here */
+# error "Unrecognized Kinetis board"
+# undef NSH_HAVEUSBDEV
+# undef NSH_HAVEMMCSD
+#endif
+
+/* Can't support USB features if USB is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef NSH_HAVEUSBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints are disabled or if SDHC support
+ * is not enabled.
+ */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC)
+# undef NSH_HAVEMMCSD
+#endif
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+# define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+/* We expect to receive GPIO interrupts for card insertion events */
+
+#ifndef CONFIG_GPIO_IRQ
+# error "CONFIG_GPIO_IRQ required for card detect interrupt"
+#endif
+
+#ifndef CONFIG_KINETIS_PORTEINTS
+# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* This structure encapsulates the global variable used in this file and
+ * reduces the probability of name collistions.
+ */
+
+#ifdef NSH_HAVEMMCSD
+struct kinetis_nsh_s
+{
+ FAR struct sdio_dev_s *sdhc; /* SDIO driver handle */
+ bool inserted; /* True: card is inserted */
+};
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static struct kinetis_nsh_s g_nsh;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: kinetis_mediachange
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static void kinetis_mediachange(void)
+{
+ bool inserted;
+
+ /* Get the current value of the card detect pin. This pin is pulled up on
+ * board. So low means that a card is present.
+ */
+
+ inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
+
+ /* Has the pin changed state? */
+
+ if (inserted != g_nsh.inserted)
+ {
+ /* Yes.. perform the appropriate action (this might need some debounce). */
+
+ g_nsh.inserted = inserted;
+ sdhc_mediachange(g_nsh.sdhc, inserted);
+
+ /* If the card has been inserted, then check if it is write protected
+ * as well. The pin is pulled up, but apparently logic high means
+ * write protected.
+ */
+
+ if (inserted)
+ {
+ sdhc_wrprotect(g_nsh.sdhc, kinetis_gpioread(GPIO_SD_WRPROTECT));
+ }
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: kinetis_cdinterrupt
+ ****************************************************************************/
+
+#ifdef NSH_HAVEMMCSD
+static int kinetis_cdinterrupt(int irq, FAR void *context)
+{
+ /* All of the work is done by kinetis_mediachange() */
+
+ kinetis_mediachange();
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+#ifdef NSH_HAVEMMCSD
+ int ret;
+
+ /* Configure GPIO pins */
+
+ /* Attached the card detect interrupt (but don't enable it yet) */
+
+ kinetis_pinconfig(GPIO_SD_CARDDETECT);
+ kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt);
+
+ /* Configure the write protect GPIO */
+
+ kinetis_pinconfig(GPIO_SD_WRPROTECT);
+
+ /* Mount the SDHC-based MMC/SD block driver */
+ /* First, get an instance of the SDHC interface */
+
+ message("nsh_archinitialize: Initializing SDHC slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+
+ g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO);
+ if (!g_nsh.sdhc)
+ {
+ message("nsh_archinitialize: Failed to initialize SDHC slot %d\n",
+ CONFIG_NSH_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDHC interface to the MMC/SD driver */
+
+ message("nsh_archinitialize: Bind SDHC to the MMC/SD driver, minor=%d\n",
+ CONFIG_NSH_MMCSDMINOR);
+
+ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc);
+ if (ret != OK)
+ {
+ message("nsh_archinitialize: Failed to bind SDHC to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+ message("nsh_archinitialize: Successfully bound SDHC to the MMC/SD driver\n");
+
+ /* Handle the initial card state */
+
+ kinetis_mediachange();
+
+ /* Enable CD interrupts to handle subsequent media changes */
+
+ kinetis_pinirqenable(GPIO_SD_CARDDETECT);
+#endif
+ return OK;
+}
diff --git a/nuttx/configs/twr-k60n512/src/up_spi.c b/nuttx/configs/twr-k60n512/src/up_spi.c
new file mode 100644
index 000000000..074dc5cd7
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_spi.c
@@ -0,0 +1,164 @@
+/************************************************************************************
+ * configs/twr-k60n512/src/up_spi.c
+ * arch/arm/src/board/up_spi.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/spi.h>
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "kinetis_internal.h"
+#include "twrk60-internal.h"
+
+#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#ifdef CONFIG_DEBUG_SPI
+# define spidbg lldbg
+# ifdef CONFIG_DEBUG_SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the TWR-K60N512 board.
+ *
+ ************************************************************************************/
+
+void weak_function kinetis_spiinitialize(void)
+{
+# warning "Missing logic"
+}
+
+/****************************************************************************
+ * Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
+ *
+ * Description:
+ * The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common Kinetis logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_SPI1
+void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_KINETIS_SPI2
+void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#ifdef CONFIG_KINETIS_SPI3
+void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+# warning "Missing logic"
+}
+
+uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+# warning "Missing logic"
+ return SPI_STATUS_PRESENT;
+}
+#endif
+
+#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
diff --git a/nuttx/configs/twr-k60n512/src/up_usbdev.c b/nuttx/configs/twr-k60n512/src/up_usbdev.c
new file mode 100644
index 000000000..8a07e8f87
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_usbdev.c
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * configs/twr-k60n512/src/up_usbdev.c
+ * arch/arm/src/board/up_boot.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "kinetis_internal.h"
+#include "twrk60-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the TWR_K60N512 board.
+ *
+ ************************************************************************************/
+
+void kinetis_usbinitialize(void)
+{
+# warning "Missing logic"
+}
+
+/************************************************************************************
+ * Name: kinetis_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide kinetis_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int kinetis_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+# warning "Missing logic"
+ return OK;
+}
+
+/************************************************************************************
+ * Name: kinetis_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the kinetis_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void kinetis_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+#warning "Missing logic"
+}
+
diff --git a/nuttx/configs/twr-k60n512/src/up_usbmsc.c b/nuttx/configs/twr-k60n512/src/up_usbmsc.c
new file mode 100644
index 000000000..1a8f7a70d
--- /dev/null
+++ b/nuttx/configs/twr-k60n512/src/up_usbmsc.c
@@ -0,0 +1,118 @@
+/****************************************************************************
+ * configs/twr-k60n512/src/up_usbmsc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Configure and register the Kinetis MMC/SD block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "kinetis_internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_TWR_K60N512
+# undef KINETIS_MMCSDSLOTNO
+# define KINETIS_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new Kinetis boards here */
+# error "Unrecognized Kinetis board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ /* If examples/usbmsc is built as an NSH command, then SD slot should
+ * already have been initized in nsh_archinitialize() (see up_nsh.c). In
+ * this case, there is nothing further to be done here.
+ */
+
+#ifndef CONFIG_EXAMPLES_USBMSC_BUILTIN
+# warning "Missing logic"
+#endif /* CONFIG_EXAMPLES_USBMSC_BUILTIN */
+
+ return OK;
+}
diff --git a/nuttx/configs/ubw32/Kconfig b/nuttx/configs/ubw32/Kconfig
new file mode 100644
index 000000000..83ed53225
--- /dev/null
+++ b/nuttx/configs/ubw32/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_UBW32
+endif
diff --git a/nuttx/configs/ubw32/README.txt b/nuttx/configs/ubw32/README.txt
new file mode 100644
index 000000000..f8afb88e4
--- /dev/null
+++ b/nuttx/configs/ubw32/README.txt
@@ -0,0 +1,651 @@
+configs/ubw32 README
+====================
+
+This README file discusses the port of NuttX to the Sparkfun UBW32 board.
+This port uses the original v2.5 board which is based on the MicroChip
+PIC32MX460F512L. See http://www.sparkfun.com/products/8971. This older
+version has been replaced with this board http://www.sparkfun.com/products/9713.
+See also http://www.schmalzhaus.com/UBW32/.
+
+Contents
+========
+
+ PIC32MX460F512L Pin Out
+ MAX3232 Connection
+ Toolchains
+ Loading NuttX with PICkit2
+ LEDs
+ Buttons
+ PIC32MX Configuration Options
+ Configurations
+
+PIC32MX460F512L Pin Out
+=======================
+
+ PIC32MX460F512L 100-Pin TQFP (USB) Pin Out. The mapping to the pins on
+ the PCL Logic board are very simple, each pin is brought out to a connector
+ label with the PIC32MX460F512L pin number.
+
+ On board logic only manages power, crystal, and USB signals.
+
+ LEFT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ ---- ---------------------------- -------------------------------------------------------
+ PIN NAME Board Connection (omitting pins brought to J3 and J4)
+ ---- ---------------------------- -------------------------------------------------------
+ 1 RG15
+ 2 Vdd
+ 3 PMD5/RE5
+ 4 PMD6/RE6 RE6 User switch
+ 5 PMD7/RE7 RE7 Program switch
+ 6 T2CK/RC1
+ 7 T3CK/RC2
+ 8 T4CK/RC3
+ 9 T5CK/SDI1/RC4
+ 10 SCK2/PMA5/CN8/RG6
+ 11 SDI2/PMA4/CN9/RG7
+ 12 SDO2/PMA3/CN10/RG8
+ 13 MCLR
+ 14 SS2/PMA2/CN11/RG9
+ 15 Vss
+ 16 Vdd
+ 17 TMS/RA0
+ 18 INT1/RE8
+ 19 INT2/RE9
+ 20 AN5/C1IN+/VBUSON/CN7/RB5
+ 21 AN4/C1IN-/CN6/RB4
+ 22 AN3/C2IN+/CN5/RB3
+ 23 AN2/C2IN-/CN4/RB2 RB1 ICSP/Debug/IO (J5) pin 6 (labeled B2)
+ 24 PGEC1/AN1/CN3/RB1 RB1 ICSP/Debug/IO (J5) pin 7 (labeled B1)
+ 25 PGED1/AN0/CN2/RB0 RB0 ICSP/Debug/IO (J5) pin 8 (labeled B0)
+
+ BOTTOM SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ ---- ---------------------------- -------------------------------------------------------
+ PIN NAME Board Connection (omitting pins brought to J3 and J4)
+ ---- ---------------------------- -------------------------------------------------------
+ 26 PGEC2/AN6/OCFA/RB6 PGC ICSP/Debug/IO (J5) pin 5 (labled PGC)
+ 27 PGED2/AN7/RB7 PGD ICSP/Debug/IO (J5) pin 4 (labled PGD)
+ 28 VREF-/CVREF-/PMA7/RA9
+ 29 VREF+/CVREF+/PMA6/RA10
+ 30 AVdd
+ 31 AVss
+ 32 AN8/C1OUT/RB8
+ 33 AN9/C2OUT/RB9
+ 34 AN10/CVREFOUT/PMA13/RB10
+ 35 AN11/PMA12/RB11
+ 36 Vss
+ 37 Vdd
+ 38 TCK/RA1
+ 39 U2RTS/RF13
+ 40 U2CTS/RF12
+ 41 AN12/PMA11/RB12
+ 42 AN13/PMA10/RB13
+ 43 AN14/PMALH/PMA1/RB14
+ 44 AN15/OCFB/PMALL/PMA0/CN12/RB15
+ 45 Vss
+ 46 Vdd
+ 47 U1CTS/CN20/RD14
+ 48 U1RTS/CN21/RD15
+ 49 U2RX/PMA9/CN17/RF4
+ 50 U2TX/PMA8/CN18/RF5
+
+ RIGHT SIDE, TOP-TO-BOTTOM (if pin 1 is in upper left)
+ ---- ---------------------------- -------------------------------------------------------
+ PIN NAME Board Connection (omitting pins brought to J3 and J4)
+ ---- ---------------------------- -------------------------------------------------------
+ 75 Vss
+ 74 SOSCO/T1CK/CN0/RC14
+ 73 SOSCI/CN1/RC13
+ 72 SDO1/OC1/INT0/RD0
+ 71 IC4/PMCS1/PMA14/RD11
+ 70 SCK1/IC3/PMCS2/PMA15/RD10
+ 69 SS1/IC2/RD9
+ 68 RTCC/IC1/RD8
+ 67 SDA1/INT4/RA15
+ 66 SCL1/INT3/RA14
+ 65 Vss
+ 64 OSC2/CLKO/RC15
+ 63 OSC1/CLKI/RC12
+ 62 Vdd
+ 61 TDO/RA5
+ 60 TDI/RA4
+ 59 SDA2/RA3
+ 58 SCL2/RA2
+ 57 D+/RG2 D+ Alternate USB (J6) pin 3 (labeled D+)
+ USB host (JP1) pin
+ USB Function (Mini B)
+ 56 D-/RG3 D- Alternate USB (J6) pin 2 (labeled D-)
+ USB host (JP1) pin
+ USB Function (Mini B)
+ 55 VUSB
+ 54 VBUS VBUS Alternate USB (J6) pin 1 (labeled VBUS)
+ USB host (JP1) pin
+ USB Function (Mini B)
+ Jumper JP1 for USB host functionality
+ 53 U1TX/RF8
+ 52 U1RX/RF2
+ 51 USBID/RF3 USBID Alternate USB (J6) pin 4 (labeled ID)
+ USB Function (Mini B)
+ Also USB LED
+
+ TOP SIDE, LEFT-TO-RIGHT (if pin 1 is in upper left)
+ ---- ---------------------------- -------------------------------------------------------
+ PIN NAME Board Connection (omitting pins brought to J3 and J4)
+ ---- ---------------------------- -------------------------------------------------------
+ 100 PMD4/RE4
+ 99 PMD3/RE3
+ 98 PMD2/RE2 RE2 LED1
+ 97 TRD0/RG13
+ 96 TRD1/RG12
+ 95 TRD2/RG14
+ 94 PMD1/RE1 RE1 LED2
+ 93 PMD0/RE0 RE0 LED3
+ 92 TRD3/RA7
+ 91 TRCLK/RA6
+ 90 PMD8/RG0
+ 89 PMD9/RG1
+ 88 PMD10/RF1
+ 87 PMD11/RF0
+ 86 ENVREG
+ 85 Vcap/Vddcore
+ 84 PMD15/CN16/RD7
+ 83 PMD14/CN15/RD6
+ 82 PMRD/CN14/RD5
+ 81 OC5/PMWR/CN13/RD4
+ 80 PMD13/CN19/RD13
+ 79 IC5/PMD12/RD12
+ 78 OC4/RD3
+ 77 OC3/RD2
+ 76 OC2/RD1
+
+MAX3232 Connection
+==================
+
+ I use a tiny, MAX3232 board that I got from the eBay made by NKC
+ Electronics (http://www.nkcelectronics.com/). As of this writing, it
+ is also available here: http://www.nkcelectronics.com/rs232-to-ttl-3v--55v-convert232356.html
+
+ CTS -- Not connected
+ RTS -- Not connected
+ TX -- J4 pin 31: U1TX/RF8
+ RX -- J4 pin 30: U1RX/RF2
+ GND -- J4 pin 40: GND
+ Vcc -- J4 pin 39: 5V
+
+Toolchains
+==========
+
+ MPLAB/C32
+ ---------
+
+ I am using the free, "Lite" version of the PIC32MX toolchain available
+ for download from the microchip.com web site. I am using the Windows
+ version. The MicroChip toolchain is the only toolchain currently
+ supported in these configurations, but it should be a simple matter to
+ adapt to other toolchains by modifying the Make.defs file include in
+ each configuration.
+
+ C32 Toolchain Options:
+
+ CONFIG_PIC32MX_MICROCHIPW - MicroChip full toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL - MicroChip full toolchain for Linux
+ CONFIG_PIC32MX_MICROCHIPW_LITE - MicroChip "Lite" toolchain for Windows
+ CONFIG_PIC32MX_MICROCHIPL_LITE - MicroChip "Lite" toolchain for Linux
+
+ NOTE: The "Lite" versions of the toolchain does not support C++. Also
+ certain optimization levels are not supported by the "Lite" toolchain.
+
+ MicrochipOpen
+ -------------
+
+ An alternative, build-it-yourself toolchain is available here:
+ http://sourceforge.net/projects/microchipopen/ . These tools were
+ last updated circa 2010. NOTE: C++ support still not available
+ in this toolchain.
+
+ Building MicrochipOpen (on Linux)
+
+ 1) Get the build script from this location:
+
+ http://microchipopen.svn.sourceforge.net/viewvc/microchipopen/ccompiler4pic32/buildscripts/trunk/
+
+ 2) Build the code using the build script, for example:
+
+ ./build.sh -b v105_freeze
+
+ This will check out the selected branch and build the tools.
+
+ 3) Binaries will then be available in a subdirectory with a name something like
+ pic32-v105-freeze-20120622/install-image/bin (depending on the current data
+ and the branch that you selected.
+
+ Note that the tools will have the prefix, mypic32- so, for example, the
+ compiler will be called mypic32-gcc.
+
+ Pinguino mips-elf Toolchain
+ ---------------------------
+
+ Another option is the mips-elf toolchain used with the Pinguino project. This
+ is a relatively current mips-elf GCC and should provide free C++ support as
+ well. This toolchain can be downloded from the Pinguino website:
+ http://wiki.pinguino.cc/index.php/Main_Page#Download . There is some general
+ information about using the Pinguino mips-elf toolchain in this thread:
+ http://tech.groups.yahoo.com/group/nuttx/message/1821
+
+ See also configs/mirtoo/README.txt. There is an experimental (untested)
+ configuration for the Mirtoo platform in that directory.
+
+ MPLAB/C32 vs MPLABX/X32
+ -----------------------
+
+ It appears that Microchip is phasing out the MPLAB/C32 toolchain and replacing
+ it with MPLABX and XC32. At present, the XC32 toolchain is *not* compatible
+ with the NuttX build scripts. Here are some of the issues that I see when trying
+ to build with XC32:
+
+ 1) Make.def changes: You have to change the tool prefix:
+
+ -CROSSDEV=pic32-
+ +CROSSDEV=xc32-
+
+ 2) debug.ld/release.ld: The like expect some things that are not present in
+ the current linker scripts (or are expected with different names). Here
+ are some partial fixes:
+
+ Rename: kseg0_progmem to kseg0_program_mem
+ Rename: kseg1_datamem to kseg1_data_mem
+
+ Even then, there are more warnings from the linker and some undefined symbols
+ for non-NuttX code that resides in the unused Microchip libraries. See this
+ email thread at http://tech.groups.yahoo.com/group/nuttx/message/1458 for more
+ information. You will have to solve at least this undefined symbol problem if
+ you want to used the XC32 toolchain.
+
+ Windows Native Toolchains
+ -------------------------
+
+ NOTE: There are several limitations to using a Windows based toolchain in a
+ Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+Loading NuttX with PICkit2
+==========================
+
+ NOTE: You need a PICKit3 if you plan to use the MPLAB debugger! The PICKit2
+ can, however, still be used to load programs. Instructions for the PICKit3
+ are similar.
+
+ Intel Hex Forma Files:
+ ----------------------
+
+ When NuttX is built it will produce two files in the top-level NuttX
+ directory:
+
+ 1) nuttx - This is an ELF file, and
+ 2) nuttx.hex - This is an Intel Hex format file. This is controlled by
+ the setting CONFIG_INTELHEX_BINARY in the .config file.
+
+ The PICkit tool wants an Intel Hex format file to burn into FLASH. However,
+ there is a problem with the generated nutt.hex: The tool expects the nuttx.hex
+ file to contain physical addresses. But the nuttx.hex file generated from the
+ top-level make will have address in the KSEG0 and KSEG1 regions.
+
+ tools/pic32mx/mkpichex:
+ ----------------------
+
+ There is a simple tool in the NuttX tools/pic32mx directory that can be
+ used to solve both issues with the nuttx.hex file. But, first, you must
+ build the tool:
+
+ cd tools/pic32mx
+ make
+
+ Now you will have an excecutable file call mkpichex (or mkpichex.exe on
+ Cygwin). This program will take the nutt.hex file as an input, it will
+ convert all of the KSEG0 and KSEG1 addresses to physical address, and
+ it will write the modified file, replacing the original nuttx.hex.
+
+ To use this file, you need to do the following things:
+
+ . ./setenv.sh # Source setenv.sh. Among other this, this script
+ # will add the NuttX tools/pic32mx directory to your
+ # PATH variable
+ make # Build nuttx and nuttx.hex
+ mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path
+ # to the top-level build directory. It is the only
+ # required input to mkpichex.
+
+LEDs
+====
+
+ ----- ----- -------------------------------------------------------------
+ LABEL COLOR CONTROL
+ ----- ----- -------------------------------------------------------------
+ USB Green RF3. This could be used by software if USB is not used.
+ Otherwise, RF3 is used as the USBID signal.
+ LED1 While RE2, Pulled up. Low value illuminates
+ LED2 Red RE1, Pulled up. Low value illuminates
+ LED3 Yellow RE0, Pulled up. Low value illuminates
+ PWR Blue Illuminated when 5V is present, not controlled by software
+
+ If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows:
+
+ ON OFF
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED1 LED2 LED3 LED1 LED2 LED3
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED_STARTED 0 OFF OFF OFF --- --- ---
+ LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ LED_STACKCREATED 3 ON ON N/C --- --- ---
+ LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ LED_PANIC 5 ON N/C N/C OFF N/C N/C
+
+Buttons
+=======
+
+ RE6 User switch
+ RE7 Program switch
+
+PIC32MX Configuration Options
+=============================
+
+ General Architecture Settings:
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=mips
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_MIPS=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_MIPS32=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=pic32mx
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_PIC32MX460F512L=y
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=ubw32
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_UBW32=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
+
+ CONFIG_DRAM_SIZE=(32*1024) (32Kb)
+
+ There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0xa0000000
+
+ CONFIG_ARCH_IRQPRIO - The PIC32MXx supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+ PIC32MX Configuration
+
+ CONFIG_PIC32MX_MVEC - Select muli- vs. single-vectored interrupts
+
+ Individual subsystems can be enabled:
+
+ CONFIG_PIC32MX_WDT - Watchdog timer
+ CONFIG_PIC32MX_T2 - Timer 2 (Timer 1 is the system time and always enabled)
+ CONFIG_PIC32MX_T3 - Timer 3
+ CONFIG_PIC32MX_T4 - Timer 4
+ CONFIG_PIC32MX_T5 - Timer 5
+ CONFIG_PIC32MX_IC1 - Input Capture 1
+ CONFIG_PIC32MX_IC2 - Input Capture 2
+ CONFIG_PIC32MX_IC3 - Input Capture 3
+ CONFIG_PIC32MX_IC4 - Input Capture 4
+ CONFIG_PIC32MX_IC5 - Input Capture 5
+ CONFIG_PIC32MX_OC1 - Output Compare 1
+ CONFIG_PIC32MX_OC2 - Output Compare 2
+ CONFIG_PIC32MX_OC3 - Output Compare 3
+ CONFIG_PIC32MX_OC4 - Output Compare 4
+ CONFIG_PIC32MX_OC5 - Output Compare 5
+ CONFIG_PIC32MX_I2C1 - I2C 1
+ CONFIG_PIC32MX_I2C2 - I2C 2
+ CONFIG_PIC32MX_SPI1 - SPI 1
+ CONFIG_PIC32MX_SPI2 - SPI 2
+ CONFIG_PIC32MX_UART1 - UART 1
+ CONFIG_PIC32MX_UART2 - UART 2
+ CONFIG_PIC32MX_ADC - ADC 1
+ CONFIG_PIC32MX_PMP - Parallel Master Port
+ CONFIG_PIC32MX_CM1 - Comparator 1
+ CONFIG_PIC32MX_CM2 - Comparator 2
+ CONFIG_PIC32MX_RTCC - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA - DMA
+ CONFIG_PIC32MX_FLASH - FLASH
+ CONFIG_PIC32MX_USBDEV - USB device
+ CONFIG_PIC32MX_USBHOST - USB host
+
+ PIC32MX Configuration Settings
+ DEVCFG0:
+ CONFIG_PIC32MX_DEBUGGER - Background Debugger Enable. Default 3 (disabled). The
+ value 2 enables.
+ CONFIG_PIC32MX_ICESEL - In-Circuit Emulator/Debugger Communication Channel Select
+ Default 1 (PG2)
+ CONFIG_PIC32MX_PROGFLASHWP - Program FLASH write protect. Default 0xff (disabled)
+ CONFIG_PIC32MX_BOOTFLASHWP - Default 1 (disabled)
+ CONFIG_PIC32MX_CODEWP - Default 1 (disabled)
+ DEVCFG1: (All settings determined by selections in board.h)
+ DEVCFG2: (All settings determined by selections in board.h)
+ DEVCFG3:
+ CONFIG_PIC32MX_USBIDO - USB USBID Selection. Default 1 if USB enabled
+ (USBID pin is controlled by the USB module), but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_VBUSIO - USB VBUSON Selection (Default 1 if USB enabled
+ (VBUSON pin is controlled by the USB module, but 0 (GPIO) otherwise.
+ CONFIG_PIC32MX_WDENABLE - Enabled watchdog on power up. Default 0 (watchdog
+ can be enabled later by software).
+
+ The priority of interrupts may be specified. The value ranage of
+ priority is 4-31. The default (16) will be used if these any of these
+ are undefined.
+
+ CONFIG_PIC32MX_CTPRIO - Core Timer Interrupt
+ CONFIG_PIC32MX_CS0PRIO - Core Software Interrupt 0
+ CONFIG_PIC32MX_CS1PRIO - Core Software Interrupt 1
+ CONFIG_PIC32MX_INT0PRIO - External Interrupt 0
+ CONFIG_PIC32MX_INT1PRIO - External Interrupt 1
+ CONFIG_PIC32MX_INT2PRIO - External Interrupt 2
+ CONFIG_PIC32MX_INT3PRIO - External Interrupt 3
+ CONFIG_PIC32MX_INT4PRIO - External Interrupt 4
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_T1PRIO - Timer 1 (System timer) priority
+ CONFIG_PIC32MX_T2PRIO - Timer 2 priority
+ CONFIG_PIC32MX_T3PRIO - Timer 3 priority
+ CONFIG_PIC32MX_T4PRIO - Timer 4 priority
+ CONFIG_PIC32MX_T5PRIO - Timer 5 priority
+ CONFIG_PIC32MX_IC1PRIO - Input Capture 1
+ CONFIG_PIC32MX_IC2PRIO - Input Capture 2
+ CONFIG_PIC32MX_IC3PRIO - Input Capture 3
+ CONFIG_PIC32MX_IC4PRIO - Input Capture 4
+ CONFIG_PIC32MX_IC5PRIO - Input Capture 5
+ CONFIG_PIC32MX_OC1PRIO - Output Compare 1
+ CONFIG_PIC32MX_OC2PRIO - Output Compare 2
+ CONFIG_PIC32MX_OC3PRIO - Output Compare 3
+ CONFIG_PIC32MX_OC4PRIO - Output Compare 4
+ CONFIG_PIC32MX_OC5PRIO - Output Compare 5
+ CONFIG_PIC32MX_I2C1PRIO - I2C 1
+ CONFIG_PIC32MX_I2C2PRIO - I2C 2
+ CONFIG_PIC32MX_SPI1PRIO - SPI 1
+ CONFIG_PIC32MX_SPI2PRIO - SPI 2
+ CONFIG_PIC32MX_UART1PRIO - UART 1
+ CONFIG_PIC32MX_UART2PRIO - UART 2
+ CONFIG_PIC32MX_CN - Input Change Interrupt
+ CONFIG_PIC32MX_ADCPRIO - ADC1 Convert Done
+ CONFIG_PIC32MX_PMPPRIO - Parallel Master Port
+ CONFIG_PIC32MX_CM1PRIO - Comparator 1
+ CONFIG_PIC32MX_CM2PRIO - Comparator 2
+ CONFIG_PIC32MX_FSCMPRIO - Fail-Safe Clock Monitor
+ CONFIG_PIC32MX_RTCCPRIO - Real-Time Clock and Calendar
+ CONFIG_PIC32MX_DMA0PRIO - DMA Channel 0
+ CONFIG_PIC32MX_DMA1PRIO - DMA Channel 1
+ CONFIG_PIC32MX_DMA2PRIO - DMA Channel 2
+ CONFIG_PIC32MX_DMA3PRIO - DMA Channel 3
+ CONFIG_PIC32MX_FCEPRIO - Flash Control Event
+ CONFIG_PIC32MX_USBPRIO - USB
+
+ PIC32MXx specific device driver settings
+
+ CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_UARTn_2STOP - Two stop bits
+
+ PIC32MXx USB Device Configuration
+
+ PIC32MXx USB Host Configuration (the PIC32MX does not support USB Host)
+
+Configurations
+==============
+
+Each PIC32MX configuration is maintained in a sudirectory and can be
+selected as follow:
+
+ cd tools
+ ./configure.sh ubw32/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ ostest:
+ =======
+ Description.
+ ------------
+ This configuration directory, performs a simple OS test using
+ apps/examples/ostest.
+
+ Serial Output.
+ --------------
+ The OS test produces all of its test output on the serial console.
+ This configuration has UART1 enabled as a serial console.
+
+ TX -- J4 pin 31: U1TX/RF8
+ RX -- J4 pin 30: U1RX/RF2
+ GND -- J4 pin 40: GND
+ Vcc -- J4 pin 39: 5V
+
+ nsh:
+ ====
+ Description.
+ ------------
+ This is the NuttShell (NSH) using the NSH startup logic at
+ apps/examples/nsh.
+
+ Serial Output.
+ --------------
+ The OS test produces all of its test output on the serial console.
+ This configuration has UART1 enabled as a serial console.
+
+ TX -- J4 pin 31: U1TX/RF8
+ RX -- J4 pin 30: U1RX/RF2
+ GND -- J4 pin 40: GND
+ Vcc -- J4 pin 39: 5V
+
+ USB Configuations.
+ -----------------
+ Several USB device configurations can be enabled and included
+ as NSH built-in built in functions.
+
+ All USB device configurations require the following basic setup in
+ your NuttX configuration file to enable USB device support:
+
+ CONFIG_USBDEV=y : Enable basic USB device support
+ CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
+
+ examples/usbterm - This option can be enabled by uncommenting
+ the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/usbterm
+
+ And by enabling one of the USB serial devices:
+
+ CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
+ CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
+
+ examples/cdcacm - The examples/cdcacm program can be included as an
+ function by uncommenting the following line in the appconfig file:
+
+ CONFIGURED_APPS += examples/cdcacm
+
+ and defining the following in your .config file:
+
+ CONFIG_CDCACM=y : Enable the CDCACM device
diff --git a/nuttx/configs/ubw32/include/board.h b/nuttx/configs/ubw32/include/board.h
new file mode 100644
index 000000000..63869cc5f
--- /dev/null
+++ b/nuttx/configs/ubw32/include/board.h
@@ -0,0 +1,244 @@
+/****************************************************************************
+ * configs/ubw32/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_UBW32_INCLUDE_BOARD_H
+#define __CONFIGS_UBW32_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/* Clocking *****************************************************************/
+/* Crystal frequencies */
+
+#define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */
+#define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz)
+ * (Not present on my board) */
+
+/* Oscillator modes */
+
+#define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
+#define BOARD_POSC_HSMODE 1 /* High-speed crystal (HS) mode */
+
+/* PLL configuration and resulting CPU clock.
+ * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
+ */
+
+#define BOARD_PLL_INPUT BOARD_POSC_FREQ
+#define BOARD_PLL_IDIV 2 /* PLL input divider */
+#define BOARD_PLL_MULT 20 /* PLL multiplier */
+#define BOARD_PLL_ODIV 1 /* PLL output divider */
+
+#define BOARD_CPU_CLOCK 80000000 /* CPU clock (80MHz = 8MHz * 20 / 2) */
+
+/* USB PLL configuration.
+ * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
+ */
+
+#define BOARD_UPLL_IDIV 2 /* USB PLL divider (revisit) */
+#define BOARD_USB_CLOCK 48000000 /* USB clock (8MHz / 2) * 24 / 2) */
+
+/* Peripheral clock is divided down from CPU clock.
+ * PBCLOCK = CPU_CLOCK / PBDIV
+ */
+
+#define BOARD_PBDIV 2 /* Peripheral clock divisor (PBDIV) */
+#define BOARD_PBCLOCK 40000000 /* Peripheral clock (PBCLK = 80MHz/2) */
+
+/* Watchdog pre-scaler (re-visit) */
+
+#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
+#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
+
+/* LED definitions **********************************************************/
+/* ----- ----- -------------------------------------------------------------
+ * LABEL COLOR CONTROL
+ * ----- ----- -------------------------------------------------------------
+ * USB Green RF3. This could be used by software if USB is not used.
+ * Otherwise, RF3 is used as the USBID signal.
+ * LED1 While RE2, Pulled up. Low value illuminates
+ * LED2 Red RE1, Pulled up. Low value illuminates
+ * LED3 Yellow RE0, Pulled up. Low value illuminates
+ * PWR Blue Illuminated when 5V is present, not controlled by software
+ */
+
+/* LED index values for use with pic32mx_setled() */
+
+#define PIC32MX_UBW32_LED1 0
+#define PIC32MX_UBW32_LED2 1
+#define PIC32MX_UBW32_LED3 2
+#define PIC32MX_UBW32_NLEDS 3
+
+/* LED bits for use with pic32mx_setleds() */
+
+#define PIC32MX_UBW32_LED1_BIT (1 << PIC32MX_UBW32_LED1)
+#define PIC32MX_UBW32_LED2_BIT (1 << PIC32MX_UBW32_LED2)
+#define PIC32MX_UBW32_LED3_BIT (1 << PIC32MX_UBW32_LED3)
+
+/* If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows:
+ *
+ * ON OFF
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED1 LED2 LED3 LED1 LED2 LED3
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF OFF --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 4
+#define LED_ASSERTION 4
+#define LED_PANIC 5
+
+#define LED_NVALUES 6
+
+/* The UBW32 board has three buttons.
+ *
+ * PROGRAM RE7 Pulled high, Grounded/low when depressed
+ * USER RE6 Pulled high, Grounded/low when depressed
+ * RESET Not software accessible
+ */
+
+#define BUTTON_PROGRAM 0
+#define BUTTON_USER 1
+#define NUM_BUTTONS 2
+
+#define BUTTON_PROGRAM_BIT (1 << BUTTON_PROGRAM)
+#define BUTTON_USER_BIT (1 << BUTTON_USER)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_ledinit and pic32mx_setled
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
+ * are available to control the LEDs from user applicaitons.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_setled(int led, bool ledon);
+#endif
+
+#ifndef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_setleds(uint8_t ledset);
+#endif
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT
+ * definitions in board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource.
+ * See the BUTTON_* definitions in board.h for the meaning of enumeration
+ * value. The previous interrupt handler address is returned (so that it
+ * may restored, if so desired).
+ *
+ * When an interrupt occurs, it is due to a change on the GPIO input pin
+ * associated with the button. In that case, all attached change
+ * notification handlers will be called. Each handler must maintain state
+ * and determine if the unlying GPIO button input value changed.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#ifdef CONFIG_ARCH_IRQBUTTONS
+EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
+#endif
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_UBW32_INCLUDE_BOARD_H */
diff --git a/nuttx/configs/ubw32/nsh/Make.defs b/nuttx/configs/ubw32/nsh/Make.defs
new file mode 100644
index 000000000..8330fb677
--- /dev/null
+++ b/nuttx/configs/ubw32/nsh/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/ubw32/nsh/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ubw32/nsh/appconfig b/nuttx/configs/ubw32/nsh/appconfig
new file mode 100644
index 000000000..14e06cc4c
--- /dev/null
+++ b/nuttx/configs/ubw32/nsh/appconfig
@@ -0,0 +1,87 @@
+############################################################################
+# configs/ubw32/nsh/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+############################################################################
+# Path to example in apps/examples containing the user_start entry point
+############################################################################
+
+CONFIGURED_APPS += examples/nsh
+
+############################################################################
+# The NSH application library
+############################################################################
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+############################################################################
+# USB device configurations
+############################################################################
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+
+# USB Mass Storage Class device configurations
+
+ifeq ($(CONFIG_USBMSC),y)
+# Uncomment to enable the examples/usbstorage built-in
+# CONFIGURED_APPS += examples/usbstorage
+endif
+
+# USB CDC/ACM serial device configurations
+
+ifeq ($(CONFIG_CDCACM),y)
+# Uncomment to enable the examples/cdcacm built-in
+# CONFIGURED_APPS += examples/cdcacm
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+
+# Prolifics PL2303 emulation configurations
+
+ifeq ($(CONFIG_PL2303),y)
+# Uncomment the following to enable the examples/usbterm built-in
+# CONFIGURED_APPS += examples/usbterm
+endif
+endif
+
+############################################################################
+# Other applications that can be configured as an NX built-in commands
+############################################################################
+
+ifeq ($(CONFIG_I2C),y)
+CONFIGURED_APPS += system/i2c
+endif
+
+
diff --git a/nuttx/configs/ubw32/nsh/defconfig b/nuttx/configs/ubw32/nsh/defconfig
new file mode 100644
index 000000000..174d7c9a8
--- /dev/null
+++ b/nuttx/configs/ubw32/nsh/defconfig
@@ -0,0 +1,507 @@
+############################################################################
+# configs/ubw32/nsh/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX460F512L=y
+CONFIG_ARCH_BOARD="ubw32"
+CONFIG_ARCH_BOARD_UBW32=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+CONFIG_DEBUG_USB=n
+
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=26
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=64
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ubw32/nsh/ld.script b/nuttx/configs/ubw32/nsh/ld.script
new file mode 100644
index 000000000..b053aebe6
--- /dev/null
+++ b/nuttx/configs/ubw32/nsh/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/ubw32/nsh/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX460F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX460F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX460F512L has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/ubw32/nsh/setenv.sh b/nuttx/configs/ubw32/nsh/setenv.sh
new file mode 100755
index 000000000..26946b1bb
--- /dev/null
+++ b/nuttx/configs/ubw32/nsh/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/ubw32/nsh/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ubw32/ostest/Make.defs b/nuttx/configs/ubw32/ostest/Make.defs
new file mode 100644
index 000000000..7747cb3c4
--- /dev/null
+++ b/nuttx/configs/ubw32/ostest/Make.defs
@@ -0,0 +1,161 @@
+############################################################################
+# configs/ubw32/ostest/Make.defs
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPW_LITE),y)
+ # Microchip toolchain under Windows
+ CROSSDEV = pic32-
+ WINTOOL = y
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+ MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_PIC32MX_MICROCHIPL_LITE),y)
+ # Microchip toolchain under Linux
+ CROSSDEV = pic32-
+# MAXOPTIMIZATION = -O2
+ ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data
+ ARCHPICFLAGS = -fpic -membedded-pic
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}"
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/ubw32/ostest/appconfig b/nuttx/configs/ubw32/ostest/appconfig
new file mode 100644
index 000000000..6278529fa
--- /dev/null
+++ b/nuttx/configs/ubw32/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/ubw32/ostest/appconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/ubw32/ostest/defconfig b/nuttx/configs/ubw32/ostest/defconfig
new file mode 100644
index 000000000..2a51efc25
--- /dev/null
+++ b/nuttx/configs/ubw32/ostest/defconfig
@@ -0,0 +1,506 @@
+############################################################################
+# configs/ubw32/ostest/defconfig
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="mips"
+CONFIG_ARCH_MIPS=y
+CONFIG_ARCH_MIPS32=y
+CONFIG_ARCH_CHIP="pic32mx"
+CONFIG_ARCH_CHIP_PIC32MX460F512L=y
+CONFIG_ARCH_BOARD="ubw32"
+CONFIG_ARCH_BOARD_UBW32=y
+CONFIG_BOARD_LOOPSPERMSEC=8079
+CONFIG_DRAM_SIZE=32768
+CONFIG_DRAM_START=0xa0000000
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_VECNOTIRQ=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Enable support for RAM-based functions
+# (If selected, then modifications are needed in ld.script as well)
+#
+CONFIG_PIC32MX_RAMFUNCS=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_PIC32MX_MICROCHIPW=n
+CONFIG_PIC32MX_MICROCHIPL=n
+CONFIG_PIC32MX_MICROCHIPW_LITE=y
+CONFIG_PIC32MX_MICROCHIPL_LITE=n
+
+#
+# Individual subsystems can be enabled:
+#
+
+CONFIG_PIC32MX_WDT=n
+CONFIG_PIC32MX_RTCC=n
+CONFIG_PIC32MX_TIMER1=n
+CONFIG_PIC32MX_TIMER2=n
+CONFIG_PIC32MX_TIMER3=n
+CONFIG_PIC32MX_TIMER4=n
+CONFIG_PIC32MX_TIMER5=n
+CONFIG_PIC32MX_IC1=n
+CONFIG_PIC32MX_IC2=n
+CONFIG_PIC32MX_IC3=n
+CONFIG_PIC32MX_IC4=n
+CONFIG_PIC32MX_IC5=n
+CONFIG_PIC32MX_OC1=n
+CONFIG_PIC32MX_OC2=n
+CONFIG_PIC32MX_OC3=n
+CONFIG_PIC32MX_OC4=n
+CONFIG_PIC32MX_OC5=n
+CONFIG_PIC32MX_I2C1=n
+CONFIG_PIC32MX_I2C2=n
+CONFIG_PIC32MX_SPI1=n
+CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_UART1=y
+CONFIG_PIC32MX_UART2=n
+CONFIG_PIC32MX_PMP=n
+CONFIG_PIC32MX_ADC=n
+CONFIG_PIC32MX_CVR=n
+CONFIG_PIC32MX_CM1=n
+CONFIG_PIC32MX_CM2=n
+CONFIG_PIC32MX_OSC=y
+CONFIG_PIC32MX_DDP=n
+CONFIG_PIC32MX_FLASH=n
+CONFIG_PIC32MX_BMX=n
+CONFIG_PIC32MX_DMA=n
+CONFIG_PIC32MX_CHE=n
+CONFIG_PIC32MX_USBDEV=n
+CONFIG_PIC32MX_USBHOST=n
+CONFIG_PIC32MX_IOPORTA=y
+CONFIG_PIC32MX_IOPORTB=y
+CONFIG_PIC32MX_IOPORTC=y
+CONFIG_PIC32MX_IOPORTD=y
+CONFIG_PIC32MX_IOPORTE=y
+CONFIG_PIC32MX_IOPORTF=y
+CONFIG_PIC32MX_IOPORTG=y
+
+#
+# PIC32MX Configuration Settings
+#
+CONFIG_PIC32MX_DEBUGGER=2
+CONFIG_PIC32MX_ICESEL=1
+
+#
+# PIC32MX specific serial device driver settings
+#
+CONFIG_UART1_SERIAL_CONSOLE=y
+CONFIG_UART2_SERIAL_CONSOLE=n
+
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART2_TXBUFSIZE=256
+
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART2_RXBUFSIZE=256
+
+CONFIG_UART1_BAUD=115200
+CONFIG_UART2_BAUD=115200
+
+CONFIG_UART1_BITS=8
+CONFIG_UART2_BITS=8
+
+CONFIG_UART1_PARITY=0
+CONFIG_UART2_PARITY=0
+
+CONFIG_UART1_2STOP=0
+CONFIG_UART2_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_SCHED=n
+
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2012
+CONFIG_START_MONTH=4
+CONFIG_START_DAY=26
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_SCHED_WORKQUEUE=n
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=n
+CONFIG_SCHED_ATEXIT=n
+
+#
+# Settings for nxflat
+#
+CONFIG_NXFLAT=n
+CONFIG_NXFLAT_DUMPBUFFER=n
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FAT_MAXFNAME=32
+CONFIG_FS_NXFFS=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_MMCSD_MMCSUPPORT=n
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB serial device class driver (Standard CDC ACM class)
+#
+CONFIG_CDCACM=n
+CONFIG_CDCACM_CONSOLE=n
+#CONFIG_CDCACM_EP0MAXPACKET
+CONFIG_CDCACM_EPINTIN=1
+#CONFIG_CDCACM_EPINTIN_FSSIZE
+#CONFIG_CDCACM_EPINTIN_HSSIZE
+CONFIG_CDCACM_EPBULKOUT=3
+#CONFIG_CDCACM_EPBULKOUT_FSSIZE
+#CONFIG_CDCACM_EPBULKOUT_HSSIZE
+CONFIG_CDCACM_EPBULKIN=2
+#CONFIG_CDCACM_EPBULKIN_FSSIZE
+#CONFIG_CDCACM_EPBULKIN_HSSIZE
+#CONFIG_CDCACM_NWRREQS
+#CONFIG_CDCACM_NRDREQS
+#CONFIG_CDCACM_VENDORID
+#CONFIG_CDCACM_VENDORSTR
+#CONFIG_CDCACM_PRODUCTID
+#CONFIG_CDCACM_PRODUCTSTR
+#CONFIG_CDCACM_RXBUFSIZE
+#CONFIG_CDCACM_TXBUFSIZE
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=1
+CONFIG_USBMSC_EPBULKIN=2
+CONFIG_USBMSC_NRDREQS=8
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=64
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+#
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=y
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=n
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/usbstorage
+#
+CONFIG_EXAMPLES_USBMSC_NLUNS=1
+CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
+CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
+CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
+CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
+CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
+
+#
+# Settings for examples/cdcacm
+#
+# Configuration prequisites:
+#
+CONFIG_EXAMPLES_CDCACM_DEVMINOR=0
+CONFIG_EXAMPLES_CDCACM_TRACEINIT=n
+CONFIG_EXAMPLES_CDCACM_TRACECLASS=n
+CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n
+CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n
+CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/ubw32/ostest/ld.script b/nuttx/configs/ubw32/ostest/ld.script
new file mode 100644
index 000000000..ff4d1c79f
--- /dev/null
+++ b/nuttx/configs/ubw32/ostest/ld.script
@@ -0,0 +1,317 @@
+/****************************************************************************
+ * configs/ubw32/ostest/ld.script
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+/* Memory Regions ***********************************************************/
+
+MEMORY
+{
+ /* The PIC32MX460F512L has 512Kb of program FLASH at physical address
+ * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
+ */
+
+ kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
+
+ /* The PIC32MX460F512L has 12Kb of boot FLASH at physical address
+ * 0x1fc00000. The initial reset vector is in KSEG1, but all other
+ * accesses are in KSEG0.
+ *
+ * REGION PHYSICAL KSEG SIZE
+ * DESCRIPTION START ADDR (BYTES)
+ * ------------- ---------- ------ ----------------------
+ * Exceptions:*
+ * Reset 0x1fc00000 KSEG1 512 512
+ * TLB Refill 0x1fc00200 KSEG1 256 768
+ * Cache Error 0x1fc00300 KSEG1 128 896
+ * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
+ * Interrupt 0x1fc00400 KSEG1 128 1152
+ * JTAG 0x1fc00480 KSEG1 16 1168
+ * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
+ * Debug code 0x1fc02000 KSEG1 4096-16 12272
+ * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
+ *
+ * Exceptions assume:
+ *
+ * STATUS: BEV=0/1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ */
+
+ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
+ kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
+ kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
+ kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
+ kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
+ kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
+ kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
+ kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
+ kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
+
+ /* The PIC32MX460F512L has 32Kb of data memory at physical address
+ * 0x00000000. Since the PIC32MX has no data cache, this memory is
+ * always accessed through KSEG1.
+ *
+ * When used with MPLAB, we need to set aside 512 bytes of memory
+ * for use by MPLAB.
+ */
+
+ kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
+}
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(__start)
+
+SECTIONS
+{
+ /* Boot FLASH sections */
+
+ .reset :
+ {
+ KEEP (*(.reset))
+ } > kseg1_reset
+
+ /* Exception handlers. The following is assumed:
+ *
+ * STATUS: BEV=1 and EXL=0
+ * CAUSE: IV=1
+ * JTAG: ProbEn=0
+ * And multi-vector support disabled
+ *
+ * In that configuration, the vector locations become:
+ *
+ * Reset, Soft Reset bfc0:0000
+ * TLB Refill bfc0:0200
+ * Cache Error bfc0:0300
+ * All others bfc0:0380
+ * Interrupt bfc0:0400
+ * EJTAG Debug bfc0:0480
+ */
+
+ /* KSEG1 exception handler "trampolines" */
+
+ .gen_excpt :
+ {
+ KEEP (*(.gen_excpt))
+ } > kseg1_genexcpt
+
+ .ebase_excpt :
+ {
+ KEEP (*(.ebase_excpt))
+ } > kseg1_ebexcpt
+
+ .bev_excpt :
+ {
+ KEEP (*(.bev_excpt))
+ } > kseg1_bevexcpt
+
+ .int_excpt :
+ {
+ KEEP (*(.int_excpt))
+ } > kseg1_intexcpt
+
+ .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
+
+ .start :
+ {
+ /* KSEG0 Reset startup logic */
+
+ *(.start)
+
+ /* KSEG0 exception handlers */
+
+ *(.nmi_handler)
+ *(.bev_handler)
+ *(.int_handler)
+ } > kseg0_bootmem
+
+ .dbg_code = ORIGIN(kseg1_dbgcode);
+
+ .devcfg :
+ {
+ KEEP (*(.devcfg))
+ } > kseg1_devcfg
+
+ /* Program FLASH sections */
+
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.stub)
+ KEEP (*(.text.*personality*))
+ *(.gnu.linkonce.t.*)
+ *(.gnu.warning)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+
+ /* Read-only data is included in the text section */
+
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.gnu.linkonce.r.*)
+
+ /* Small initialized constant global and static data */
+
+ *(.sdata2 .sdata2.*)
+ *(.gnu.linkonce.s2.*)
+
+ /* Uninitialized constant global and static data */
+
+ *(.sbss2 .sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ _etext = ABSOLUTE(.);
+ } > kseg0_progmem
+
+ /* Initialization data begins here in progmem */
+
+ _data_loaddr = LOADADDR(.data);
+
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+
+ /* RAM functions are positioned at the beginning of RAM so that
+ * they can be guaranteed to satisfy the 2Kb alignment requirement.
+ */
+
+/* This causes failures if there are no RAM functions
+ .ramfunc ALIGN(2K) :
+ {
+ _sramfunc = ABSOLUTE(.);
+ *(.ramfunc .ramfunc.*)
+ _eramfunc = ABSOLUTE(.);
+ } > kseg1_datamem AT > kseg0_progmem
+
+ _ramfunc_loadaddr = LOADADDR(.ramfunc);
+ _ramfunc_sizeof = SIZEOF(.ramfunc);
+ _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
+ _bmxdudba_address = LENGTH(kseg1_datamem) ;
+ _bmxdupba_address = LENGTH(kseg1_datamem) ;
+*/
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ KEEP (*(.gnu.linkonce.d.*personality*))
+ *(.data1)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+ _gp = ALIGN(16) + 0x7FF0 ;
+
+ .got :
+ {
+ *(.got.plt) *(.got)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .sdata :
+ {
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit8 :
+ {
+ *(.lit8)
+ } > kseg1_datamem AT > kseg0_progmem
+
+ .lit4 :
+ {
+ *(.lit4)
+ _edata = ABSOLUTE(.);
+ } >kseg1_datamem AT>kseg0_progmem
+
+ .sbss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ } >kseg1_datamem
+
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > kseg1_datamem
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/nuttx/configs/ubw32/ostest/setenv.sh b/nuttx/configs/ubw32/ostest/setenv.sh
new file mode 100755
index 000000000..6123ce6ba
--- /dev/null
+++ b/nuttx/configs/ubw32/ostest/setenv.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# configs/ubw32/ostest/setenv.sh
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+# This the Cygwin path to the location where I installed the MicroChip
+# PIC32MX toolchain under windows. This is *not* the default install
+# location so you will probably have to edit this. You will also have
+# to edit this if you install a different version of if you install
+# the Linux PIC32MX toolchain as well
+export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
+
+# This is the path to the toosl subdirectory
+export PIC32TOOL_DIR="${WD}/tools/pic32mx"
+
+# Add the path to the toolchain to the PATH varialble
+export PATH="${TOOLCHAIN_BIN}:${PIC32TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/ubw32/src/Makefile b/nuttx/configs/ubw32/src/Makefile
new file mode 100644
index 000000000..d9161f505
--- /dev/null
+++ b/nuttx/configs/ubw32/src/Makefile
@@ -0,0 +1,99 @@
+############################################################################
+# configs/ubw32/src/Makefile
+#
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+CSRCS = up_boot.c up_leds.c
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += up_buttons.c
+endif
+
+ifeq ($(CONFIG_NSH_ARCHINIT),y)
+CSRCS += up_nsh.c
+endif
+
+ifeq ($(CONFIG_PIC32MX_USBDEV),y)
+CSRCS += up_usbdev.c
+ifeq ($(CONFIG_EXAMPLES_USBTERM_DEVINIT),y)
+CSRCS += up_usbterm.c
+endif
+endif
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/ubw32/src/ubw32-internal.h b/nuttx/configs/ubw32/src/ubw32-internal.h
new file mode 100644
index 000000000..ab1710ea5
--- /dev/null
+++ b/nuttx/configs/ubw32/src/ubw32-internal.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/ubw32/src/ubw32-internal.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __CONFIGS_UBW32_SRC_UBW32_INTERNAL_H
+#define __CONFIGS_UBW32_SRC_UBW32_INTERNAL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the UBW32 board.
+ *
+ ************************************************************************************/
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2)
+EXTERN void weak_function pic32mx_spiinitialize(void);
+#endif
+
+/************************************************************************************
+ * Name: pic32mx_ledinit
+ *
+ * Description:
+ * Configure on-board LEDs if LED support has been selected.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+EXTERN void pic32mx_ledinit(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_UBW32_SRC_UBW32_INTERNAL_H */
diff --git a/nuttx/configs/ubw32/src/up_boot.c b/nuttx/configs/ubw32/src/up_boot.c
new file mode 100644
index 000000000..7e818f270
--- /dev/null
+++ b/nuttx/configs/ubw32/src/up_boot.c
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/ubw32/src/up_boot.c
+ * arch/mips/src/board/up_boot.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "ubw32-internal.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_boardinitialize
+ *
+ * Description:
+ * All PIC32MX architectures must provide the following entry point. This entry
+ * point is called early in the intitialization -- after all memory has been
+ * configured and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+void pic32mx_boardinitialize(void)
+{
+ /* Configure SPI chip selects if 1) at least one SPI is enabled, and 2) the weak
+ * function pic32mx_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2)
+ if (pic32mx_spiinitialize)
+ {
+ pic32mx_spiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ pic32mx_ledinit();
+#endif
+}
diff --git a/nuttx/configs/ubw32/src/up_buttons.c b/nuttx/configs/ubw32/src/up_buttons.c
new file mode 100644
index 000000000..4fef56705
--- /dev/null
+++ b/nuttx/configs/ubw32/src/up_buttons.c
@@ -0,0 +1,198 @@
+/****************************************************************************
+ * configs/ubw32/src/up_buttons.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "pic32mx-internal.h"
+#include "ubw-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* The UBW32 board has three buttons.
+ *
+ * PROGRAM RE7 Pulled high, Grounded/low when depressed
+ * USER RE6 Pulled high, Grounded/low when depressed
+ * RESET Not software accessible
+ */
+
+#define GPIO_PROGRAM (GPIO_INPUT|GPIO_INT|GPIO_PORTE|GPIO_PIN7)
+#define GPIO_USER (GPIO_INPUT|GPIO_INT|GPIO_PORTE|GPIO_PIN6)
+
+/* Change notification numbers:
+ *
+ * RE7 -> No change notification associated with RE7
+ * RE6 -> No change notification associated with RE6
+ */
+
+#define CN_PROGRAM
+#define CN_USER
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Pin configuration for each button */
+
+static const uint16_t g_buttonset[NUM_BUTTONS] =
+{
+ GPIO_PROGRAM GPIO_USER
+}
+
+/* Change notification number for each button */
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+static const uint8_t g_buttoncn[NUM_BUTTONS] =
+{
+ CN_PROGRAM, CN_USER
+}
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure input pins */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ pic32mx_configgpio(g_buttonset[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+uint8_t up_buttons(void)
+{
+ uint8_t ret = 0;
+ int id;
+
+ /* Configure input pins */
+
+ for (id = 0; id < NUM_BUTTONS; id++)
+ {
+ if (pic32mx_gpioread(g_buttonset[id]))
+ {
+ ret |= (1 << id);
+ }
+ }
+
+ return ret;
+}
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After
+ * that, up_buttons() may be called to collect the current state of all
+ * buttons or up_irqbutton() may be called to register button interrupt
+ * handlers.
+ *
+ * After up_buttoninit() has been called, up_buttons() may be called to
+ * collect the state of all buttons. up_buttons() returns an 8-bit bit set
+ * with each bit associated with a button. See the BUTTON_*_BIT definitions in
+ * board.h for the meaning of each bit.
+ *
+ * up_irqbutton() may be called to register an interrupt handler that will
+ * be called when a button is depressed or released. The ID value is a
+ * button enumeration value that uniquely identifies a button resource. See the
+ * BUTTON_* definitions in board.h for the meaning of enumeration value. The
+ * previous interrupt handler address is returned (so that it may restored, if
+ * so desired).
+ *
+ * Interrupts are automatically enabled when the button handler is attached and
+ * automatically disabled when the button handler is detached.
+ *
+ * When an interrupt occurs, it is due to a change on the GPIO input pin
+ * associated with the button. In that case, all attached change
+ * notification handlers will be called. Each handler must maintain state
+ * and determine if the unlying GPIO button input value changed.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+{
+ xcpt_t oldhandler = NULL;
+
+ if (id < NUM_BUTTONS)
+ {
+ oldhandler = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], irqhandler);
+ if (irqbuttron)
+ {
+ pic32mx_gpioirqenable(g_buttoncn[id]);
+ }
+ }
+ return oldhandler;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/ubw32/src/up_leds.c b/nuttx/configs/ubw32/src/up_leds.c
new file mode 100644
index 000000000..dbbffdff5
--- /dev/null
+++ b/nuttx/configs/ubw32/src/up_leds.c
@@ -0,0 +1,266 @@
+/****************************************************************************
+ * configs/ubw32/src/up_leds.c
+ * arch/arm/src/board/up_leds.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <arch/board/board.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "pic32mx-internal.h"
+#include "ubw32-internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+/* LED Configuration ********************************************************/
+/* ----- ----- -------------------------------------------------------------
+ * LABEL COLOR CONTROL
+ * ----- ----- -------------------------------------------------------------
+ * USB Green RF3. This could be used by software if USB is not used.
+ * Otherwise, RF3 is used as the USBID signal.
+ * LED1 While RE2, Pulled up. Low value illuminates
+ * LED2 Red RE1, Pulled up. Low value illuminates
+ * LED3 Yellow RE0, Pulled up. Low value illuminates
+ * PWR Blue Illuminated when 5V is present, not controlled by software
+ *
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows:
+ *
+ * ON OFF
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED1 LED2 LED3 LED1 LED2 LED3
+ * ------------------------- ---- ---- ---- ---- ---- ----
+ * LED_STARTED 0 OFF OFF OFF --- --- ---
+ * LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ * LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ * LED_STACKCREATED 3 ON ON N/C --- --- ---
+ * LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ * LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ * LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
+ */
+
+#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTE|GPIO_PIN2)
+#define GPIO_LED_2 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTE|GPIO_PIN1)
+#define GPIO_LED_3 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTE|GPIO_PIN0)
+
+/* LED Management Definitions ***********************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+# define LED_OFF 0
+# define LED_ON 1
+# define LED_NC 2
+#endif
+
+/* Debug ********************************************************************/
+
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_LEDS)
+# define leddbg lldbg
+# ifdef CONFIG_DEBUG_VERBOSE
+# define ledvdbg lldbg
+# else
+# define ledvdbg(x...)
+# endif
+#else
+# undef CONFIG_DEBUG_LEDS
+# undef CONFIG_DEBUG_VERBOSE
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+/****************************************************************************
+ * Private types
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+struct led_setting_s
+{
+ uint8_t led1 : 2;
+ uint8_t led2 : 2;
+ uint8_t led3 : 2;
+ uint8_t unused : 2;
+};
+#endif
+
+ /****************************************************************************
+ * Private Data
+ ****************************************************************************/
+/* If CONFIG_ARCH_LEDS is defined then NuttX will control the LEDs. The
+ * following structures identified the LED settings for each NuttX LED state.
+ */
+
+#ifdef CONFIG_ARCH_LEDS
+static const struct led_setting_s g_ledonvalues[LED_NVALUES] =
+{
+ {LED_OFF, LED_OFF, LED_OFF, LED_OFF},
+ {LED_ON, LED_OFF, LED_NC, LED_OFF},
+ {LED_OFF, LED_ON, LED_NC, LED_OFF},
+ {LED_ON, LED_ON, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_ON, LED_OFF},
+ {LED_ON, LED_NC, LED_NC, LED_OFF},
+};
+
+static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
+{
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_NC, LED_OFF},
+ {LED_NC, LED_NC, LED_OFF, LED_OFF},
+ {LED_OFF, LED_NC, LED_NC, LED_OFF},
+};
+
+/* If CONFIG_ARCH_LEDS is not defined, the the user can control the LEDs in
+ * any way. The following array simply maps the PIC32MX_UBW32_LEDn
+ * index values to the correct LED pin configuration.
+ */
+
+#else
+static const uint16_t g_ledpincfg[PIC32MX_UBW32_NLEDS] =
+{
+ GPIO_LED_1, GPIO_LED_2, GPIO_LED_3
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setleds
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_setleds(FAR const struct led_setting_s *setting)
+{
+ if (setting->led1 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_1, setting->led1 == LED_ON);
+ }
+
+ if (setting->led2 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_2, setting->led2 == LED_ON);
+ }
+
+ if (setting->led3 != LED_NC)
+ {
+ pic32mx_gpiowrite(GPIO_LED_3, setting->led3 == LED_ON);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pic32mx_ledinit
+ ****************************************************************************/
+
+void pic32mx_ledinit(void)
+{
+ /* Configure output pins */
+
+ pic32mx_configgpio(GPIO_LED_1);
+ pic32mx_configgpio(GPIO_LED_2);
+ pic32mx_configgpio(GPIO_LED_3);
+}
+
+/****************************************************************************
+ * Name: pic32mx_setled
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setled(int led, bool ledon)
+{
+ if ((unsigned)led < PIC32MX_UBW32_NLEDS)
+ {
+ pic32mx_gpiowrite(g_ledpincfg[led], ledon);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: pic32mx_setleds
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_LEDS
+void pic32mx_setleds(uint8_t ledset)
+{
+ pic32mx_setled(PIC32MX_UBW32_LED1, (ledset & PIC32MX_UBW32_LED1_BIT) != 0);
+ pic32mx_setled(PIC32MX_UBW32_LED2, (ledset & PIC32MX_UBW32_LED2_BIT) != 0);
+ pic32mx_setled(PIC32MX_UBW32_LED3, (ledset & PIC32MX_UBW32_LED3_BIT) != 0);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledon(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledonvalues[led]);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledoff(int led)
+{
+ if ((unsigned)led < LED_NVALUES)
+ {
+ up_setleds(&g_ledoffvalues[led]);
+ }
+}
+#endif
diff --git a/nuttx/configs/ubw32/src/up_nsh.c b/nuttx/configs/ubw32/src/up_nsh.c
new file mode 100644
index 000000000..5e5895b63
--- /dev/null
+++ b/nuttx/configs/ubw32/src/up_nsh.c
@@ -0,0 +1,119 @@
+/****************************************************************************
+ * config/ubw32/src/up_nsh.c
+ * arch/arm/src/board/up_nsh.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+
+#include "pic32mx-internal.h"
+#include "ubw32-internal.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_usbdevinitialize
+ *
+ * Description:
+ * Initialize SPI-based microSD.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBDEV
+static int nsh_usbdevinitialize(void)
+{
+ /* The UBW32 has no way to know when the USB is connected. So we will fake
+ * it and tell the USB driver that the USB is connected now.
+ */
+
+ pic32mx_usbattach();
+ return OK;
+}
+#else
+# define nsh_usbdevinitialize() (OK)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nsh_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int nsh_archinitialize(void)
+{
+ int ret;
+
+ /* Initialize USB device */
+
+ ret = nsh_usbdevinitialize();
+ return ret;
+}
diff --git a/nuttx/configs/ubw32/src/up_usbdev.c b/nuttx/configs/ubw32/src/up_usbdev.c
new file mode 100644
index 000000000..3d14c9de1
--- /dev/null
+++ b/nuttx/configs/ubw32/src/up_usbdev.c
@@ -0,0 +1,148 @@
+/************************************************************************************
+ * configs/ubw32/src/up_usbdev.c
+ * arch/arm/src/board/up_usbdev.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "ubw32-internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV)
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: pic32mx_usbdevinitialize
+ *
+ * Description:
+ * Called to configure the mini-A/B J5 on the UBW32 for the
+ * USB device
+ *
+ ************************************************************************************/
+
+void weak_function pic32mx_usbdevinitialize(void)
+{
+ /* Notes from the Sure Electronics sample code:
+ *
+ * "The USB specifications require that USB peripheral devices must never source
+ * current onto the Vbus pin. Additionally, USB peripherals should not source
+ * current on D+ or D- when the host/hub is not actively powering the Vbus line.
+ * When designing a self powered (as opposed to bus powered) USB peripheral
+ * device, the firmware should make sure not to turn on the USB module and D+
+ * or D- pull up resistor unless Vbus is actively powered. Therefore, the
+ * firmware needs some means to detect when Vbus is being powered by the host.
+ * A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and
+ * can be used to detect when Vbus is high (host actively powering), or low
+ * (host is shut down or otherwise not supplying power). The USB firmware
+ * can then periodically poll this I/O pin to know when it is okay to turn on
+ * the USB module/D+/D- pull up resistor. When designing a purely bus powered
+ * peripheral device, it is not possible to source current on D+ or D- when the
+ * host is not actively providing power on Vbus. Therefore, implementing this
+ * bus sense feature is optional. ..."
+ */
+
+#ifdef CONFIG_USBHOST
+#endif
+
+ /* "If the host PC sends a GetStatus (device) request, the firmware must respond
+ * and let the host know if the USB peripheral device is currently bus powered
+ * or self powered. See chapter 9 in the official USB specifications for details
+ * regarding this request. If the peripheral device is capable of being both
+ * self and bus powered, it should not return a hard coded value for this request.
+ * Instead, firmware should check if it is currently self or bus powered, and
+ * respond accordingly. If the hardware has been configured like demonstrated
+ * on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the
+ * currently selected power source. ..."
+ */
+
+#ifdef CONFIG_USB_PWRSENSE
+#endif
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB
+ * software connect and disconnect), then the board software must provide
+ * stm32_pullup. See include/nuttx/usb/usbdev.h for additional description
+ * of this method. Alternatively, if no pull-up GPIO the following EXTERN
+ * can be redefined to be NULL.
+ *
+ ************************************************************************************/
+
+int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ /* The UBW32 does not have a USB pull-up */
+
+ return OK;
+}
+
+/************************************************************************************
+ * Name: pic32mx_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver
+ * is used. This function is called whenever the USB enters or leaves
+ * suspend mode. This is an opportunity for the board logic to shutdown
+ * clocks, power, etc. while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ /* Do nothing */
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV */
diff --git a/nuttx/configs/ubw32/src/up_usbterm.c b/nuttx/configs/ubw32/src/up_usbterm.c
new file mode 100644
index 000000000..401d17026
--- /dev/null
+++ b/nuttx/configs/ubw32/src/up_usbterm.c
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * configs/ubw32/src/up_usbterm.c
+ * arch/arm/src/board/up_usbterm.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+
+#include "pic32mx-internal.h"
+#include "ubw32-internal.h"
+
+#if defined(CONFIG_PIC32MX_USBDEV) && defined(CONFIG_EXAMPLES_USBTERM_DEVINIT)
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its initialization.
+ *
+ ****************************************************************************/
+
+int usbterm_devinit(void)
+{
+ /* The UBW32 has no way to know when the USB is connected. So we will fake
+ * it and tell the USB driver that the USB is connected now.
+ *
+ * If examples/usbterm is built as an NSH built-in application, then
+ * pic32mx_usbattach() will be called in nsh_archinitialize().
+ */
+
+#ifndef CONFIG_EXAMPLES_USBTERM_BUILTIN
+ pic32mx_usbattach();
+#endif
+ return OK;
+}
+
+/****************************************************************************
+ * Name:
+ *
+ * Description:
+ * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will
+ * call this user provided function as part of its termination sequence.
+ *
+ ****************************************************************************/
+
+void usbterm_devuninit(void)
+{
+ /* Tell the USB driver that the USB is no longer connected */
+
+ pic32mx_usbdetach();
+}
+
+#endif /* CONFIG_PIC32MX_USBDEV && CONFIG_EXAMPLES_USBTERM_DEVINIT */
diff --git a/nuttx/configs/us7032evb1/Kconfig b/nuttx/configs/us7032evb1/Kconfig
new file mode 100644
index 000000000..d054a1624
--- /dev/null
+++ b/nuttx/configs/us7032evb1/Kconfig
@@ -0,0 +1,13 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_TWR_K60N512
+config ARCH_LEDS
+ bool "NuttX LED support"
+ default n
+ ---help---
+ "Support control of board LEDs by NuttX to indicate system state"
+
+endif
diff --git a/nuttx/configs/us7032evb1/README.txt b/nuttx/configs/us7032evb1/README.txt
new file mode 100644
index 000000000..0b9060460
--- /dev/null
+++ b/nuttx/configs/us7032evb1/README.txt
@@ -0,0 +1,138 @@
+Status
+^^^^^^
+
+*** UNSTABLE ***
+The port is basically complete and many examples run correctly. However, there
+are remaining instabilities that make the port un-usable. The nature of these
+is not understood; the behavior is that certain SH-1 instructions stop working
+as advertised. This could be a silicon problem, some pipeline issue that is not
+handled properly by the gcc 3.4.5 toolchain (which has very limit SH-1 support
+to begin with), or perhaps with the CMON debugger. At any rate, I have exhausted
+all of the energy that I am willing to put into this cool old processor for the
+time being.
+
+Toolchain
+^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the SH toolchain (if
+ different from the default).
+
+ If you have no SH toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+
+ 1. You must have already configured Nuttx in <some-dir>nuttx.
+
+ cd tools
+ ./configure.sh us7032evb1/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/sh-defconfig .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h so that the PATH variable includes the path to the
+ newly built binaries.
+
+shterm
+^^^^^^
+
+ The USB7032EVB1 supports CMON in PROM. CMON requires special
+ serial interactions in order to upload and download program files.
+ Therefore, a standard terminal emulation program (such as minicom)
+ cannot be used.
+
+ The shterm subdirectory contains a small terminal emulation
+ program that supports these special interactions for file transfers.
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each SH-1 configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh us7032evb1/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ostest
+^^^^^^as advertised. This could be a silicon problem, some pipeline issue that is not handled properly by the gcc 3.4.5 tool
+
+This configuration directory, performs a simple OS test using
+examples/ostest.
+
+nsh
+^^^
+
+Configures the NuttShell (nsh) located at examples/nsh. The
+Configuration enables only the serial NSH interfaces.
+
+NOTE: At present, the NSH example does not run. See the "Status"
+discussion above for a full explanation.
+
+Configuration Options
+^^^^^^^^^^^^^^^^^^^^^
+
+In additional to the common configuration options listed in the
+file configs/README.txt, there are other configuration options
+specific to the SH-1
+
+Architecture selection
+
+ CONFIG_ARCH - identifies the arch subdirectory and, hence, the
+ processor architecture. This should be sh (for arch/sh)
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory.
+ This should be sh1 (for arch/sh/src/sh1 and arch/sh/include/sh1)
+ CONFIG_ARCH_SH1 and CONFIG_ARCH_CHIP_SH7032 - for use in C code. These
+ identify the particular chip or SoC that the architecture is
+ implemented in.
+ CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
+ the board that supports the particular chip or SoC. This
+ should be us7032evb1 for (configs/us7032evb1).
+ CONFIG_ARCH_BOARD_US7032EVB1 - for use in C code
+ CONFIG_ENDIAN_BIG - the SH-1 usually runs big-endian
+ CONFIG_ARCH_NOINTC - define if the architecture does not
+ support an interrupt controller or otherwise cannot support
+ APIs like up_enable_irq() and up_disable_irq(). Should be
+ defined.
+ CONFIG_ARCH_IRQPRIO
+ Define if the architecture suports prioritizaton of interrupts
+ and the up_prioritize_irq() API. Should be defined.
+ CONFIG_BOARD_LOOPSPERMSEC - for delay loops
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to SH1_LCEVB1
+ CONFIG_DRAM_SIZE - Describes the internal DRAM.
+ CONFIG_DRAM_START - The start address of internal DRAM
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_SH1_DMAC0, CONFIG_SH1_DMAC1, CONFIG_SH1_DMAC2, CONFIG_SH1_DMAC3,
+ CONFIG_SH1_ITU1, CONFIG_SH1_ITU2, CONFIG_SH1_ITU3, CONFIG_SH1_ITU4,
+ CONFIG_SH1_SCI0, CONFIG_SH1_SCI1, CONFIG_SH1_PCU, CONFIG_SH1_AD,
+ CONFIG_SH1_WDT, CONFIG_SH1_CMI - Each unused chip block should b
+ disabled to save space
+
+SH1 specific device driver settings
+
+ CONFIG_SCIn_SERIAL_CONSOLE - selects the SCIn for the
+ console and ttys0 (default is the UART0).
+ CONFIG_SCIn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_SCIn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_SCIn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_SCIn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_SCIn_PARTIY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0
+ CONFIG_SCIn_2STOP - Two stop bits
diff --git a/nuttx/configs/us7032evb1/bin/README.txt b/nuttx/configs/us7032evb1/bin/README.txt
new file mode 100644
index 000000000..45b047c91
--- /dev/null
+++ b/nuttx/configs/us7032evb1/bin/README.txt
@@ -0,0 +1,2 @@
+This directory contains scripts and host executables unique to the Hitachi
+SH-1 Low-Cost Evaluation Board, US7032EVB1
diff --git a/nuttx/configs/us7032evb1/include/README.txt b/nuttx/configs/us7032evb1/include/README.txt
new file mode 100644
index 000000000..857785f4b
--- /dev/null
+++ b/nuttx/configs/us7032evb1/include/README.txt
@@ -0,0 +1,2 @@
+This directory contains header files unique to the Hitachi SH-1 Low-Cost
+Evaluation Board, US7032EVB1
diff --git a/nuttx/configs/us7032evb1/include/board.h b/nuttx/configs/us7032evb1/include/board.h
new file mode 100644
index 000000000..3ca3476da
--- /dev/null
+++ b/nuttx/configs/us7032evb1/include/board.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+ * configs/us7032evb1/include/board.h
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef _CONFIGS_US7032EVB1_BOARD_H
+#define _CONFIGS_US7032EVB1_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "chip.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+#define SH1_CLOCK 20000000 /* 20 MHz */
+
+/* LED definitions **********************************************************/
+
+/* The SH1_LPEVB only a single LED controlled by either port A, pin 15, or
+ * port B, pin 15 (selectable via JP8).
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 1
+#define LED_STACKCREATED 1
+#define LED_INIRQ 0
+#define LED_SIGNAL 0
+#define LED_ASSERTION 0
+#define LED_PANIC 1
+
+/* Button definitions *******************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* _CONFIGS_US7032EVB1_BOARD_H */
diff --git a/nuttx/configs/us7032evb1/nsh/Make.defs b/nuttx/configs/us7032evb1/nsh/Make.defs
new file mode 100644
index 000000000..623eb82d5
--- /dev/null
+++ b/nuttx/configs/us7032evb1/nsh/Make.defs
@@ -0,0 +1,105 @@
+##############################################################################
+# configs/us7032evb1/nsh/Make.defs
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ARCHCPUFLAGS = -m1 -fno-builtin
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
+
+CROSSDEV = sh-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/us7032evb1/nsh/appconfig b/nuttx/configs/us7032evb1/nsh/appconfig
new file mode 100644
index 000000000..fe0916f95
--- /dev/null
+++ b/nuttx/configs/us7032evb1/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/us7032evb1/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/us7032evb1/nsh/defconfig b/nuttx/configs/us7032evb1/nsh/defconfig
new file mode 100644
index 000000000..02d42aebe
--- /dev/null
+++ b/nuttx/configs/us7032evb1/nsh/defconfig
@@ -0,0 +1,325 @@
+############################################################################
+# configs/us7032evb1/nsh/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sh"
+CONFIG_ARCH_SH1=y
+CONFIG_ARCH_CHIP="sh1"
+CONFIG_ARCH_CHIP_SH7032=y
+CONFIG_ARCH_BOARD="us7032evb1"
+CONFIG_ARCH_BOARD_US7032EVB1=y
+CONFIG_ENDIAN_BIG=y
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=572
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_DRAM_SIZE=57344
+CONFIG_DRAM_START=0x0a002000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# SH-1 specific boot/build settings
+#
+CONFIG_SH1_DMAC0=n
+CONFIG_SH1_DMAC1=n
+CONFIG_SH1_DMAC2=n
+CONFIG_SH1_DMAC3=n
+CONFIG_SH1_ITU1=n
+CONFIG_SH1_ITU2=n
+CONFIG_SH1_ITU3=n
+CONFIG_SH1_ITU4=n
+CONFIG_SH1_SCI0=n
+CONFIG_SH1_SCI1=y
+CONFIG_SH1_PCU=n
+CONFIG_SH1_AD=n
+CONFIG_SH1_WDT=n
+CONFIG_SH1_CMI=n
+
+#
+# SH1 specific device driver settings
+#
+CONFIG_SCI0_SERIAL_CONSOLE=n
+CONFIG_SCI1_SERIAL_CONSOLE=y
+CONFIG_SCI0_TXBUFSIZE=64
+CONFIG_SCI1_TXBUFSIZE=256
+CONFIG_SCI0_RXBUFSIZE=32
+CONFIG_SCI1_RXBUFSIZE=256
+CONFIG_SCI0_BAUD=9600
+CONFIG_SCI1_BAUD=9600
+CONFIG_SCI0_BITS=8
+CONFIG_SCI1_BITS=8
+CONFIG_SCI0_PARITY=0
+CONFIG_SCI1_PARITY=0
+CONFIG_SCI0_2STOP=0
+CONFIG_SCI1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=y
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/us7032evb1/nsh/ld.script b/nuttx/configs/us7032evb1/nsh/ld.script
new file mode 100644
index 000000000..e21bdfa00
--- /dev/null
+++ b/nuttx/configs/us7032evb1/nsh/ld.script
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * configs/us7032evb1/nsh/ld.script
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(sh)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The us7032evb1 has CMON in PROM beginning at address 0x00000000 and
+ * either 64Kb or 256Kb of SRAM beginning at 0x0a000000. Neither the
+ * PROM nor the first 8Kb of SRAM are avaible to the devoleper as these
+ * are used by CMON. The next 1Kb of SRAM is dedicated to relocated
+ * interrupt vectors.
+ */
+
+ . = 0x0a002000;
+ .text : {
+ _svect = ABSOLUTE(.);
+ *(.vects); /* Relocated interrupt vectors */
+ _evect = ABSOLUTE(.);
+ _stext = ABSOLUTE(.);
+ *(.reset) /* Reset/IRQ code */
+ *(.text) /* Code */
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata) /* Read-only data */
+ *(.rodata.str1.4)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data) /* Modifiable data */
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/us7032evb1/nsh/setenv.sh b/nuttx/configs/us7032evb1/nsh/setenv.sh
new file mode 100755
index 000000000..d23133612
--- /dev/null
+++ b/nuttx/configs/us7032evb1/nsh/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/us7032evb1/nsh/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_sh/staging_dir/bin
+export SH1BINARIES=$WD/configs/us7032evb1/bin
+export PATH=${BUILDROOT_BIN}:${SH1BINARIES}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/us7032evb1/ostest/Make.defs b/nuttx/configs/us7032evb1/ostest/Make.defs
new file mode 100644
index 000000000..dcbaefdf8
--- /dev/null
+++ b/nuttx/configs/us7032evb1/ostest/Make.defs
@@ -0,0 +1,105 @@
+##############################################################################
+# configs/us7032evb1/ostest/Make.defs
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
+ -fomit-frame-pointer
+endif
+
+ARCHCPUFLAGS = -m1 -fno-builtin
+ARCHPICFLAGS = -fpic
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
+
+CROSSDEV = sh-elf-
+CC = $(CROSSDEV)gcc
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/us7032evb1/ostest/appconfig b/nuttx/configs/us7032evb1/ostest/appconfig
new file mode 100644
index 000000000..ba7253e3f
--- /dev/null
+++ b/nuttx/configs/us7032evb1/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/us7032evb1/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/us7032evb1/ostest/defconfig b/nuttx/configs/us7032evb1/ostest/defconfig
new file mode 100644
index 000000000..f92a55461
--- /dev/null
+++ b/nuttx/configs/us7032evb1/ostest/defconfig
@@ -0,0 +1,325 @@
+############################################################################
+# configs/us7032evb1/ostest/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="sh"
+CONFIG_ARCH_SH1=y
+CONFIG_ARCH_CHIP="sh1"
+CONFIG_ARCH_CHIP_SH7032=y
+CONFIG_ARCH_BOARD="us7032evb1"
+CONFIG_ARCH_BOARD_US7032EVB1=y
+CONFIG_ENDIAN_BIG=y
+CONFIG_ARCH_NOINTC=y
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=572
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_DRAM_SIZE=57344
+CONFIG_DRAM_START=0x0a002000
+CONFIG_ARCH_INTERRUPTSTACK=0
+CONFIG_ARCH_STACKDUMP=y
+
+#
+# SH-1 specific boot/build settings
+#
+CONFIG_SH1_DMAC0=n
+CONFIG_SH1_DMAC1=n
+CONFIG_SH1_DMAC2=n
+CONFIG_SH1_DMAC3=n
+CONFIG_SH1_ITU1=n
+CONFIG_SH1_ITU2=n
+CONFIG_SH1_ITU3=n
+CONFIG_SH1_ITU4=n
+CONFIG_SH1_SCI0=n
+CONFIG_SH1_SCI1=y
+CONFIG_SH1_PCU=n
+CONFIG_SH1_AD=n
+CONFIG_SH1_WDT=n
+CONFIG_SH1_CMI=n
+
+#
+# SH1 specific device driver settings
+#
+CONFIG_SCI0_SERIAL_CONSOLE=n
+CONFIG_SCI1_SERIAL_CONSOLE=y
+CONFIG_SCI0_TXBUFSIZE=64
+CONFIG_SCI1_TXBUFSIZE=256
+CONFIG_SCI0_RXBUFSIZE=32
+CONFIG_SCI1_RXBUFSIZE=256
+CONFIG_SCI0_BAUD=9600
+CONFIG_SCI1_BAUD=9600
+CONFIG_SCI0_BITS=8
+CONFIG_SCI1_BITS=8
+CONFIG_SCI0_PARITY=0
+CONFIG_SCI1_PARITY=0
+CONFIG_SCI0_2STOP=0
+CONFIG_SCI1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=y
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=11
+CONFIG_START_DAY=10
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=5
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Architecture-specific NSH options
+CONFIG_NSH_MMCSDSPIPORTNO=1
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/us7032evb1/ostest/ld.script b/nuttx/configs/us7032evb1/ostest/ld.script
new file mode 100644
index 000000000..36c9b0d9a
--- /dev/null
+++ b/nuttx/configs/us7032evb1/ostest/ld.script
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * configs/us7032evb1/ostest/ld.script
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(sh)
+ENTRY(_stext)
+SECTIONS
+{
+ /* The us7032evb1 has CMON in PROM beginning at address 0x00000000 and
+ * either 64Kb or 256Kb of SRAM beginning at 0x0a000000. Neither the
+ * PROM nor the first 8Kb of SRAM are avaible to the devoleper as these
+ * are used by CMON. The next 1Kb of SRAM is dedicated to relocated
+ * interrupt vectors.
+ */
+
+ . = 0x0a002000;
+ .text : {
+ _svect = ABSOLUTE(.);
+ *(.vects); /* Relocated interrupt vectors */
+ _evect = ABSOLUTE(.);
+ _stext = ABSOLUTE(.);
+ *(.reset) /* Reset/IRQ code */
+ *(.text) /* Code */
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata) /* Read-only data */
+ *(.rodata.str1.4)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ }
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data) /* Modifiable data */
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ }
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/us7032evb1/ostest/setenv.sh b/nuttx/configs/us7032evb1/ostest/setenv.sh
new file mode 100755
index 000000000..ac37e9150
--- /dev/null
+++ b/nuttx/configs/us7032evb1/ostest/setenv.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# configs/us7032evb1/ostest/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_sh/staging_dir/bin
+export SH1BINARIES=$WD/configs/us7032evb1/bin
+export PATH=${BUILDROOT_BIN}:${SH1BINARIES}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/us7032evb1/shterm/Makefile b/nuttx/configs/us7032evb1/shterm/Makefile
new file mode 100644
index 000000000..2ea23db33
--- /dev/null
+++ b/nuttx/configs/us7032evb1/shterm/Makefile
@@ -0,0 +1,51 @@
+############################################################################
+# config/us7032evb1/shterm/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include $(TOPDIR)/.config
+include $(TOPDIR)/Make.defs
+
+SRC = shterm.c
+BIN = shterm
+
+all: ../bin/$(BIN)$(EXEEXT)
+
+$(BIN)$(EXEEXT): $(SRC)
+ $(HOSTCC) $(HOSTCFLAGS) $^ -o $@
+
+../bin/$(BIN)$(EXEEXT): $(BIN)$(EXEEXT)
+ install --mode 0755 $^ $@
+clean:
+ @rm -f $(BIN)$(EXEEXT) ../bin/$(BIN)$(EXEEXT) *~ .*.swp *.o
+ $(call CLEAN)
diff --git a/nuttx/configs/us7032evb1/shterm/shterm.c b/nuttx/configs/us7032evb1/shterm/shterm.c
new file mode 100644
index 000000000..f9ff2994a
--- /dev/null
+++ b/nuttx/configs/us7032evb1/shterm/shterm.c
@@ -0,0 +1,737 @@
+/****************************************************************************
+ * config/us7032evb1/shterm/shterm.c
+ *
+ * Copyright(C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <ctype.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Size of the circular buffer used for interrupt I/O */
+
+#define MAX_FILEPATH 255
+
+#define ENQ 5
+#define ACK 6
+
+#define DEFAULT_BAUD 9600
+
+#define dbg(format, arg...) if (debug > 0) printconsole(format, ##arg)
+#define vdbg(format, arg...) if (debug > 1) printconsole(format, ##arg)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static void sendfile(int fdtarg, char *filename, int verify);
+static void receivefile(int fdtarg, char *filename);
+static void getfilename(int fd, char *name);
+static int readbyte(int fd, char *ch);
+static void writebyte(int fd, char byte);
+static void close_tty(void);
+static void interrupt(int signo);
+static void show_usage(const char *progname, int exitcode);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static int debug = 0;
+static int g_fd = -1;
+static int g_fdnb = -1;
+static FILE *g_logstream = NULL;
+static const char g_dfttydev[] = "/dev/ttyS0";
+static const char *g_ttydev = g_dfttydev;
+static const char *g_logfile = 0;
+static int g_baud = DEFAULT_BAUD;
+static struct termios g_termios;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: putconsole
+ ****************************************************************************/
+
+static void putconsole(char ch)
+{
+ if (g_logstream)
+ {
+ (void)putc(ch, g_logstream);
+ }
+ (void)putchar(ch);
+}
+
+/****************************************************************************
+ * Name: flushconsole
+ ****************************************************************************/
+
+static void flushconsole(void)
+{
+ if (g_logstream)
+ {
+ (void)fflush(g_logstream);
+ }
+ (void)fflush(stdout);
+}
+
+/****************************************************************************
+ * Name: printconsole
+ ****************************************************************************/
+
+static void printconsole(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ if (g_logstream)
+ {
+ (void)vfprintf(g_logstream, fmt, ap);
+ }
+ (void)vprintf(fmt, ap);
+ va_end(ap);
+}
+
+/****************************************************************************
+ * Name: sendfile
+ ****************************************************************************/
+
+static void sendfile(int fdtarg, char *filename, int verify)
+{
+ char chin;
+ char chout;
+ int fdin;
+ int nbytes;
+ int ndots;
+ int ret;
+
+ /* Source the source file */
+
+ fdin = open(filename, O_RDONLY);
+ if (fdin < 0)
+ {
+ fprintf(stderr, "ERROR: Failed to open '%s' for reading\n", filename);
+ (void)writebyte(fdin, '>');
+ return;
+ }
+
+ if (verify)
+ {
+ printconsole("Verifying file '%s':\n", filename);
+ }
+ else
+ {
+ printconsole("Loading file '%s':\n", filename);
+ }
+ flushconsole();
+
+ /* This loop processes each byte from the source file */
+
+ nbytes = 0;
+ ndots = 0;
+ while ((ret = readbyte(fdin, &chout)) == 1)
+ {
+ /* If verbose debug is OFF, then output dots at a low rate */
+
+ if (debug < 2)
+ {
+ if (++nbytes > 64)
+ {
+ nbytes = 0;
+ putconsole('.');
+ if (++ndots > 72)
+ {
+ putconsole('\n');
+ ndots = 0;
+ }
+ flushconsole();
+ }
+ }
+
+ /* If verbose debug is ON, dump everything */
+
+ else if (chout == 'S')
+ {
+ printconsole("\n[%c", chout);
+ }
+ else if (isprint(chout))
+ {
+ printconsole("[%c", chout);
+ }
+ else
+ {
+ printconsole("[.");
+ }
+
+ /* Send the byte to the target */
+
+ writebyte(fdtarg, chout);
+
+ /* Get the response from the target. Loop until the target responds
+ * by either echoing the byte sent or by sending '>'
+ */
+
+ do
+ {
+ ret = readbyte(fdtarg, &chin);
+
+ /* If verbose debug is ON, echo the response from the target */
+
+ if (ret == 1 && debug >= 2)
+ {
+ if (chin != chout)
+ {
+ if (isprint(chin))
+ {
+ putconsole(chin);
+ }
+ else
+ {
+ putconsole('.');
+ }
+ }
+ else
+ {
+ putconsole(']');
+ }
+ }
+
+ /* Check if the target is asking to terminate the transfer */
+
+ if (ret == 1 && chin == '>')
+ {
+ close(fdin);
+ writebyte(fdtarg, ACK);
+ return;
+ }
+ }
+ while (ret == 1 && chin != chout);
+ }
+
+ writebyte(fdtarg, '>');
+ do
+ {
+ ret = readbyte(fdtarg, &chin);
+ }
+ while (ret == 1 && chin != ENQ);
+ close(fdin);
+ writebyte(fdtarg, ACK);
+}
+
+/****************************************************************************
+ * Name: receivefile
+ ****************************************************************************/
+
+static void receivefile(int fdtarg, char *filename)
+{
+ char ch;
+ int fdout;
+ int nbytes;
+ int ndots;
+ int ret;
+
+ fdout = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ if (fdout < 0)
+ {
+ fprintf(stderr, "ERROR: Failed to open '%s' for writing\n", filename);
+ (void)writebyte(fdtarg, '>');
+ return;
+ }
+
+ printconsole("Receiving file '%s':\n", filename);
+ flushconsole();
+ (void)writebyte(fdtarg, '+');
+
+ /* Synchronize */
+
+ do
+ {
+ ret = readbyte(fdtarg, &ch);
+ }
+ while (ret == 1 && ch != 'S' && ch != 'Q');
+
+ nbytes = 0;
+ ndots = 0;
+
+ /* Receive the file */
+
+ while (ret == 1)
+ {
+ /* Check for end-of-file */
+
+ if (ch == '>')
+ {
+ close(fdout);
+ return;
+ }
+
+ writebyte(fdout, ch);
+
+ if (++nbytes > 256)
+ {
+ nbytes = 0;
+ putconsole('.');
+ if (++ndots > 72)
+ {
+ putconsole('\n');
+ ndots = 0;
+ }
+ flushconsole();
+ }
+
+ ret = readbyte(fdtarg, &ch);
+ if (ch == '\r')
+ {
+ writebyte(fdtarg, '+');
+ }
+ }
+
+ close (fdout);
+}
+
+/****************************************************************************
+ * Name: getfilename
+ ****************************************************************************/
+
+static void getfilename(int fd, char *name)
+{
+ char ch;
+ int ret;
+
+ /* Skip over spaces */
+
+ do
+ {
+ ret = readbyte(fd, &ch);
+ }
+ while(ch == ' ' && ret == 1);
+
+ /* Concatenate the filename */
+
+ while(ret == 1 && ch > ' ')
+ {
+ *name++ = ch;
+ ret = readbyte(fd, &ch);
+ }
+ *name++ = 0;
+}
+
+/****************************************************************************
+ * Name: readbyte
+ ****************************************************************************/
+
+static int readbyte(int fd, char *ch)
+{
+ int ret;
+
+ /* Read characters from the console, and echo them to the target tty */
+
+ ret = read(fd, ch, 1);
+ if(ret < 0)
+ {
+ if(errno != EAGAIN)
+ {
+ printconsole("ERROR: Failed to read from fd=%d: %s\n", fd, strerror(errno));
+ close_tty();
+ exit(12);
+ }
+ return -EAGAIN;
+ }
+ else if(ret > 1)
+ {
+ printconsole("ERROR: Unexpected number of bytes read(%d) from fd=%d\n", ret, fd);
+ close_tty();
+ exit(13);
+ }
+ return ret;
+}
+
+/****************************************************************************
+ * Name: writebyte
+ ****************************************************************************/
+
+static void writebyte(int fd, char byte)
+{
+ int ret = write(fd, &byte, 1);
+ if(ret < 0)
+ {
+ printconsole("ERROR: Failed to write to fd=%d: %s\n", fd, strerror(errno));
+ close_tty();
+ exit(14);
+ }
+}
+
+/****************************************************************************
+ * Name: close_tty
+ ****************************************************************************/
+
+static void close_tty(void)
+{
+ int ret;
+
+ if (g_fdnb >= 0)
+ {
+ (void)close(g_fdnb);
+ }
+
+ if (g_fd >= 0)
+ {
+ ret = tcsetattr(g_fd, TCSANOW, &g_termios);
+ if (ret < 0)
+ {
+ printconsole("ERROR: Failed to restore termios for %s: %s\n", g_ttydev, strerror(errno));
+ }
+ (void)close(g_fd);
+ }
+
+ if (g_logstream >= 0)
+ {
+ (void)fclose(g_logstream);
+ }
+}
+
+/****************************************************************************
+ * Name: interrupt
+ ****************************************************************************/
+
+static void interrupt(int signo)
+{
+ printconsole("Exit-ing...\n");
+ close_tty();
+ exit(0);
+}
+
+/****************************************************************************
+ * Name: interrupt
+ ****************************************************************************/
+
+static void show_usage(const char *progname, int exitcode)
+{
+ fprintf(stderr, "\nUSAGE: %s [-h] [-d] [-t <ttyname>] [-b <baud>] [-l <log-file>]\n", progname);
+ fprintf(stderr, "\nWhere:\n");
+ fprintf(stderr, "\t-h: Prints this message then exit.\n");
+ fprintf(stderr, "\t-d: Enable debug output (twice for verbose output).\n");
+ fprintf(stderr, "\t-t <ttyname>: Use <ttyname> device instead of %s.\n", g_dfttydev);
+ fprintf(stderr, "\t-b <baud>: Use <baud> instead of %d.\n", DEFAULT_BAUD);
+ fprintf(stderr, "\t-l <log-file>: Echo console output in <log-file>.\n");
+ exit(exitcode);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+int main(int argc, char **argv, char **envp)
+{
+ struct termios tty;
+ char filename[MAX_FILEPATH];
+ char ch;
+ int speed;
+ int opt;
+ int oflags;
+ int ret;
+
+ while((opt = getopt(argc, argv, ":dt:b:hl:")) != -1)
+ {
+ switch(opt)
+ {
+ case 'd':
+ debug++;
+ break;
+
+ case 't':
+ g_ttydev = optarg;
+ break;
+
+ case 'b':
+ g_baud = atoi(optarg);
+ break;
+
+ case 'h':
+ show_usage(argv[0], 0);
+ break;
+
+ case 'l':
+ g_logfile = optarg;
+ break;
+
+ case ':':
+ fprintf(stderr, "ERROR: Missing argument to option '%c'\n", optopt);
+ show_usage(argv[0], 1);
+ break;
+
+ case '?':
+ fprintf(stderr, "ERROR: Unrecognized option '%c'\n", optopt);
+ show_usage(argv[0], 2);
+ break;
+ }
+ }
+
+ if(optind < argc)
+ {
+ fprintf(stderr, "ERROR: Unexpected arguments at end of line\n");
+ show_usage(argv[0], 3);
+ }
+
+ switch(g_baud)
+ {
+ case 0: speed = B0; break;
+ case 50: speed = B50; break;
+ case 75: speed = B75; break;
+ case 110: speed = B110; break;
+ case 134: speed = B134; break;
+ case 150: speed = B150; break;
+ case 200: speed = B200; break;
+ case 300: speed = B300; break;
+ case 600: speed = B600; break;
+ case 1200: speed = B1200; break;
+ case 1800: speed = B1800; break;
+ case 2400: speed = B2400; break;
+ case 4800: speed = B4800; break;
+ case 9600: speed = B9600; break;
+ case 19200: speed = B19200; break;
+ case 38400: speed = B38400; break;
+ case 57600: speed = B57600; break;
+ case 115200: speed = B115200; break;
+ case 230400: speed = B230400; break;
+
+ default:
+ fprintf(stderr, "ERROR: Unsupported BAUD=%d\n", g_baud);
+ show_usage(argv[0], 4);
+ }
+
+ /* Was a log file specified? */
+
+ if (g_logfile)
+ {
+ g_logstream = fopen(g_logfile, "w");
+ if (!g_logstream)
+ {
+ fprintf(stderr, "ERROR: Failed to open '%s' for writing\n", g_logfile);
+ return 5;
+ }
+ }
+
+ /* Set the host stdin to O_NONBLOCK */
+
+ oflags = fcntl(0, F_GETFL, 0);
+ if(oflags == -1)
+ {
+ fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
+ return 6;
+ }
+
+ ret = fcntl(0, F_SETFL, oflags | O_NONBLOCK);
+ if(ret < 0)
+ {
+ fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
+ return 7;
+ }
+
+ /* Open the selected serial port (blocking)*/
+
+ g_fd = open(g_ttydev, O_RDWR);
+ if(g_fd < 0)
+ {
+ printconsole("ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
+ return 8;
+ }
+
+ /* Configure the serial port in at the selected baud in 8-bit, no-parity, raw mode
+ * and turn off echo, etc.
+ */
+
+ ret = tcgetattr(g_fd, &g_termios);
+ if(ret < 0)
+ {
+ printconsole("ERROR: Failed to get termios for %s: %s\n", g_ttydev, strerror(errno));
+ close(g_fd);
+ return 9;
+ }
+
+ memcpy(&tty, &g_termios, sizeof(struct termios));
+ tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ tty.c_oflag &= ~OPOST;
+ tty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ tty.c_cflag &= ~(CSIZE|PARENB);
+ tty.c_cflag |= CS8;
+
+ (void)cfsetispeed(&tty, speed);
+ (void)cfsetospeed(&tty, speed);
+
+ ret = tcsetattr(g_fd, TCSANOW, &tty);
+ if(ret < 0)
+ {
+ printconsole("ERROR: Failed to set termios for %s: %s\n", g_ttydev, strerror(errno));
+ close(g_fd);
+ return 10;
+ }
+
+#if 1
+ /* Open the selected serial port (non-blocking)*/
+
+ g_fdnb = open(g_ttydev, O_RDONLY | O_NONBLOCK);
+ if(g_fdnb < 0)
+ {
+ printconsole("ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
+ return 11;
+ }
+#else
+ /* Create a non-blocking copy of the configure tty descriptor */
+
+ g_fdnb = dup(g_fd);
+ if (g_fdnb < 0)
+ {
+ printconsole("ERROR: Failed to dup %s fd=%d: %s\n", g_ttydev, g_fd, strerror(errno));
+ close_tty();
+ return 12;
+ }
+
+ oflags = fcntl(g_fdnb, F_GETFL, 0);
+ if(oflags == -1)
+ {
+ fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
+ close_tty();
+ return 13;
+ }
+
+ ret = fcntl(g_fdnb, F_SETFL, oflags | O_NONBLOCK);
+ if(ret < 0)
+ {
+ fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
+ close_tty();
+ return 14;
+ }
+#endif
+
+ /* Catch attempts to control-C out of the program so that we can restore
+ * the TTY settings.
+ */
+
+ signal(SIGINT, interrupt);
+
+ /* Loopo until control-C */
+
+ for(;;)
+ {
+ /* Read characters from the console, and echo them to the target tty */
+
+ ret = readbyte(0, &ch);
+ if (ret == 0)
+ {
+ printconsole("End-of-file: exitting\n");
+ close_tty();
+ return 0;
+ }
+ else if (ret == 1)
+ {
+ writebyte(g_fd, ch);
+ }
+
+ /* Read characters from target TTY and echo them on the console */
+
+ ret = readbyte(g_fdnb, &ch);
+ if (ret == 0)
+ {
+ printconsole("ERROR: Unexpected number of bytes read(%d) from %s\n", ret, g_ttydev);
+ close_tty();
+ return 15;
+ }
+ else if (ret == 1)
+ {
+ if (ch == ENQ)
+ {
+ char ch1;
+ char ch2;
+
+ writebyte(g_fd, '*');
+ ret = readbyte(g_fd, &ch1);
+ if (ret != 1)
+ {
+ printconsole("ERROR: Unexpected number of bytes read(%d) from %s\n", ret, g_ttydev);
+ close_tty();
+ return 15;
+ }
+ ret = readbyte(g_fd, &ch2);
+ if (ret != 1)
+ {
+ printconsole("ERROR: Unexpected number of bytes read(%d) from %s\n", ret, g_ttydev);
+ close_tty();
+ return 16;
+ }
+
+ getfilename(g_fd, filename);
+
+ if (ch1 == 'l' || ch1 == 'L')
+ {
+ sendfile(g_fd, filename, 0);
+ }
+ else if (ch1 == 'v' || ch1 == 'v')
+ {
+ sendfile(g_fd, filename, 1);
+ }
+ else if (ch1 == 's' || ch1 == 'S')
+ {
+ receivefile(g_fd, filename);
+ }
+ }
+ else
+ {
+ putconsole(ch);
+ flushconsole();
+ }
+ }
+ }
+ return 0;
+}
diff --git a/nuttx/configs/us7032evb1/src/Makefile b/nuttx/configs/us7032evb1/src/Makefile
new file mode 100644
index 000000000..4ced0ac9e
--- /dev/null
+++ b/nuttx/configs/us7032evb1/src/Makefile
@@ -0,0 +1,77 @@
+############################################################################
+# configs/us7032evb1/src/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/us7032evb1/src/README.txt b/nuttx/configs/us7032evb1/src/README.txt
new file mode 100644
index 000000000..e55f25d13
--- /dev/null
+++ b/nuttx/configs/us7032evb1/src/README.txt
@@ -0,0 +1,3 @@
+This directory contains drivers unique to the Hitachi SH-1 Low-Cost
+Evaluation Board, US7032EVB1
+
diff --git a/nuttx/configs/us7032evb1/src/up_leds.c b/nuttx/configs/us7032evb1/src/up_leds.c
new file mode 100644
index 000000000..d532bc355
--- /dev/null
+++ b/nuttx/configs/us7032evb1/src/up_leds.c
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * configs/us7032evb1/src/up_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* The SH1_LPEVB only a single LED controlled by either port A, pin 15, or
+ * port B, pin 15 (selectable via JP8). In this file, we assume the portB
+ * setup.
+ */
+
+#define SH1_PBDR_LED 0x8000
+#define SH1_PBIOR_LED 0x8000
+#define SH1_PBCR2_LED 0xc000
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ uint16_t reg16;
+
+ /* Setup port B, pin 15 as an output */
+
+ reg16 = getreg16(SH1_PFC_PBIOR);
+ reg16 |= SH1_PBIOR_LED;
+ putreg16(reg16, SH1_PFC_PBIOR);
+
+ /* Setup port B, pin 15 as a normal I/O register */
+
+ reg16 = getreg16(SH1_PFC_PBCR1);
+ reg16 &= ~SH1_PBCR2_LED;
+ putreg16(reg16, SH1_PFC_PBCR1);
+
+ /* Turn the LED off */
+
+ reg16 = getreg16(SH1_PORTB_DR);
+ reg16 &= ~SH1_PBDR_LED;
+ putreg16(reg16, SH1_PORTB_DR);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ uint16_t reg16;
+
+ if (led)
+ {
+ /* Turn the LED on */
+
+ reg16 = getreg16(SH1_PORTB_DR);
+ reg16 |= SH1_PBDR_LED;
+ putreg16(reg16, SH1_PORTB_DR);
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ uint16_t reg16;
+
+ if (led)
+ {
+ /* Turn the LED off */
+
+ reg16 = getreg16(SH1_PORTB_DR);
+ reg16 &= ~SH1_PBDR_LED;
+ putreg16(reg16, SH1_PORTB_DR);
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/vsn/Kconfig b/nuttx/configs/vsn/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/vsn/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/vsn/README.txt b/nuttx/configs/vsn/README.txt
new file mode 100644
index 000000000..9a9209ebe
--- /dev/null
+++ b/nuttx/configs/vsn/README.txt
@@ -0,0 +1,257 @@
+README
+^^^^^^
+
+This README discusses issues unique to NuttX configurations for the
+ISOTEL NetClamps VSN V1.2 ready2go sensor network platform.
+More information can be found at http://www.netclamps.com
+
+Contents
+^^^^^^^^
+
+ - Development Environment
+ - GNU Toolchain Options
+ - IDEs
+ - NuttX buildroot Toolchain
+ - DFU
+ - LEDs
+ - VSN-specific Configuration Options
+ - Configurations
+
+Development Environment
+^^^^^^^^^^^^^^^^^^^^^^^
+
+ Either Linux or Cygwin on Windows can be used for the development environment.
+ The source has been built only using the GNU toolchain (see below). Other
+ toolchains will likely cause problems. Testing was performed using the Cygwin
+ environment because the Raisonance R-Link emulatator and some RIDE7 development tools
+ were used and those tools works only under Windows.
+
+GNU Toolchain Options
+^^^^^^^^^^^^^^^^^^^^^
+
+ The NuttX make system has been modified to support the following different
+ toolchain options.
+
+ 1. The CodeSourcery GNU toolchain,
+ 2. The devkitARM GNU toolchain,
+ 3. Raisonance GNU toolchain, or
+ 4. The NuttX buildroot Toolchain (see below).
+
+ All testing has been conducted using the NuttX buildroot toolchain. However,
+ the make system is setup to default to use the devkitARM toolchain. To use
+ the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
+ add one of the following configuration options to your .config (or defconfig)
+ file:
+
+ CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
+ CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
+ CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+
+ If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify
+ the PATH in the setenv.h file if your make cannot find the tools.
+
+ NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
+ Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
+ toolchains are Cygwin and/or Linux native toolchains. There are several limitations
+ to using a Windows based toolchain in a Cygwin environment. The three biggest are:
+
+ 1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
+ performed automatically in the Cygwin makefiles using the 'cygpath' utility
+ but you might easily find some new path problems. If so, check out 'cygpath -w'
+
+ 2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
+ are used in Nuttx (e.g., include/arch). The make system works around these
+ problems for the Windows tools by copying directories instead of linking them.
+ But this can also cause some confusion for you: For example, you may edit
+ a file in a "linked" directory and find that your changes had no effect.
+ That is because you are building the copy of the file in the "fake" symbolic
+ directory. If you use a Windows toolchain, you should get in the habit of
+ making like this:
+
+ make clean_context all
+
+ An alias in your .bashrc file might make that less painful.
+
+ 3. Dependencies are not made when using Windows versions of the GCC. This is
+ because the dependencies are generated using Windows pathes which do not
+ work with the Cygwin make.
+
+ Support has been added for making dependencies with the windows-native toolchains.
+ That support can be enabled by modifying your Make.defs file as follows:
+
+ - MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ + MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
+
+ If you have problems with the dependency build (for example, if you are not
+ building on C:), then you may need to modify tools/mkdeps.sh
+
+ NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
+ level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
+ -Os.
+
+ NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
+ the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
+ path or will get the wrong version of make.
+
+IDEs
+^^^^
+
+ NuttX is built using command-line make. It can be used with an IDE, but some
+ effort will be required to create the project (There is a simple RIDE project
+ in the RIDE subdirectory).
+
+ Makefile Build
+ --------------
+ Under Eclipse, it is pretty easy to set up an "empty makefile project" and
+ simply use the NuttX makefile to build the system. That is almost for free
+ under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
+ makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
+ there is a lot of help on the internet).
+
+ Native Build
+ ------------
+ Here are a few tips before you start that effort:
+
+ 1) Select the toolchain that you will be using in your .config file
+ 2) Start the NuttX build at least one time from the Cygwin command line
+ before trying to create your project. This is necessary to create
+ certain auto-generated files and directories that will be needed.
+ 3) Set up include pathes: You will need include/, arch/arm/src/stm32,
+ arch/arm/src/common, arch/arm/src/armv7-m, and sched/.
+ 4) All assembly files need to have the definition option -D __ASSEMBLY__
+ on the command line.
+
+ Startup files will probably cause you some headaches. The NuttX startup file
+ is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
+ one time from the Cygwin command line in order to obtain the pre-built
+ startup object needed by RIDE.
+
+NuttX buildroot Toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ A GNU GCC-based toolchain is assumed. The files */setenv.sh should
+ be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
+ different from the default in your PATH variable).
+
+ If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
+ SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
+ This GNU toolchain builds and executes in the Linux or Cygwin environment.
+
+ 1. You must have already configured Nuttx in <some-dir>/nuttx.
+
+ cd tools
+ ./configure.sh vsn/<sub-dir>
+
+ 2. Download the latest buildroot package into <some-dir>
+
+ 3. unpack the buildroot tarball. The resulting directory may
+ have versioning information on it like buildroot-x.y.z. If so,
+ rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
+
+ 4. cd <some-dir>/buildroot
+
+ 5. cp configs/cortexm3-defconfig-4.3.3 .config
+
+ 6. make oldconfig
+
+ 7. make
+
+ 8. Edit setenv.h, if necessary, so that the PATH variable includes
+ the path to the newly built binaries.
+
+ See the file configs/README.txt in the buildroot source tree. That has more
+ detailed PLUS some special instructions that you will need to follow if you are
+ building a Cortex-M3 toolchain for Cygwin under Windows.
+
+
+VSN-specific Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
+
+ CONFIG_ARCH=arm
+
+ CONFIG_ARCH_family - For use in C code:
+
+ CONFIG_ARCH_ARM=y
+
+ CONFIG_ARCH_architecture - For use in C code:
+
+ CONFIG_ARCH_CORTEXM3=y
+
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+
+ CONFIG_ARCH_CHIP=stm32
+
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
+
+ CONFIG_ARCH_CHIP_STM32F103RET6
+
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
+
+ CONFIG_ARCH_BOARD=vsn (for the VSN development board)
+
+ CONFIG_ARCH_BOARD_name - For use in C code
+
+ CONFIG_ARCH_BOARD_VSN=y
+
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
+
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
+
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+
+ CONFIG_DRAM_START - The start address of installed DRAM
+
+ CONFIG_DRAM_START=0x20000000
+
+ CONFIG_ARCH_IRQPRIO - The STM32F103Z supports interrupt prioritization
+
+ CONFIG_ARCH_IRQPRIO=y
+
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
+
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
+
+
+Configurations
+^^^^^^^^^^^^^^
+
+Each VSN configuration is maintained in a sudirectory and
+can be selected as follow:
+
+ cd tools
+ ./configure.sh vsn/<subdir>
+ cd -
+ . ./setenv.sh
+
+Where <subdir> is one of the following:
+
+ nsh:
+ Configures the NuttShell (nsh) located at examples/nsh. The
+ Configuration enables both the serial and telnetd NSH interfaces.
+
+The default configuration sets up a console on front-panel RS-232
+interface, sets up device driver of all supported equipment and
+links in VSN default applications.
diff --git a/nuttx/configs/vsn/include/board.h b/nuttx/configs/vsn/include/board.h
new file mode 100644
index 000000000..dbed25c19
--- /dev/null
+++ b/nuttx/configs/vsn/include/board.h
@@ -0,0 +1,243 @@
+/************************************************************************************
+ * configs/vsn/include/board.h
+ * include/arch/board/board.h
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011 Uros Platise. All rights reserved
+ *
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+#include "stm32_rcc.h"
+#include "stm32_sdio.h"
+#include "stm32_internal.h"
+
+#include "muxbus.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Clocking *************************************************************************/
+
+/* On-board external frequency source is 9MHz (HSE) provided by the CC1101, so it is
+ * not available on power-up. Instead we are about to run on HSI*9 = 36 MHz, see
+ * up_sysclock.c for details.
+ */
+
+#define STM32_BOARD_XTAL 9000000UL
+#define STM32_BOARD_HCLK 36000000UL
+
+/* PLL source is either HSI or HSE
+ * When HSI: PLL multiplier is 9, out frequency 36 MHz
+ * When HSE: PLL multiplier is 8: out frequency is 9 MHz x 8 = 72MHz
+ */
+
+#define STM32_CFGR_PLLSRC_HSI 0
+#define STM32_CFGR_PLLMUL_HSI RCC_CFGR_PLLMUL_CLKx9
+
+#define STM32_CFGR_PLLXTPRE_HSE 0
+#define STM32_CFGR_PLLSRC_HSE RCC_CFGR_PLLSRC
+#define STM32_CFGR_PLLMUL_HSE RCC_CFGR_PLLMUL_CLKx8
+
+/* Use the PLL and set the SYSCLK source to be the PLL */
+
+#define STM32_SYSCLK_SW RCC_CFGR_SW_PLL
+#define STM32_SYSCLK_SWS RCC_CFGR_SWS_PLL
+
+/* AHB clock (HCLK, 36 MHz) is SYSCLK on HSI or SYSCLK/2 on HSE */
+
+#define STM32_RCC_CFGR_HPRE_HSI RCC_CFGR_HPRE_SYSCLK
+#define STM32_RCC_CFGR_HPRE_HSE RCC_CFGR_HPRE_SYSCLKd2
+#define STM32_HCLK_FREQUENCY STM32_BOARD_HCLK
+
+/* APB2 clock (PCLK2) is HCLK (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
+#define STM32_PCLK2_FREQUENCY STM32_BOARD_HCLK
+
+/* APB2 timers 1 and 8 will receive PCLK2. */
+
+#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
+
+/* APB1 clock (PCLK1) is HCLK (36MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK
+#define STM32_PCLK1_FREQUENCY STM32_BOARD_HCLK
+
+/* APB1 timers 2-4 will receive PCLK1. */
+
+#define STM32_APB1_TIM2_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
+
+/* Timer 1..8 Frequencies */
+
+#define STM32_TIM27_FREQUENCY (STM32_BOARD_HCLK)
+#define STM32_TIM18_FREQUENCY (STM32_BOARD_HCLK)
+
+/* USB divider -- Divide PLL clock by 1.5 */
+
+#define STM32_CFGR_USBPRE 0
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode.
+ *
+ * SDcard default speed has max SDIO_CK freq of 25 MHz (12.5 Mbps)
+ * After selection of high speed freq may be 50 MHz (25 Mbps)
+ * Recommended default voltage: 3.3 V
+ *
+ * HCLK=36MHz, SDIOCLK=36 MHz, SDIO_CK=HCLK/(88+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (88 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: HCLK=36 MHz, SDIOCLK=36MHz, SDIO_CK=HCLK/(0+2)=18 MHz
+ * DMA OFF: HCLK=36 MHz, SDIOCLK=36MHz, SDIO_CK=HCLK/(1+2)=12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (0 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# ifndef CONFIG_DEBUG
+# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+# else
+# define SDIO_MMCXFR_CLKDIV (10 << SDIO_CLKCR_CLKDIV_SHIFT)
+# endif
+#endif
+
+/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(0+2)=18 MHz
+ * DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=12 MHz
+ * Extra slow down in debug mode to get rid of underruns.
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (0 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# ifndef CONFIG_DEBUG
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+# else
+# define SDIO_SDXFR_CLKDIV (10 << SDIO_CLKCR_CLKDIV_SHIFT)
+# endif
+#endif
+
+/* LED definitions ******************************************************************/
+
+/* The VSN has one LED that we will encode as: */
+
+#define LED_STARTED 0 /* ... */
+#define LED_HEAPALLOCATE 1 /* ... */
+#define LED_IRQSENABLED 2 /* ... */
+#define LED_STACKCREATED 3 /* ... */
+#define LED_INIRQ 4 /* ... */
+#define LED_SIGNAL 5 /* ... */
+#define LED_ASSERTION 6 /* ... */
+#define LED_PANIC 7 /* ... */
+#define LED_IDLE 8 /* shows idle state */
+
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Board Clock Configuration, called immediatelly after boot
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ ************************************************************************************/
+
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_board_clockconfig
+ *
+ * Description:
+ * Any STM32 board may replace the "standard" board clock configuration logic with
+ * its own, custom clock cofiguration logic.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
+EXTERN void stm32_board_clockconfig(void);
+#endif
+
+/************************************************************************************
+ * Button support. (TODO: button is not yet supported)
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN uint8_t up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/vsn/include/muxbus.h b/nuttx/configs/vsn/include/muxbus.h
new file mode 100644
index 000000000..595ded46f
--- /dev/null
+++ b/nuttx/configs/vsn/include/muxbus.h
@@ -0,0 +1,84 @@
+/************************************************************************************
+ * configs/vsn/include/muxbus.h
+ * include/arch/board/muxbus.h
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_MUXBUS_H
+#define __ARCH_BOARD_MUXBUS_H
+
+#ifndef __ASSEMBLY__
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/**
+ * Initialization of the semaphore and initial bus state.
+ */
+void vsn_muxbus_init(void);
+
+/**
+ * Simple Lock / Unlock Mechanism for the SDIO Interface
+ *
+ * NOTE: This function is provided for the stm32_sdio driver.
+ */
+extern void stm32_muxbus_sdio_lock(bool lock);
+
+/**
+ * Set PGA Gain of the Analog Devices AD8231 on bus shared with the
+ * SDIO interface
+ *
+ * \param gain sets the front-end gain as 2^{gain}, where gain = 0..7.
+ * Setting gain outside that range shutdowns the front-end.
+ *
+ * \return gain set or -1 if front end is put into shutdown.
+ */
+extern int vsn_muxbus_setpgagain(int gain);
+
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_MUXBUS_H */
diff --git a/nuttx/configs/vsn/include/nsh_romfsimg.h b/nuttx/configs/vsn/include/nsh_romfsimg.h
new file mode 100644
index 000000000..b3e894a5b
--- /dev/null
+++ b/nuttx/configs/vsn/include/nsh_romfsimg.h
@@ -0,0 +1,89 @@
+unsigned char romfs_img[] = {
+ 0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x02, 0x10,
+ 0xad, 0x5b, 0x65, 0xae, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56,
+ 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97,
+ 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x80, 0x2e, 0x2e, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x68, 0x2d, 0x96, 0x03, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x64, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x40,
+ 0x2e, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60,
+ 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xfe, 0xe0, 0x2e, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x29,
+ 0x8d, 0x9c, 0xab, 0xcd, 0x72, 0x63, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x63, 0x68, 0x6f,
+ 0x20, 0x22, 0x56, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6c, 0x65, 0x20,
+ 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x20, 0x4e, 0x6f, 0x64, 0x65, 0x20,
+ 0x56, 0x31, 0x2e, 0x32, 0x2c, 0x20, 0x77, 0x77, 0x77, 0x2e, 0x6e, 0x65,
+ 0x74, 0x43, 0x6c, 0x61, 0x6d, 0x70, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x22,
+ 0x0a, 0x0a, 0x23, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61,
+ 0x20, 0x52, 0x41, 0x4d, 0x44, 0x49, 0x53, 0x4b, 0x20, 0x61, 0x6e, 0x64,
+ 0x20, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x74, 0x20, 0x61, 0x74,
+ 0x20, 0x2f, 0x74, 0x6d, 0x70, 0x0a, 0x23, 0x6d, 0x6b, 0x72, 0x64, 0x20,
+ 0x2d, 0x6d, 0x20, 0x31, 0x20, 0x2d, 0x73, 0x20, 0x35, 0x31, 0x32, 0x20,
+ 0x34, 0x30, 0x0a, 0x23, 0x6d, 0x6b, 0x66, 0x61, 0x74, 0x66, 0x73, 0x20,
+ 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x0a, 0x23, 0x6d,
+ 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, 0x74,
+ 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x20, 0x2f,
+ 0x74, 0x6d, 0x70, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d,
+ 0x74, 0x20, 0x62, 0x69, 0x6e, 0x66, 0x73, 0x20, 0x2f, 0x64, 0x65, 0x76,
+ 0x2f, 0x72, 0x61, 0x6d, 0x30, 0x20, 0x2f, 0x73, 0x62, 0x69, 0x6e, 0x0a,
+ 0x0a, 0x72, 0x61, 0x6d, 0x74, 0x72, 0x6f, 0x6e, 0x20, 0x73, 0x74, 0x61,
+ 0x72, 0x74, 0x20, 0x33, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d,
+ 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f,
+ 0x6d, 0x74, 0x64, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x30, 0x20, 0x2f, 0x75,
+ 0x73, 0x72, 0x0a, 0x0a, 0x73, 0x64, 0x63, 0x61, 0x72, 0x64, 0x20, 0x73,
+ 0x74, 0x61, 0x72, 0x74, 0x20, 0x30, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
+ 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, 0x2f, 0x64, 0x65,
+ 0x76, 0x2f, 0x6d, 0x6d, 0x63, 0x73, 0x64, 0x30, 0x20, 0x2f, 0x73, 0x64,
+ 0x63, 0x61, 0x72, 0x64, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+unsigned int romfs_img_len = 1024;
diff --git a/nuttx/configs/vsn/include/power.h b/nuttx/configs/vsn/include/power.h
new file mode 100644
index 000000000..5be7ab795
--- /dev/null
+++ b/nuttx/configs/vsn/include/power.h
@@ -0,0 +1,72 @@
+/************************************************************************************
+ * configs/vsn/include/power.h
+ * include/arch/board/power.h
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_BOARD_POWER_H
+#define __ARCH_BOARD_POWER_H
+
+#ifndef __ASSEMBLY__
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/** Perform system reset on board level
+ */
+void board_power_reboot(void);
+
+/** Power off the board
+ *
+ * If it returns, then it was not possible to power-off the board due to some
+ * other constraints. In the case of VSN due to external power supply, press
+ * of a push-button or RTC alarm.
+ */
+void board_power_off(void);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_BOARD_POWER_H */
diff --git a/nuttx/configs/vsn/include/rcS.template b/nuttx/configs/vsn/include/rcS.template
new file mode 100755
index 000000000..90fd10e61
--- /dev/null
+++ b/nuttx/configs/vsn/include/rcS.template
@@ -0,0 +1,14 @@
+echo "Versatile Sensor Node V1.2, www.netClamps.com"
+
+# Create a RAMDISK and mount it at XXXRDMOUNTPOUNTXXX
+#mkrd -m XXXMKRDMINORXXX -s XXMKRDSECTORSIZEXXX XXMKRDBLOCKSXXX
+#mkfatfs /dev/ramXXXMKRDMINORXXX
+#mount -t vfat /dev/ramXXXMKRDMINORXXX XXXRDMOUNTPOUNTXXX
+
+mount -t binfs /dev/ram0 /sbin
+
+ramtron start 3
+mount -t vfat /dev/mtdblock0 /usr
+
+sdcard start 0
+mount -t vfat /dev/mmcsd0 /sdcard
diff --git a/nuttx/configs/vsn/nsh/Make.defs b/nuttx/configs/vsn/nsh/Make.defs
new file mode 100644
index 000000000..db6f64896
--- /dev/null
+++ b/nuttx/configs/vsn/nsh/Make.defs
@@ -0,0 +1,179 @@
+############################################################################
+# configs/stm3210e-eval/nsh/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# Setup for the selected toolchain
+
+ifeq ($(CONFIG_STM32_DFU),y)
+ LDSCRIPT = ld.script.dfu
+else
+ LDSCRIPT = ld.script
+endif
+
+ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
+ # CodeSourcery under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
+ # CodeSourcery under Linux
+ CROSSDEV = arm-none-eabi-
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+ MAXOPTIMIZATION = -O2
+endif
+ifeq ($(CONFIG_STM32_DEVKITARM),y)
+ # devkitARM under Windows
+ CROSSDEV = arm-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_RAISONANCE),y)
+ # Raisonance RIDE7 under Windows
+ CROSSDEV = arm-none-eabi-
+ WINTOOL = y
+ ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
+endif
+ifeq ($(CONFIG_STM32_BUILDROOT),y)
+ # NuttX buildroot under Linux or Cygwin
+ CROSSDEV = arm-elf-
+ ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ MAXOPTIMIZATION = -Os
+endif
+
+ifeq ($(WINTOOL),y)
+ # Windows-native toolchains
+ DIRLINK = $(TOPDIR)/tools/winlink.sh
+ DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+ MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
+ ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)}"
+ MAXOPTIMIZATION = -O2
+else
+ # Linux/Cygwin-native toolchain
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh
+ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+ ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)
+endif
+
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+ARCHDEFINES =
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifneq ($(CROSSDEV),arm-elf-)
+ LDFLAGS += -nostartfiles -nodefaultlibs
+endif
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+define DOWNLOAD
+ @armst /dev/ttyUSB0 nuttx.srec
+endef
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/vsn/nsh/appconfig b/nuttx/configs/vsn/nsh/appconfig
new file mode 100755
index 000000000..a07059079
--- /dev/null
+++ b/nuttx/configs/vsn/nsh/appconfig
@@ -0,0 +1,75 @@
+############################################################################
+# configs/vsn/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+########################################################################
+#
+# Applications to be included within the NuttX binary as described
+# under the apps/README.txt
+#
+# Set thi config parameter above to: CONFIG_TASK_NAME_SIZE=16
+# In order to enable argv[0]=<task name> argument set the option
+# CONFIG_TASK_NAME_SIZE=16
+#
+
+# Path to example in apps/examples containing the user_start entry point
+CONFIGURED_APPS += examples/nsh
+
+# Application Libraries
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
+# Individual selection of built-in applications:
+
+# Provide poweroff command to switch off the board
+CONFIGURED_APPS += vsn/poweroff
+
+# Provide SDcard tool
+CONFIGURED_APPS += vsn/sdcard
+
+# Provide RAMTRON tool
+CONFIGURED_APPS += vsn/ramtron
+
+# Provide System Information Utilityu
+CONFIGURED_APPS += vsn/sysinfo
+
+# Provide JAVA Virtual Machine (the Darjeeling JVM)
+#CONFIGURED_APPS += vsn/jvm
+
+# Provide UNIX style free
+CONFIGURED_APPS += system/free
+
+# Provide FLASH program installation support
+CONFIGURED_APPS += system/install
+
diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig
new file mode 100755
index 000000000..48af2e07c
--- /dev/null
+++ b/nuttx/configs/vsn/nsh/defconfig
@@ -0,0 +1,521 @@
+############################################################################
+# configs/vsn/nsh/defconfig
+#
+# Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
+# Copyright (c) 2011 Uros Platise. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+# Uros Platise <uros.platise@isotel.eu>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture Selection
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32F103RET6=y
+CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=y
+CONFIG_ARCH_BOARD="vsn"
+CONFIG_ARCH_BOARD_VSN=y
+CONFIG_BOARD_LOOPSPERMSEC=5483
+CONFIG_DRAM_SIZE=65536
+CONFIG_DRAM_START=0x20000000
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=n
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CALIBRATION=n
+CONFIG_ARCH_DMA=n
+
+#
+# Identify toolchain and linker options
+#
+CONFIG_STM32_CODESOURCERYW=n
+CONFIG_STM32_CODESOURCERYL=n
+CONFIG_STM32_DEVKITARM=n
+CONFIG_STM32_RAISONANCE=n
+CONFIG_STM32_BUILDROOT=y
+CONFIG_STM32_DFU=n
+
+#
+# STM32 JTAG Options
+#
+CONFIG_STM32_JTAG_FULL_ENABLE=n
+CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n
+CONFIG_STM32_JTAG_SW_ENABLE=n
+
+#
+# STM32 Individual Peripheral Pin Mapping
+#
+CONFIG_STM32_TIM1_FULL_REMAP=n
+CONFIG_STM32_TIM1_PARTIAL_REMAP=n
+CONFIG_STM32_TIM2_FULL_REMAP=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_1=n
+CONFIG_STM32_TIM2_PARTIAL_REMAP_2=n
+CONFIG_STM32_TIM3_FULL_REMAP=n
+CONFIG_STM32_TIM3_PARTIAL_REMAP=n
+CONFIG_STM32_TIM4_REMAP=n
+CONFIG_STM32_USART1_REMAP=n
+CONFIG_STM32_USART2_REMAP=n
+CONFIG_STM32_USART3_FULL_REMAP=n
+CONFIG_STM32_USART3_PARTIAL_REMAP=n
+CONFIG_STM32_SPI1_REMAP=n
+CONFIG_STM32_SPI3_REMAP=n
+CONFIG_STM32_I2C1_REMAP=y
+CONFIG_STM32_CAN1_REMAP1=n
+CONFIG_STM32_CAN1_REMAP2=n
+
+
+#
+# Individual subsystems can be enabled:
+# AHB:
+CONFIG_STM32_DMA1=n
+CONFIG_STM32_DMA2=n
+CONFIG_STM32_CRC=n
+CONFIG_STM32_FSMC=n
+CONFIG_STM32_SDIO=y
+# APB1:
+CONFIG_STM32_TIM2=n
+CONFIG_STM32_TIM3=y
+CONFIG_STM32_TIM4=n
+CONFIG_STM32_TIM5=n
+CONFIG_STM32_TIM6=n
+CONFIG_STM32_TIM7=n
+CONFIG_STM32_WWDG=n
+CONFIG_STM32_SPI2=y
+CONFIG_STM32_SPI3=y
+CONFIG_STM32_USART2=n
+CONFIG_STM32_USART3=n
+CONFIG_STM32_UART4=n
+CONFIG_STM32_UART5=n
+CONFIG_STM32_I2C1=y
+CONFIG_STM32_I2C2=y
+CONFIG_STM32_USB=n
+CONFIG_STM32_CAN1=n
+# Note that in order to enable RTC, BKP and PWR must be enabled
+CONFIG_STM32_BKP=y
+CONFIG_STM32_PWR=y
+CONFIG_STM32_DAC=n
+# APB2:
+CONFIG_STM32_ADC1=n
+CONFIG_STM32_ADC2=n
+CONFIG_STM32_TIM1=n
+CONFIG_STM32_SPI1=n
+CONFIG_STM32_TIM8=y
+CONFIG_STM32_USART1=y
+CONFIG_STM32_ADC3=n
+
+
+#
+# STM32F103Z specific serial device driver settings
+#
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART2_SERIAL_CONSOLE=n
+CONFIG_USART3_SERIAL_CONSOLE=n
+CONFIG_UART4_SERIAL_CONSOLE=n
+CONFIG_UART5_SERIAL_CONSOLE=n
+
+CONFIG_USART1_TXBUFSIZE=256
+CONFIG_USART2_TXBUFSIZE=256
+CONFIG_USART3_TXBUFSIZE=256
+CONFIG_UART4_TXBUFSIZE=256
+CONFIG_UART5_TXBUFSIZE=256
+
+CONFIG_USART1_RXBUFSIZE=256
+CONFIG_USART2_RXBUFSIZE=256
+CONFIG_USART3_RXBUFSIZE=256
+CONFIG_UART4_RXBUFSIZE=256
+CONFIG_UART5_RXBUFSIZE=256
+
+CONFIG_USART1_BAUD=115200
+CONFIG_USART2_BAUD=115200
+CONFIG_USART3_BAUD=115200
+CONFIG_UART4_BAUD=115200
+CONFIG_UART5_BAUD=115200
+
+CONFIG_USART1_BITS=8
+CONFIG_USART2_BITS=8
+CONFIG_USART3_BITS=8
+CONFIG_UART4_BITS=8
+CONFIG_UART5_BITS=8
+
+CONFIG_USART1_PARITY=0
+CONFIG_USART2_PARITY=0
+CONFIG_USART3_PARITY=0
+CONFIG_UART4_PARITY=0
+CONFIG_UART5_PARITY=0
+
+CONFIG_USART1_2STOP=0
+CONFIG_USART2_2STOP=0
+CONFIG_USART3_2STOP=0
+CONFIG_UART4_2STOP=0
+CONFIG_UART5_2STOP=0
+
+#
+# OS support for I2C
+#
+CONFIG_I2C=y
+
+#
+# OS support for various wireless chipsets such as
+# - Chipcon CC1101 operating in bands 300-400, 800-900 MHz
+# - Chipcon CC2500 operating in band of 2 GHz
+#
+# Note: this has (at the moment) nothing to do with WIFI
+#
+CONFIG_WIRELESS=y
+
+#
+# OS support for hardware RTC
+#
+CONFIG_RTC=y
+CONFIG_RTC_HIRES=y
+CONFIG_RTC_FREQUENCY=16384
+
+#
+# OS support for events
+#
+CONFIG_EVENT=y
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=y
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=y
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_DEBUG_FS=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=16
+CONFIG_START_YEAR=2011
+CONFIG_START_MONTH=8
+CONFIG_START_DAY=23
+CONFIG_GREGORIAN_TIME=n
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=y
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_NXFLAT=n
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=1024
+CONFIG_SIG_SIGWORK=4
+CONFIG_SCHED_WAITPID=y
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# Filesystem configuration
+#
+CONFIG_FS_FAT=y
+CONFIG_FS_NXFFS=y
+CONFIG_FS_ROMFS=y
+
+#
+# I2C Settings
+#
+CONFIG_I2C_WRITEREAD=y
+CONFIG_I2C_TRANSFER=y
+CONFIG_I2C_SLAVE=n
+
+#
+# SPI-based MMC/SD driver
+#
+CONFIG_MMCSD_NSLOTS=0
+CONFIG_MMCSD_READONLY=y
+CONFIG_MMCSD_SPICLOCK=12500000
+
+#
+# Block driver buffering
+#
+CONFIG_FS_READAHEAD=n
+CONFIG_FS_WRITEBUFFER=n
+
+#
+# SDIO-based MMC/SD driver
+#
+CONFIG_SDIO_DMA=n
+CONFIG_SDIO_WIDTH_D1_ONLY=y # Added single width support
+CONFIG_MMCSD_MMCSUPPORT=y
+CONFIG_MMCSD_HAVECARDDETECT=n
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_LLH_LEN=14
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# USB Device Configuration
+#
+CONFIG_USBDEV=n
+CONFIG_USBDEV_ISOCHRONOUS=n
+CONFIG_USBDEV_DUALSPEED=n
+CONFIG_USBDEV_SELFPOWERED=y
+CONFIG_USBDEV_REMOTEWAKEUP=n
+CONFIG_USBDEV_MAXPOWER=100
+CONFIG_USBDEV_TRACE=n
+CONFIG_USBDEV_TRACE_NRECORDS=128
+
+#
+# USB Serial Device Configuration
+#
+CONFIG_PL2303=n
+CONFIG_PL2303_EPINTIN=1
+CONFIG_PL2303_EPBULKOUT=2
+CONFIG_PL2303_EPBULKIN=3
+CONFIG_PL2303_NWRREQS=4
+CONFIG_PL2303_NRDREQS=4
+CONFIG_PL2303_VENDORID=0x067b
+CONFIG_PL2303_PRODUCTID=0x2303
+CONFIG_PL2303_VENDORSTR="Nuttx"
+CONFIG_PL2303_PRODUCTSTR="USBdev Serial"
+CONFIG_PL2303_RXBUFSIZE=512
+CONFIG_PL2303_TXBUFSIZE=512
+
+#
+# USB Storage Device Configuration
+#
+CONFIG_USBMSC=n
+CONFIG_USBMSC_EP0MAXPACKET=64
+CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKIN=5
+CONFIG_USBMSC_NRDREQS=2
+CONFIG_USBMSC_NWRREQS=2
+CONFIG_USBMSC_BULKINREQLEN=256
+CONFIG_USBMSC_BULKOUTREQLEN=256
+CONFIG_USBMSC_VENDORID=0x584e
+CONFIG_USBMSC_VENDORSTR="NuttX"
+CONFIG_USBMSC_PRODUCTID=0x5342
+CONFIG_USBMSC_PRODUCTSTR="USBdev Storage"
+CONFIG_USBMSC_VERSIONNO=0x0399
+CONFIG_USBMSC_REMOVABLE=y
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=0x0a000002
+CONFIG_EXAMPLE_UIP_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=0x0a000002
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=0x0a000001
+CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=0x0a000001
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for apps/nshlib
+#
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_ARCHINIT=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ARCHROMFS=y
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=40
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+
+#
+# Architecture-specific NSH options
+#
+CONFIG_NSH_MMCSDSPIPORTNO=0
+CONFIG_NSH_MMCSDSLOTNO=0
+CONFIG_NSH_MMCSDMINOR=0
+
+#
+# Settings for examples/usbserial
+#
+CONFIG_EXAMPLES_USBSERIAL_INONLY=n
+CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n
+CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
+
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
+
+# Application configuration
+
+CONFIG_APPS_DIR="../apps"
+
+# Provide /dev/ramX and then: mount -t binfs /dev/ram0 /bin
+CONFIG_APPS_BINDIR=y
diff --git a/nuttx/configs/vsn/nsh/ld.script b/nuttx/configs/vsn/nsh/ld.script
new file mode 100755
index 000000000..63c8585eb
--- /dev/null
+++ b/nuttx/configs/vsn/nsh/ld.script
@@ -0,0 +1,111 @@
+/****************************************************************************
+ * configs/stm3210e-eval/nsh/ld.script
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
+ * FLASH memory is aliased to address 0x0000:0000 where the code expects to
+ * begin execution by jumping to the entry point in the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/vsn/nsh/ld.script.dfu b/nuttx/configs/vsn/nsh/ld.script.dfu
new file mode 100755
index 000000000..aa077ba3b
--- /dev/null
+++ b/nuttx/configs/vsn/nsh/ld.script.dfu
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/stm3210e-eval/nsh/ld.script.dfu
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
+ * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
+ * STM3210E-EVAL's DFU bootloader is being used. In that case, the corrct
+ * load .text load address is 0x08003000 (leaving 464Kb).
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The STM32F103Z has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } >sram
+
+ .ARM.exidx : {
+ __exidx_start = ABSOLUTE(.);
+ *(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
+ } >sram
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/vsn/nsh/setenv.sh b/nuttx/configs/vsn/nsh/setenv.sh
new file mode 100755
index 000000000..3b9f7f896
--- /dev/null
+++ b/nuttx/configs/vsn/nsh/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/stm3210e-eval/dfu/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
+
+WD=`pwd`
+export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
+export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/vsn/src/Makefile b/nuttx/configs/vsn/src/Makefile
new file mode 100644
index 000000000..fe40db2a7
--- /dev/null
+++ b/nuttx/configs/vsn/src/Makefile
@@ -0,0 +1,111 @@
+############################################################################
+# configs/vsn/src/Makefile
+#
+# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+# Copyright (c) 2011 Uros Platise. All rights reserved.
+#
+# Authors: Gregory Nutt <gnutt@nuttx.org>
+# Uros Platise <uros.platise@isotel.eu>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+#$(TOPDIR)/$(CONFIG_APPS_DIR)
+APPDIR = $(TOPDIR)/../apps/
+
+-include $(APPDIR)/Make.defs
+
+APPNAME = sif
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = 4096
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+
+CSRCS = sysclock.c boot.c leds.c buttons.c spi.c \
+ usbdev.c power.c muxbus.c sif.c
+
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += usbmsc.c
+endif
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+ifeq ($(WINTOOL),y)
+ CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
+ -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
+else
+ CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
+endif
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+# Register application
+
+.context:
+ $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
+ @touch $@
+
+context: .context
+
+# Create dependencies
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend .context
+
+-include Make.dep
diff --git a/nuttx/configs/vsn/src/README.txt b/nuttx/configs/vsn/src/README.txt
new file mode 100644
index 000000000..4e2d50e0b
--- /dev/null
+++ b/nuttx/configs/vsn/src/README.txt
@@ -0,0 +1,58 @@
+
+VSN Board Support Package, for the NuttX, Uros Platise <uros.platise@isotel.eu>
+===============================================================================
+http://www.netClamps.com
+
+The directory contains start-up and board level functions.
+Execution starts in the following order:
+
+ - sysclock, immediately after reset stm32_rcc calls external
+ clock configuration when
+ CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=y
+ is set. It must be set for the VSN board.
+
+ - boot, performs initial chip and board initialization
+ - sched/os_bringup.c then calls either user_start or exec_namedapp()
+ with application as set in the .config
+
+
+Naming throughout the code
+==========================
+
+ - _init(): used to be called once only, after powerup, to perform board
+ initialization
+ - _start() or called via FS _open(): starts peripheral power, puts it
+ into operation
+ - _stop() or called via FS _close(): opposite to _start()
+
+
+System notifications (a sort of run-levels)
+===========================================
+
+On the VSN, NSH represents the core application as it supports scripts
+easily adaptable for any custom application configuration. NSH is
+invoked as follows (argument runs a script from the /etc/init.d directory):
+
+ - nsh init: on system powerup called by the NuttX APP_START
+
+TODOs:
+
+ - nsh xpowerup: run on external power used to:
+ - try to setup an USB serial connection
+ - configure SLIP mode, internet
+ - start other internet services, such as telnetd, ftpd, httpd
+
+ - nsh xpowerdown: run whenever USB recevied suspend signal or
+ external power has been removed.
+ - used to stop internet services
+
+ - nsh batdown: whenever battery is completely discharged
+
+
+Compile notes
+===============================
+
+To link-in the sif_main() utility do, in this folder:
+ - make context TOPDIR=<path to nuttx top dir>
+
+This will result in registering the application into the namedapp.
diff --git a/nuttx/configs/vsn/src/boot.c b/nuttx/configs/vsn/src/boot.c
new file mode 100644
index 000000000..94dcd0043
--- /dev/null
+++ b/nuttx/configs/vsn/src/boot.c
@@ -0,0 +1,90 @@
+/************************************************************************************
+ * configs/vsn/src/boot.c
+ * arch/arm/src/board/boot.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (c) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/** \file
+ * \author Gregory Nutt, Uros Platise
+ * \brief VSN Button
+ */
+
+#include <debug.h>
+#include "vsn.h"
+
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/** Initialize Board
+ *
+ * All STM32 architectures must provide the following entry point. This entry point
+ * is called early in the intitialization -- after all memory has been configured
+ * and mapped but before any devices have been initialized.
+ *
+ **/
+
+void stm32_boardinitialize(void)
+{
+ /* Set start-up board voltage */
+
+ board_power_init();
+ vsn_muxbus_init();
+
+ /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
+ * stm32_spiinitialize() has been brought into the link.
+ */
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+ if (stm32_spiinitialize) stm32_spiinitialize();
+#endif
+
+ /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
+ * disabled, and 3) the weak function stm32_usbinitialize() has been brought
+ * into the build.
+ */
+
+#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
+ if (stm32_usbinitialize) stm32_usbinitialize();
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+ up_ledinit();
+#endif
+}
diff --git a/nuttx/configs/vsn/src/buttons.c b/nuttx/configs/vsn/src/buttons.c
new file mode 100644
index 000000000..c0a0f7297
--- /dev/null
+++ b/nuttx/configs/vsn/src/buttons.c
@@ -0,0 +1,88 @@
+/****************************************************************************
+ * configs/vsn/src/buttons.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief VSN Button
+ */
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include <arch/board/board.h>
+#include "vsn.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/** Called from an interrupt
+ *
+ * \todo Measure the time button is being pressed, and then:
+ * - if short signal all processes (tasks and threads) with 'button user request': SIGUSR1
+ * - if long (>0.5 s) signal all with 'power-off request': SIGTERM
+ **/
+void buttons_callback(void)
+{
+}
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ stm32_configgpio(GPIO_PUSHBUTTON);
+}
+
+
+uint8_t up_buttons(void)
+{
+ return stm32_gpioread(GPIO_PUSHBUTTON);
+}
+
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/vsn/src/chipcon.c b/nuttx/configs/vsn/src/chipcon.c
new file mode 100644
index 000000000..c4428d66f
--- /dev/null
+++ b/nuttx/configs/vsn/src/chipcon.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * configs/vsn/src/chipcon.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Author: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief Chipcon CC1101 Interface
+ */
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/** Set external clock frequency, or disable it
+ */
+int chipcon_setXclock(int prescaler)
+{
+ // check present state, if it is enabled (in the chip!)
+
+ // change state and with OK if everything is OK.
+
+ return ERROR;
+}
+
+
+int chipcon_setchannel(uint16_t channel)
+{
+}
+
+
+void chipcon_init(int spino)
+{
+ // create stream driver, where STDIN is packet oriented
+ // means that two messages received are kept separated
+ // in internal buffers.
+
+ // default mode is AUTO, RX enabled and auto TX on writes and
+ // when chipcon is IDLE.
+}
+
+
+void chipcon_open(void)
+{
+}
+
+
+void chipcon_ioctl(void)
+{
+ // access to setXclock
+}
diff --git a/nuttx/configs/vsn/src/leds.c b/nuttx/configs/vsn/src/leds.c
new file mode 100644
index 000000000..e440e5fce
--- /dev/null
+++ b/nuttx/configs/vsn/src/leds.c
@@ -0,0 +1,120 @@
+/****************************************************************************
+ * configs/vsn/src/leds.c
+ * arch/arm/src/board/leds.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief VSN LED
+ */
+
+#include <nuttx/config.h>
+#include <arch/board/board.h>
+
+#ifdef CONFIG_ARCH_LEDS
+
+#include <arch/stm32/irq.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include "vsn.h"
+
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG with
+ * CONFIG_DEBUG_VERBOSE too)
+ */
+
+#undef LED_DEBUG /* Define to enable debug */
+
+#ifdef LED_DEBUG
+# define leddbg lldbg
+# define ledvdbg llvdbg
+#else
+# define leddbg(x...)
+# define ledvdbg(x...)
+#endif
+
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+irqstate_t irqidle_mask;
+
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static void led_setonoff(unsigned int bits)
+{
+}
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+
+void up_ledinit(void)
+{
+ stm32_configgpio(GPIO_LED);
+}
+
+
+void up_ledon(int led)
+{
+ if (led==LED_IDLE) {
+ irqidle_mask = irqsave();
+ stm32_gpiowrite(GPIO_LED, true);
+ }
+}
+
+
+void up_ledoff(int led)
+{
+ if (led==LED_IDLE) {
+ stm32_gpiowrite(GPIO_LED, false);
+ irqrestore(irqidle_mask);
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/vsn/src/muxbus.c b/nuttx/configs/vsn/src/muxbus.c
new file mode 100644
index 000000000..76304d67d
--- /dev/null
+++ b/nuttx/configs/vsn/src/muxbus.c
@@ -0,0 +1,198 @@
+/****************************************************************************
+ * config/vsn/src/muxbus.c
+ * arch/arm/src/board/muxbus.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief VSN Multiplexed Bus, SDIO Interface and the Analog Front-End
+ */
+
+#include <nuttx/config.h>
+#include <semaphore.h>
+#include <errno.h>
+
+#include "vsn.h"
+#include "stm32_gpio.h"
+
+
+/****************************************************************************
+ * Private data
+ ****************************************************************************/
+
+/** Set true when the bus has been locked by the SDIO interface */
+bool vsn_muxbus_ownedbysdio;
+
+/** Semaphore to resolve conflicts between muxbus locks */
+sem_t vsn_muxbus_sem;
+
+
+/****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+void vsn_muxbus_takeownership(void)
+{
+ while (sem_wait(&vsn_muxbus_sem) != 0) {
+
+ /* The only case that an error should occr here is if the wait was
+ * awakened by a signal.
+ */
+
+ ASSERT(errno == EINTR);
+ }
+}
+
+
+void vsn_muxbus_sdio_release(void)
+{
+ stm32_unconfiggpio(GPIO_SDIO_D0);
+ stm32_unconfiggpio(GPIO_SDIO_CK);
+ stm32_unconfiggpio(GPIO_SDIO_CMD);
+
+ vsn_muxbus_ownedbysdio = FALSE;
+}
+
+
+void vsn_muxbus_sdio_access(void)
+{
+ stm32_configgpio(GPIO_SDIO_D0);
+ stm32_configgpio(GPIO_SDIO_CK);
+ stm32_configgpio(GPIO_SDIO_CMD);
+
+ vsn_muxbus_ownedbysdio = TRUE;
+}
+
+
+/****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+
+void vsn_muxbus_init(void)
+{
+ /* Put the PGA in default shut-down state */
+
+ stm32_configgpio(GPIO_PGIA_AEN);
+
+ /* setup semaphore in non-locked condition */
+
+ sem_init(&vsn_muxbus_sem, 0, 1);
+
+ /* by default give the bus to the SDIO */
+
+ vsn_muxbus_sdio_access();
+}
+
+
+/**
+ * We could do extra checks: who is the owner to prevent
+ * unlocking from SDIO side eventhough it was not locked
+ * by him, but temporarily by the PGA
+ */
+void stm32_muxbus_sdio_lock(bool lock)
+{
+ if ( lock )
+ vsn_muxbus_takeownership();
+ else
+ sem_post(&vsn_muxbus_sem);
+}
+
+
+/**
+ * The following rules apply for the SDcard:
+ *
+ * - CMD serial line always starts with 0 (start-bit) and ends with 1 (stop-bit)
+ * The total length is always 48 bits protected by CRCs. When changing the
+ * gain, CMD must be seen as 1 on CK changes.
+ *
+ * - An alternative mechanism would be to use suspend/resume commands
+ *
+ * - If SDcard internal shift-register is 8-bit oriented there might be a need
+ * to shift 7 dummy bits to properly detect invalid start of packet
+ * (with start bit set as 1) to invalidate bus transitions (in case CK
+ * is changing).
+ *
+ * SDIO returns the bus in HiZ states, where CLK = 0, D = CMD = external pull-up
+ */
+int vsn_muxbus_setpgagain(int gain)
+{
+ /* Shutdown the Analog Devices AD8231 and exit if gain is invalid */
+
+ stm32_gpiowrite(GPIO_PGIA_AEN, FALSE);
+
+ if (gain < 0 || gain > 7)
+ return -1;
+
+ vsn_muxbus_takeownership();
+ vsn_muxbus_sdio_release();
+
+ /* If we have to set CLK = 1, made that first as D, CMD are 1 by pull-ups */
+
+ if (gain & 2)
+ stm32_configgpio(GPIO_PGIA_A1_H);
+ else stm32_configgpio(GPIO_PGIA_A1_L);
+
+ /* Set the D and CMD bits */
+
+ if (gain & 1)
+ stm32_configgpio(GPIO_PGIA_A0_H);
+ else stm32_configgpio(GPIO_PGIA_A0_L);
+
+ if (gain & 4)
+ stm32_configgpio(GPIO_PGIA_A2_H);
+ else stm32_configgpio(GPIO_PGIA_A2_L);
+
+ /* Sample GAIN on rising edge */
+
+ stm32_gpiowrite(GPIO_PGIA_AEN, TRUE);
+
+ /* Release D and CMD pins to 1; however shorten rising edge actively */
+
+ stm32_gpiowrite(GPIO_PGIA_A0_H, TRUE);
+ stm32_gpiowrite(GPIO_PGIA_A2_H, TRUE);
+
+ stm32_unconfiggpio(GPIO_PGIA_A0_H);
+ stm32_unconfiggpio(GPIO_PGIA_A2_H);
+
+ /* Release CLK by going down and return the bus */
+
+ stm32_unconfiggpio(GPIO_PGIA_A1_L);
+
+ vsn_muxbus_sdio_access();
+ sem_post(&vsn_muxbus_sem);
+
+ return gain;
+}
diff --git a/nuttx/configs/vsn/src/power.c b/nuttx/configs/vsn/src/power.c
new file mode 100644
index 000000000..9cbcfaac8
--- /dev/null
+++ b/nuttx/configs/vsn/src/power.c
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * config/vsn/src/power.c
+ * arch/arm/src/board/power.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief VSN Power
+ */
+
+#include <nuttx/config.h>
+
+#include <arch/board/board.h>
+#include <arch/stm32/irq.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include "vsn.h"
+
+
+/****************************************************************************
+ * Declarations and Structures
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+void board_power_register(void);
+void board_power_adjust(void);
+void board_power_status(void);
+
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void board_power_init(void)
+{
+ stm32_configgpio(GPIO_PVS);
+ stm32_configgpio(GPIO_PST);
+ stm32_configgpio(GPIO_XPWR);
+ stm32_configgpio(GPIO_SCTC);
+ stm32_configgpio(GPIO_PCLR);
+}
+
+
+void board_power_reboot(void)
+{
+ // low-level board reset (not just MCU reset)
+ // if external power is present, stimulate power-off as board
+ // will wake-up immediatelly, if power is not present, set an alarm
+ // before power off the board.
+}
+
+
+void board_power_off(void)
+{
+ // Check if external supply is not present, otherwise return
+ // notifying that it is not possible to power-off the board
+
+ // \todo
+
+ // stop background processes
+ irqsave();
+
+ // switch to internal HSI and get the PD0 and PD1 as GPIO
+ sysclock_select_hsi();
+
+ // trigger shutdown with pull-up resistor (not push-pull!) and wait.
+ stm32_gpiowrite(GPIO_PCLR, true);
+ for(;;);
+}
diff --git a/nuttx/configs/vsn/src/rtac.c b/nuttx/configs/vsn/src/rtac.c
new file mode 100644
index 000000000..68b94a169
--- /dev/null
+++ b/nuttx/configs/vsn/src/rtac.c
@@ -0,0 +1,106 @@
+/****************************************************************************
+ * config/vsn/src/rtac.c
+ * arch/arm/src/board/rtac.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief Real Time Alarm Clock
+ *
+ * Implementation of the Real-Time Alarm Clock as per SNP Specifications.
+ * It provides real-time and phase controlled timer module while it
+ * cooperates with hardware RTC for low-power operation.
+ *
+ * It provides a replacement for a system 32-bit UTC time/date counter.
+ *
+ * It runs at maximum STM32 allowed precision of 16384 Hz, providing
+ * resolution of 61 us, required by the Sensor Network Protocol.
+ */
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/** Execute from a group of events
+ **/
+int rtac_execg(int group)
+{
+ // called by each thread to spawn its apps given by its ID or group ID of
+ // multiple threads, when group parameter is set.
+}
+
+
+/** Wait and execute from a group of events
+ **/
+int rtac_waitg(int group, int time)
+{
+ // blocking variant of rtac_exec with timeout if specified
+}
+
+
+/** Power optimization of base systick timer
+ *
+ * 1. Simple method to skip wake-ups:
+ * - ask timers about the min. period, which is Ns * systick
+ * - set the preload register with floor(Ns) * DEFAULT_PRELOAD
+ * - on wake-up call routines Ns times.
+ *
+ * 2. If intermediate ISR occuried then:
+ * - check how many periods have passed by reading the counter: Np
+ * - set the new counter value as (counter % DEFAULT_PRELOAD)
+ * - call timer routines Np times; the next call is as usual, starting
+ * at 1. point above
+ *
+ * This is okay if ISR's do not read timers, if they read timers then:
+ * - on ISR wake-up the code described under 2. must be called first
+ * (on wake-up from IDLE)
+ *
+ * BUT: the problem is that SYSTICK does not run in Stop mode but RTC
+ * only, so it might be better to replace SYSTICK with RTAC (this
+ * module) and do the job above, permitting ultra low power modes of
+ * 25 uA or further down to 5 uA.
+ */
diff --git a/nuttx/configs/vsn/src/sif.c b/nuttx/configs/vsn/src/sif.c
new file mode 100644
index 000000000..0269ebcab
--- /dev/null
+++ b/nuttx/configs/vsn/src/sif.c
@@ -0,0 +1,721 @@
+/****************************************************************************
+ * config/vsn/src/sif.c
+ * arch/arm/src/board/sif.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief VSN Sensor Interface
+ *
+ * Public interface:
+ * - sif_init(): should be called just once after system starts, to
+ * initialize internal data structures, device driver and hardware
+ * - individual starts() and stops() that control gpio, usart, i2c, ...
+ * are wrapped throu open() and close()
+ * - read() and write() are used for streaming
+ * - ioctl() for configuration
+ *
+ * STDOUT Coding 16-bit (little endian):
+ * - MSB = 0 GPIOs, followed by the both GPIO config bytes
+ * - MSB = 1 Input AD, centered around 0x4000
+ *
+ * STDIN Coding 16-bit (little endian):
+ * - MSB = 0 GPIOs, followed by the both GPIO config bytes
+ * - MSB-1 = 0 Analog Output (PWM or Power)
+ * - MSB-1 = 1 Analog Reference Tap
+ *
+ * GPIO Update cycle:
+ * - if they follow the Analog Output, they are synced with them
+ * - if they follow the Analog Reference Tap, they are synced with them
+ * - if either is configured without sample rate value, they are updated
+ * immediately, same as them
+ *
+ * Implementation:
+ * - Complete internal states and updateing is made via the struct
+ * vsn_sif_s, which is also accessible thru the ioctl() with
+ * SNP Message descriptor.
+ **/
+
+#include <nuttx/config.h>
+#include <nuttx/fs/fs.h>
+#include <semaphore.h>
+#include <nuttx/clock.h>
+#include <nuttx/time.h>
+#include <nuttx/rtc.h>
+#include <nuttx/progmem.h>
+
+#include <nuttx/i2c.h>
+#include <nuttx/sensors/lis331dl.h>
+
+#include <nuttx/spi.h>
+#include <nuttx/wireless/cc1101.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include "vsn.h"
+#include "stm32_gpio.h"
+
+
+/****************************************************************************
+ * Declarations and Structures
+ ****************************************************************************/
+
+#define VSN_SIF_READ_BUFSIZE 128
+#define VSN_SIF_WRITE_BUFSIZE 128
+
+
+typedef unsigned char vsn_sif_state_t;
+
+# define VSN_SIF_STATE_POWERDOWN 0x00 ///< power-down
+
+# define VSN_SIF_STATE_ACT_GPIO 0x01 ///< gpio is active
+# define VSN_SIF_STATE_ACT_USART 0x02 ///< usart is active
+# define VSN_SIF_STATE_ACT_I2C 0x04 ///< i2c is active
+# define VSN_SIF_STATE_ACT_OWIR1 0x08 ///< 1-wire is active on first GPIO
+# define VSN_SIF_STATE_ACT_OWIR2 0x10 ///< 1-wire is active on second GPIO
+
+# define VSN_SIF_STATE_ACT_ANOUT 0x20 ///< analog output is active
+# define VSN_SIF_STATE_ACT_ANIN 0x40 ///< analog input is active
+
+
+typedef unsigned char vsn_sif_gpio_t;
+
+# define VSN_SIF_GPIO_STATE_MASK 7
+# define VSN_SIF_GPIO_HIGHZ 0 ///< High-Z
+# define VSN_SIF_GPIO_PULLUP 1 ///< Pull-Up
+# define VSN_SIF_GPIO_PULLDOWN 2 ///< Pull-Down
+# define VSN_SIF_GPIO_OUTLOW 3 ///< Set Low
+# define VSN_SIF_GPIO_OUTHIGH 4 ///< Set High
+
+# define VSN_SIF_GPIO_DISALT_MASK 0x10 ///< Disable Alternate Function, Mask Bit
+# define VSN_SIF_GPIO_TRIG_MASK 0x20 ///< Send data change to the stdout
+# define VSN_SIF_GPIO_READ_MASK 0x40 ///< Readout mask
+
+
+#define VSN_SIF_ANOUT_LOW 0 // Pseudo Analog Output acts as GPIO
+#define VSN_SIF_ANOUT_HIGH 1 // Pseudo Analog Output acts as GPIO high
+#define VSN_SIF_ANOUT_HIGHPWR 2 // ... acts as high power output
+#define VSN_SIF_ANOUT_PWM 3 // ... acts as PWM output
+#define VSN_SIF_ANOUT_PWMPWR 4 // acts as power PWM output
+
+#define VSN_SIF_ANIN_GAINMASK 7
+#define VSN_SIF_ANIN_GAIN1 0
+#define VSN_SIF_ANIN_GAIN2 1
+#define VSN_SIF_ANIN_GAIN4 2
+#define VSN_SIF_ANIN_GAIN8 3
+#define VSN_SIF_ANIN_GAIN16 4
+#define VSN_SIF_ANIN_GAIN32 5
+#define VSN_SIF_ANIN_GAIN64 6
+#define VSN_SIF_ANIN_GAIN128 7
+
+#define VSN_SIF_ANIN_BITS8
+#define VSN_SIF_ANIN_BITS9
+#define VSN_SIF_ANIN_BITS10
+#define VSN_SIF_ANIN_BITS11
+#define VSN_SIF_ANIN_BITS12
+#define VSN_SIF_ANIN_BITS13
+#define VSN_SIF_ANIN_BITS14
+
+#define VSN_SIF_ANIN_OVERSMP1
+#define VSN_SIF_ANIN_OVERSMP2
+#define VSN_SIF_ANIN_OVERSMP4
+#define VSN_SIF_ANIN_OVERSMP8
+#define VSN_SIF_ANIN_OVERSMP16
+
+
+struct vsn_sif_s {
+ vsn_sif_state_t state; // activity
+ unsigned char opencnt; // open count
+
+ vsn_sif_gpio_t gpio[2];
+
+ unsigned char anout_opts;
+ unsigned short int anout_width;
+ unsigned short int anout_period; // setting it to 0, disables PWM
+ unsigned short int anout_samplerate; // as written by write()
+
+ unsigned short int anref_width;
+ unsigned short int anref_period; // setting it to 0, disables PWM
+ unsigned short int anref_samplerate; // as written by write()
+
+ unsigned char anin_opts;
+ unsigned int anin_samplerate; // returned on read() as 16-bit results
+
+ /*--- Private Data ---*/
+
+ struct stm32_tim_dev_s * tim3; // Timer3 is used for PWM, and Analog RefTap
+ struct stm32_tim_dev_s * tim8; // Timer8 is used for Power Switch
+
+ struct i2c_dev_s * i2c1;
+ struct i2c_dev_s * i2c2;
+
+ struct spi_dev_s * spi2;
+
+ sem_t exclusive_access;
+};
+
+
+/****************************************************************************
+ * Private data
+ ****************************************************************************/
+
+struct vsn_sif_s vsn_sif;
+
+
+/****************************************************************************
+ * Semaphores
+ ****************************************************************************/
+
+void sif_sem_wait(void)
+{
+ while( sem_wait( &vsn_sif.exclusive_access ) != 0 ) {
+ ASSERT(errno == EINTR);
+ }
+}
+
+
+void inline sif_sem_post(void)
+{
+ sem_post( &vsn_sif.exclusive_access );
+}
+
+
+/****************************************************************************
+ * GPIOs and Alternative Functions
+ ****************************************************************************/
+
+
+void sif_gpios_reset(void)
+{
+ vsn_sif.gpio[0] = vsn_sif.gpio[1] = VSN_SIF_GPIO_HIGHZ;
+
+ stm32_configgpio(GPIO_GP1_HIZ);
+ stm32_configgpio(GPIO_GP2_HIZ);
+}
+
+
+void sif_gpio1_update(void)
+{
+ uint32_t val;
+
+ switch(vsn_sif.gpio[0] & VSN_SIF_GPIO_STATE_MASK) {
+ case VSN_SIF_GPIO_HIGHZ: val = GPIO_GP1_HIZ; break;
+ case VSN_SIF_GPIO_PULLUP: val = GPIO_GP1_PUP; break;
+ case VSN_SIF_GPIO_PULLDOWN: val = GPIO_GP1_PDN; break;
+ case VSN_SIF_GPIO_OUTLOW: val = GPIO_GP1_LOW; break;
+ case VSN_SIF_GPIO_OUTHIGH: val = GPIO_GP1_HIGH;break;
+ default: return;
+ }
+ if (stm32_configgpio(val) == ERROR)
+ printf("Error updating1\n");
+
+ if ( stm32_gpioread(val) )
+ vsn_sif.gpio[0] |= VSN_SIF_GPIO_READ_MASK;
+ else vsn_sif.gpio[0] &= ~VSN_SIF_GPIO_READ_MASK;
+}
+
+
+void sif_gpio2_update(void)
+{
+ uint32_t val;
+
+ switch(vsn_sif.gpio[1]) {
+ case VSN_SIF_GPIO_HIGHZ: val = GPIO_GP2_HIZ; break;
+ case VSN_SIF_GPIO_PULLUP: val = GPIO_GP2_PUP; break;
+ case VSN_SIF_GPIO_PULLDOWN: val = GPIO_GP2_PDN; break;
+ case VSN_SIF_GPIO_OUTLOW: val = GPIO_GP2_LOW; break;
+ case VSN_SIF_GPIO_OUTHIGH: val = GPIO_GP2_HIGH;break;
+ default: return;
+ }
+ if (stm32_configgpio(val) == ERROR)
+ printf("Error updating2\n");
+
+ if ( stm32_gpioread(val) )
+ vsn_sif.gpio[1] |= VSN_SIF_GPIO_READ_MASK;
+ else vsn_sif.gpio[1] &= ~VSN_SIF_GPIO_READ_MASK;
+}
+
+
+int sif_gpios_lock(vsn_sif_state_t peripheral)
+{
+ return ERROR;
+}
+
+
+int sif_gpios_unlock(vsn_sif_state_t peripheral)
+{
+ return ERROR;
+}
+
+
+
+
+/****************************************************************************
+ * Analog Outputs
+ ****************************************************************************/
+
+static volatile int test = 0, teirq;
+
+
+static int sif_anout_isr(int irq, void *context)
+{
+ STM32_TIM_ACKINT(vsn_sif.tim8, 0);
+
+ test++;
+ teirq = irq;
+
+ return OK;
+}
+
+
+int sif_anout_init(void)
+{
+ vsn_sif.tim3 = stm32_tim_init(3);
+ vsn_sif.tim8 = stm32_tim_init(8);
+
+ if (!vsn_sif.tim3 || !vsn_sif.tim8) return ERROR;
+
+ // Use the TIM3 as PWM modulated analogue output
+
+ STM32_TIM_SETPERIOD(vsn_sif.tim3, 5);
+ STM32_TIM_SETCOMPARE(vsn_sif.tim3, GPIO_OUT_PWM_TIM3_CH, 3);
+
+ STM32_TIM_SETCLOCK(vsn_sif.tim3, 36e6);
+ STM32_TIM_SETMODE(vsn_sif.tim3, STM32_TIM_MODE_UP);
+ STM32_TIM_SETCHANNEL(vsn_sif.tim3, GPIO_OUT_PWM_TIM3_CH, STM32_TIM_CH_OUTPWM | STM32_TIM_CH_POLARITY_NEG);
+
+ // Use the TIM8 to drive the upper power mosfet
+
+ STM32_TIM_SETISR(vsn_sif.tim8, sif_anout_isr, 0);
+ STM32_TIM_ENABLEINT(vsn_sif.tim8, 0);
+
+ STM32_TIM_SETPERIOD(vsn_sif.tim8, 4096);
+ STM32_TIM_SETCOMPARE(vsn_sif.tim8, GPIO_OUT_PWRPWM_TIM8_CH, 5000);
+
+ STM32_TIM_SETCLOCK(vsn_sif.tim8, 36e6);
+ STM32_TIM_SETMODE(vsn_sif.tim8, STM32_TIM_MODE_UP);
+ //STM32_TIM_SETCHANNEL(vsn_sif.tim8, GPIO_OUT_PWRPWM_TIM8_CH, STM32_TIM_CH_OUTPWM | STM32_TIM_CH_POLARITY_NEG);
+
+ vsn_sif.i2c1 = up_i2cinitialize(1);
+ vsn_sif.i2c2 = up_i2cinitialize(2);
+
+ vsn_sif.spi2 = up_spiinitialize(2);
+
+ return OK;
+}
+
+
+void sif_anout_update(void)
+{
+}
+
+
+void sif_anout_callback(void)
+{
+ // called at rate of PWM interrupt
+}
+
+
+/****************************************************************************
+ * Analog Input Reference Tap
+ ****************************************************************************/
+
+
+void sif_anref_init(void)
+{
+}
+
+
+/****************************************************************************
+ * Analog Input Sampler Unit
+ ****************************************************************************/
+
+#if 0
+/**
+ * Gain is set using the shared multiplexed bus with the SDIO card.
+ * The following rules apply for the SDcard:
+ *
+ * - CMD serial line always starts with 0 (start-bit) and ends with 1 (stop-bit)
+ * The total length is always 48 bits protected by CRCs. When changing the
+ * gain, CMD must be seen as 1 on CK changes.
+ *
+ * - An alternative mechanism would be to use suspend/resume commands
+ *
+ * - If SDcard internal shift-register is 8-bit oriented there might be a need
+ * to shift 7 dummy bits to properly detect invalid start of packet
+ * (with start bit set as 1) to invalidate bus transitions (in case CK
+ * is changing).
+ *
+ * SDIO returns the bus in HiZ states, where CLK = 0, D = CMD = external pull-up
+ */
+int sif_anin_setgain(int gain)
+{
+ /* Shutdown the PGA and exit if gain is invalid */
+
+ stm32_gpiowrite(GPIO_PGIA_AEN, FALSE);
+
+ if (gain < 0 || gain > 7)
+ return -1;
+
+ sdio_gpio_request();
+
+ /* If we have to set CLK = 1, made that first as D, CMD are 1 by pull-ups */
+
+ if (gain & 2)
+ stm32_configgpio(GPIO_PGIA_A1_H);
+ else stm32_configgpio(GPIO_PGIA_A1_L);
+
+ /* Set the D and CMD bits */
+
+ if (gain & 1)
+ stm32_configgpio(GPIO_PGIA_A0_H);
+ else stm32_configgpio(GPIO_PGIA_A0_L);
+
+ if (gain & 4)
+ stm32_configgpio(GPIO_PGIA_A2_H);
+ else stm32_configgpio(GPIO_PGIA_A2_L);
+
+ /* Sample GAIN on rising edge */
+
+ stm32_gpiowrite(GPIO_PGIA_AEN, TRUE);
+
+ /* Release D and CMD pins to 1; however shorten rising edge actively */
+
+ stm32_gpiowrite(GPIO_PGIA_A0_H, TRUE);
+ stm32_gpiowrite(GPIO_PGIA_A2_H, TRUE);
+
+ stm32_unconfiggpio(GPIO_PGIA_A0_H);
+ stm32_unconfiggpio(GPIO_PGIA_A2_H);
+
+ /* Release CLK by going down */
+
+ stm32_unconfiggpio(GPIO_PGIA_A1_L);
+
+ sdio_gpio_release();
+
+ return gain;
+}
+#endif
+
+
+int sif_anin_reset(void)
+{
+ return OK;
+}
+
+
+/****************************************************************************
+ * Device driver functions
+ ****************************************************************************/
+
+int devsif_open(FAR struct file *filep)
+{
+ sif_sem_wait();
+ vsn_sif.opencnt++;
+
+ // Start Hardware
+
+ sif_sem_post();
+ return 0;
+}
+
+
+int devsif_close(FAR struct file *filep)
+{
+ sif_sem_wait();
+
+ if (--vsn_sif.opencnt) {
+
+ // suspend (powerdown) hardware
+
+ sif_gpios_reset();
+
+ //STM32_TIM_SETCLOCK(vsn_sif.tim3, 0);
+ //STM32_TIM_SETCLOCK(vsn_sif.tim8, 0);
+ }
+
+ sif_sem_post();
+ return 0;
+}
+
+
+static ssize_t devsif_read(FAR struct file *filp, FAR char *buffer, size_t len)
+{
+ sif_sem_wait();
+ memset(buffer, 0, len);
+ sif_sem_post();
+ return len;
+}
+
+
+static ssize_t devsif_write(FAR struct file *filp, FAR const char *buffer, size_t len)
+{
+ sif_sem_wait();
+ printf("getpid: %d\n", getpid() );
+ sif_sem_post();
+ return len;
+}
+
+
+#ifndef CONFIG_DISABLE_POLL
+static int devsif_poll(FAR struct file *filp, FAR struct pollfd *fds,
+ bool setup)
+{
+ if (setup) {
+ fds->revents |= (fds->events & (POLLIN|POLLOUT));
+
+ if (fds->revents != 0) {
+ sem_post(fds->sem);
+ }
+ }
+ return OK;
+}
+#endif
+
+
+int devsif_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+{
+ sif_sem_wait();
+ sif_sem_post();
+ return 0;
+}
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+
+static const struct file_operations devsif_fops = {
+ devsif_open, /* open */
+ devsif_close, /* close */
+ devsif_read, /* read */
+ devsif_write, /* write */
+ 0, /* seek */
+ devsif_ioctl /* ioctl */
+#ifndef CONFIG_DISABLE_POLL
+ , devsif_poll /* poll */
+#endif
+};
+
+
+/** Bring up the Sensor Interface by initializing all of the desired
+ * hardware components.
+ **/
+
+int sif_init(void)
+{
+ /* Initialize data-structure */
+
+ vsn_sif.state = VSN_SIF_STATE_POWERDOWN;
+ vsn_sif.opencnt = 0;
+ sem_init(&vsn_sif.exclusive_access, 0, 1);
+
+ /* Initialize hardware */
+
+ sif_gpios_reset();
+ if ( sif_anout_init() != OK ) return -1;
+ if ( sif_anin_reset() != OK ) return -1;
+
+ /* If everything is okay, register the driver */
+
+ (void)register_driver("/dev/sif0", &devsif_fops, 0666, NULL);
+ return OK;
+}
+
+
+/** SIF Utility
+ *
+ * Provides direct access to the sensor connector, readings, and diagnostic.
+ **/
+
+extern int cc1101_eventcb(int irq, FAR void *context);
+
+int sif_main(int argc, char *argv[])
+{
+ if (argc >= 2) {
+ if (!strcmp(argv[1], "init")) {
+ return sif_init();
+ }
+ else if (!strcmp(argv[1], "gpio") && argc == 4) {
+ vsn_sif.gpio[0] = atoi(argv[2]);
+ vsn_sif.gpio[1] = atoi(argv[3]);
+ sif_gpio1_update();
+ sif_gpio2_update();
+ printf("GPIO States: %2x %2x\n", vsn_sif.gpio[0], vsn_sif.gpio[1] );
+ return 0;
+ }
+ else if (!strcmp(argv[1], "pwr") && argc == 3) {
+ int val = atoi(argv[2]);
+ //STM32_TIM_SETCOMPARE(vsn_sif.tim8, GPIO_OUT_PWRPWM_TIM8_CH, val);
+ STM32_TIM_SETCOMPARE(vsn_sif.tim3, GPIO_OUT_PWM_TIM3_CH, val);
+ return 0;
+ }
+ else if (!strcmp(argv[1], "time") && argc == 3) {
+ struct timespec t_set;
+ t_set.tv_sec = atoi(argv[2]);
+ clock_settime(CLOCK_REALTIME, &t_set);
+ }
+ else if (!strcmp(argv[1], "free") ) {
+ uint16_t page = 0, stpage = 0xFFFF;
+ int status;
+ do {
+ status = up_progmem_ispageerased(page++);
+
+ /* Is this beginning of new free space section */
+ if (status == 0) {
+ if (stpage == 0xFFFF) stpage = page-1;
+ }
+ else if (status != 0) {
+ if (stpage != 0xFFFF) {
+ printf("Free Range:\t%d\t-\t%d\n", stpage, page-2);
+ stpage = 0xFFFF;
+ }
+ }
+ }
+ while (status >= 0);
+ return 0;
+ }
+ else if (!strcmp(argv[1], "erase") && argc == 3 ) {
+ int page = atoi(argv[2]);
+ printf("Erase result: %d\n", up_progmem_erasepage(page) );
+ return 0;
+ }
+ else if (!strcmp(argv[1], "flash") && argc == 3 ) {
+ uint16_t page = atoi(argv[2]);
+ uint32_t addr = page * up_progmem_pagesize(page);
+
+ printf("Write result: %d (writing to address %xh)\n",
+ up_progmem_write( addr, "Test", 4 ), addr);
+ return 0;
+ }
+ else if (!strcmp(argv[1], "i2c") && argc == 3) {
+ int val = atoi(argv[2]);
+
+ I2C_SETFREQUENCY(vsn_sif.i2c1, 100000);
+
+ struct lis331dl_dev_s * lis = lis331dl_init(vsn_sif.i2c1, val);
+
+ if (lis) {
+ const struct lis331dl_vector_s * a;
+ int i;
+ uint32_t time_stamp = clock_systimer();
+
+ /* Set to 400 Hz : 3 = 133 Hz/axis */
+
+ lis331dl_setconversion(lis, false, true);
+
+ /* Sample some values */
+
+ for (i=0; i<1000; ) {
+ if ( (a = lis331dl_getreadings(lis)) ) {
+ i++;
+ printf("%d %d %d\n", a->x, a->y, a->z);
+ }
+ else if (errno != 11) {
+ printf("Readings errno %d\n", errno);
+ break;
+ }
+ }
+
+ printf("Time diff = %d\n", clock_systimer() - time_stamp);
+
+ lis331dl_deinit(lis);
+ }
+ else printf("Exit point: errno=%d\n", errno);
+
+ return 0;
+ }
+ else if (!strcmp(argv[1], "pga")) {
+ int gain = atoi(argv[2]);
+
+ gain = vsn_muxbus_setpgagain(gain);
+
+ printf("Gain changed: %d\n", gain);
+ return 0;
+ }
+ else if (!strcmp(argv[1], "cc")) {
+ struct cc1101_dev_s * cc;
+ uint8_t buf[64];
+ int sta;
+
+ cc = cc1101_init(vsn_sif.spi2, CC1101_PIN_GDO0, GPIO_CC1101_GDO0,
+ &cc1101_rfsettings_ISM1_868MHzGFSK100kbps);
+
+ if (cc) {
+
+ /* Work-around: enable falling edge, event and interrupt */
+ stm32_gpiosetevent(GPIO_CC1101_GDO0, false, true, true, cc1101_eventcb);
+
+ /* Enable clock to ARM PLL, allowing to speed-up to 72 MHz */
+ cc1101_setgdo(cc, CC1101_PIN_GDO2, CC1101_GDO_CLK_XOSC3);
+
+ cc1101_setchannel(cc, 0); /* AV Test Hex, receive on that channel */
+ cc1101_receive(cc); /* Enter RX mode */
+ while(1)
+ {
+ fflush(stdout);
+ sta = cc1101_read(cc, buf, 64);
+ if (sta > 0) {
+ printf("Received %d bytes: rssi=%d [dBm], LQI=%d (CRC %s)\n",
+ sta, cc1101_calcRSSIdBm(buf[sta-2]), buf[sta-1]&0x7F,
+ (buf[sta-1]&0x80)?"OK":"BAD");
+
+ cc1101_write(cc, buf, 61);
+ cc1101_send(cc);
+
+ printf("Packet send back\n");
+
+ cc1101_receive(cc);
+ }
+ }
+ }
+ }
+ }
+
+ fprintf(stderr, "%s:\tinit\n\tgpio\tA B\n\tpwr\tval\n", argv[0]);
+
+ struct timespec t_active;
+ clock_gettime(CLOCK_ACTIVETIME, &t_active);
+
+ fprintf(stderr, "rtc time = %u, active = %u / %u, time / systick = %u / %u\n",
+ up_rtc_time(), t_active.tv_sec, t_active.tv_nsec,
+ time(NULL), clock_systimer() );
+ return -1;
+}
diff --git a/nuttx/configs/vsn/src/spi.c b/nuttx/configs/vsn/src/spi.c
new file mode 100644
index 000000000..e8e15e54b
--- /dev/null
+++ b/nuttx/configs/vsn/src/spi.c
@@ -0,0 +1,193 @@
+/************************************************************************************
+ * configs/vsn/src/spi.c
+ * arch/arm/src/board/spi.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/** \file
+ * \author Gregory Nutt, Uros Platise
+ * \brief SPI Slave Selects
+ */
+
+
+#include <nuttx/config.h>
+#include <nuttx/spi.h>
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+
+#include <arch/board/board.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include "up_arch.h"
+#include "chip.h"
+#include "stm32_gpio.h"
+#include "stm32_internal.h"
+#include "stm32_waste.h"
+#include "vsn.h"
+
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Enables debug output from this file (needs CONFIG_DEBUG too) */
+
+#undef SPI_DEBUG /* Define to enable debug */
+#undef SPI_VERBOSE /* Define to enable verbose debug */
+
+#ifdef SPI_DEBUG
+# define spidbg lldbg
+# ifdef SPI_VERBOSE
+# define spivdbg lldbg
+# else
+# define spivdbg(x...)
+# endif
+#else
+# undef SPI_VERBOSE
+# define spidbg(x...)
+# define spivdbg(x...)
+#endif
+
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+
+/** Called to configure SPI chip select GPIO pins for the VSN board.
+ */
+
+void weak_function stm32_spiinitialize(void)
+{
+ /* NOTE: Clocking for SPI1 and/or SPI2 and SPI3 was already provided in stm32_rcc.c.
+ * Configurations of SPI pins is performed in stm32_spi.c.
+ * Here, we only initialize chip select pins unique to the board architecture.
+ */
+
+#ifdef CONFIG_STM32_SPI2
+ stm32_configgpio(GPIO_CC1101_CS);
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+ stm32_configgpio(GPIO_FRAM_CS);
+#endif
+}
+
+/** Selects: stm32_spi1/2/3select and stm32_spi1/2/3status
+ *
+ * The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
+ * provided by board-specific logic. They are implementations of the select
+ * and status methods of the SPI interface defined by struct spi_ops_s (see
+ * include/nuttx/spi.h). All other methods (including up_spiinitialize())
+ * are provided by common STM32 logic. To use this common SPI logic on your
+ * board:
+ *
+ * 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
+ * pins.
+ * 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
+ * board-specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
+ * 3. Add a calls to up_spiinitialize() in your low level application
+ * initialization logic
+ * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * SPI driver to higher level logic (e.g., calling
+ * mmcsd_spislotinitialize(), for example, will bind the SPI driver to
+ * the SPI MMC/SD driver).
+ *
+ **/
+
+#ifdef CONFIG_STM32_SPI1
+
+void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+}
+
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+
+void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+
+ if (devid == SPIDEV_WIRELESS) {
+
+ stm32_gpiowrite(GPIO_CC1101_CS, !selected);
+
+ /* Wait for MISO to go low, indicates that Quart has stabilized */
+ if (selected) {
+ while( stm32_gpioread(GPIO_SPI2_MISO) ) up_waste();
+ }
+
+ }
+}
+
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+
+void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+{
+ spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
+ if (devid == SPIDEV_FLASH)
+ {
+ /* Set the GPIO low to select and high to de-select */
+ stm32_gpiowrite(GPIO_FRAM_CS, !selected);
+ }
+}
+
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+{
+ return SPI_STATUS_PRESENT;
+}
+
+#endif
+
+#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/vsn/src/sysclock.c b/nuttx/configs/vsn/src/sysclock.c
new file mode 100644
index 000000000..8b1a0be34
--- /dev/null
+++ b/nuttx/configs/vsn/src/sysclock.c
@@ -0,0 +1,194 @@
+/****************************************************************************
+ * configs/vsn/src/sysclock.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Author: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief VSN System Clock Configuration
+ */
+
+#include "vsn.h"
+
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/** Selects internal HSI Clock, SYSCLK = 36 MHz, HCLK = 36 MHz
+ * - HSI at 8 MHz, :2 enters DPLL * 9, to get 36 MHz
+ * - AHB prescaler is set to 1 for maximum performance of all peripherals and FRAM (18 Mbps)
+ * - Suitable for start-up and lower power operation
+ * - Flash Wait State = 1, since it is 64-bit prefetch, it satisfies two 32-bit instructions
+ * (and branch losses a single cycle only, I found this as the best performance vs. frequency)
+ * - Sleep with peripherals disabled is about 2.5 mA @ 36 MHz, HSI
+ *
+ * \todo:
+ * - dynamic clock scalling according to cross-peripheral requirements, AHB prescaler could
+ * change if all other prescalers increase, to maintain the ratio and to have min. HCLK
+ * possible; This is of interest when peripherals consume 50% of all power, as for instance
+ * in sleep mode @ 36 MHz, HSI with all peripherals enabled, i = 7 mA, on 24 Mhz 4.8 mA and
+ * on 16 MHz 3.2 mA only.
+ *
+ * \return Nothing, operation is always successful.
+ */
+void sysclock_select_hsi(void)
+{
+ uint32_t regval;
+
+ // Are we running on HSE?
+ regval = getreg32(STM32_RCC_CR);
+ if (regval & RCC_CR_HSEON) {
+
+ // \todo: check is if we are running on HSE, we need the step down sequenuce from HSE -> HSI
+
+ return; // do nothing at this time
+ }
+
+ // Set FLASH prefetch buffer and 1 wait state
+ regval = getreg32(STM32_FLASH_ACR);
+ regval &= ~FLASH_ACR_LATENCY_MASK;
+ regval |= (FLASH_ACR_LATENCY_1|FLASH_ACR_PRTFBE);
+ putreg32(regval, STM32_FLASH_ACR);
+
+ // Set the HCLK source/divider
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_HPRE_MASK;
+ regval |= STM32_RCC_CFGR_HPRE_HSI;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ // Set the PCLK2 divider
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_PPRE2_MASK;
+ regval |= STM32_RCC_CFGR_PPRE2;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ // Set the PCLK1 divider
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_PPRE1_MASK;
+ regval |= STM32_RCC_CFGR_PPRE1;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ // Set the TIM1..8 clock multipliers
+#ifdef STM32_TIM27_FREQMUL2
+#endif
+
+#ifdef STM32_TIM18_FREQMUL2
+#endif
+
+ // Set the PLL source = HSI, divider (/2) and multipler (*9)
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~(RCC_CFGR_PLLSRC|RCC_CFGR_PLLXTPRE|RCC_CFGR_PLLMUL_MASK);
+ regval |= (STM32_CFGR_PLLSRC_HSI|STM32_CFGR_PLLMUL_HSI);
+ putreg32(regval, STM32_RCC_CFGR);
+
+ // Enable the PLL
+ regval = getreg32(STM32_RCC_CR);
+ regval |= RCC_CR_PLLON;
+ putreg32(regval, STM32_RCC_CR);
+
+ // Wait until the PLL is ready
+ while ((getreg32(STM32_RCC_CR) & RCC_CR_PLLRDY) == 0);
+
+ // Select the system clock source (probably the PLL)
+ regval = getreg32(STM32_RCC_CFGR);
+ regval &= ~RCC_CFGR_SW_MASK;
+ regval |= STM32_SYSCLK_SW;
+ putreg32(regval, STM32_RCC_CFGR);
+
+ // Wait until the selected source is used as the system clock source
+ while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) != STM32_SYSCLK_SWS);
+
+ // map port PD0 and PD1 on OSC pins
+ regval = getreg32(STM32_AFIO_MAPR);
+ regval |= AFIO_MAPR_PD01_REMAP;
+ putreg32(regval, STM32_AFIO_MAPR);
+}
+
+
+/** Selects external HSE Clock, SYSCLK = 72 MHz, HCLK = 36/72 MHz
+ * - HSE at 9 MHz, DPLL * 8, to get 72 MHz
+ * - Suitable for maximum performance and USB
+ * - Sleep power consumption at HSE and at 72 MHz is 5.5 mA (3.1 @ 36 MHz)
+ * - Option AHB prescaler is set to :2 to be compatible with HSI to remain on HCLK = 36 MHz
+ * - Flash memory running on 72 MHz needs two wait states
+ *
+ * \return Clock selection status
+ * \retval 0 Successful
+ * \retval -1 External clock is not provided
+ * \retval -2 Could not lock to external clock
+ */
+int sysclock_select_hse(void)
+{
+ uint32_t regval;
+
+ // be sure to release PD0 and PD1 pins from the OSC pins
+ regval = getreg32(STM32_AFIO_MAPR);
+ regval &= ~AFIO_MAPR_PD01_REMAP;
+ putreg32(regval, STM32_AFIO_MAPR);
+
+ // if (is cc1101 9 MHz clock output enabled), otherwise return with -1
+ // I think that clock register provides HSE valid signal to detect that as well.
+
+ return 0;
+}
+
+
+/****************************************************************************
+ * Interrupts, Callbacks
+ ****************************************************************************/
+
+
+/** TODO: Interrupt on lost HSE clock, change it to HSI, ... restarting is
+ * more complex as the step requires restart of CC1101 device driver;
+ * so spawn a task for that... once cc1101 is restarted signal an event
+ * to restart clock.
+ */
+void sysclock_hse_lost(void)
+{
+}
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/** Setup system clock, enabled when:
+ * - CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
+ * option is set in .config
+ */
+void stm32_board_clockconfig(void)
+{
+ sysclock_select_hsi();
+}
diff --git a/nuttx/configs/vsn/src/usbdev.c b/nuttx/configs/vsn/src/usbdev.c
new file mode 100644
index 000000000..deb1e9b2d
--- /dev/null
+++ b/nuttx/configs/vsn/src/usbdev.c
@@ -0,0 +1,123 @@
+/************************************************************************************
+ * configs/svsn/src/usbdev.c
+ * arch/arm/src/board/boot.c
+ *
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Copyright (c) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "up_arch.h"
+#include "stm32_internal.h"
+#include "vsn.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the VSN board.
+ *
+ ************************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* USB Soft Connect Pullup: PB.14 */
+
+#if defined(GPIO_USB_PULLUP)
+ stm32_configgpio(GPIO_USB_PULLUP);
+#endif
+}
+
+/************************************************************************************
+ * Name: stm32_usbpullup
+ *
+ * Description:
+ * If USB is supported and the board supports a pullup via GPIO (for USB software
+ * connect and disconnect), then the board software must provide stm32_pullup.
+ * See include/nuttx/usb/usbdev.h for additional description of this method.
+ * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
+ * NULL.
+ *
+ ************************************************************************************/
+
+int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
+{
+ usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
+#if defined(GPIO_USB_PULLUP)
+ stm32_gpiowrite(GPIO_USB_PULLUP, !enable);
+#endif
+ return OK;
+}
+
+/************************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
+ * used. This function is called whenever the USB enters or leaves suspend mode.
+ * This is an opportunity for the board logic to shutdown clocks, power, etc.
+ * while the USB is suspended.
+ *
+ ************************************************************************************/
+
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ ulldbg("resume: %d\n", resume);
+}
+
diff --git a/nuttx/configs/vsn/src/usbmsc.c b/nuttx/configs/vsn/src/usbmsc.c
new file mode 100644
index 000000000..c0eebf6bf
--- /dev/null
+++ b/nuttx/configs/vsn/src/usbmsc.c
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * configs/vsn/src/usbmsc.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (c) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Gregory Nutt <gnutt@nuttx.org>
+ * Uros Platise <uros.platise@isotel.eu>
+ *
+ * Configure and register the STM32 MMC/SD SDIO block driver.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/sdio.h>
+#include <nuttx/mmcsd.h>
+
+#include "vsn.h"
+
+#ifdef CONFIG_STM32_SDIO
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
+# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
+#endif
+
+/* SLOT number(s) could depend on the board configuration */
+
+#ifdef CONFIG_ARCH_BOARD_VSN
+# undef STM32_MMCSDSLOTNO
+# define STM32_MMCSDSLOTNO 0
+#else
+ /* Add configuration for new STM32 boards here */
+# error "Unrecognized STM32 board"
+#endif
+
+/* Debug ********************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# define msgflush()
+# else
+# define message(...) printf(__VA_ARGS__)
+# define msgflush() fflush(stdout)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# define msgflush()
+# else
+# define message printf
+# define msgflush() fflush(stdout)
+# endif
+#endif
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbmsc_archinitialize
+ *
+ * Description:
+ * Perform architecture specific initialization
+ *
+ ****************************************************************************/
+
+int usbmsc_archinitialize(void)
+{
+ FAR struct sdio_dev_s *sdio;
+ int ret;
+
+ /* First, get an instance of the SDIO interface */
+
+ message("usbmsc_archinitialize: "
+ "Initializing SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+
+ sdio = sdio_initialize(STM32_MMCSDSLOTNO);
+ if (!sdio)
+ {
+ message("usbmsc_archinitialize: Failed to initialize SDIO slot %d\n",
+ STM32_MMCSDSLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SPI interface to the MMC/SD driver */
+
+ message("usbmsc_archinitialize: "
+ "Bind SDIO to the MMC/SD driver, minor=%d\n",
+ CONFIG_EXAMPLES_USBMSC_DEVMINOR1);
+
+ ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, sdio);
+ if (ret != OK)
+ {
+ message("usbmsc_archinitialize: "
+ "Failed to bind SDIO to the MMC/SD driver: %d\n",
+ ret);
+ return ret;
+ }
+ message("usbmsc_archinitialize: "
+ "Successfully bound SDIO to the MMC/SD driver\n");
+
+ /* Then let's guess and say that there is a card in the slot. I need to check to
+ * see if the VSN board supports a GPIO to detect if there is a card in
+ * the slot.
+ */
+
+ sdio_mediachange(sdio, true);
+ return OK;
+}
+
+#endif /* CONFIG_STM32_SDIO */
diff --git a/nuttx/configs/vsn/src/vsn.h b/nuttx/configs/vsn/src/vsn.h
new file mode 100644
index 000000000..eb999f246
--- /dev/null
+++ b/nuttx/configs/vsn/src/vsn.h
@@ -0,0 +1,239 @@
+/************************************************************************************
+ * configs/vsn/src/vsn.h
+ * arch/arm/src/board/vsn.n
+ *
+ * Copyright (c) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_VSN_SRC_VSN_INTERNAL_H
+#define __CONFIGS_VSN_SRC_VSN_INTERNAL_H
+
+#include <nuttx/config.h>
+#include <arch/board/board.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+#include "stm32.h"
+#include "up_internal.h"
+#include "up_arch.h"
+
+
+/************************************************************************************
+ * PIN Definitions
+ ************************************************************************************/
+
+ /* Board Peripheral Assignment
+ *
+ * RS232/Power connector:
+ * - USART1, is the default bootloader and console
+ *
+ * Sensor Connector:
+ * Digital:
+ * - GPIOs: PB10, PB11 (or even TIM2 CH3 and CH4)
+ * - USART3
+ * - I2C2
+ * Analog:
+ * - ADC1
+ * Supporting Analog Circuitry (not seen outside)
+ * - RefTap (TIM3_CH3)
+ * - Power PWM Out (TIM8_CH1 / TIM3_CH1)
+ * - Filtered Out (TIM3_CH4)
+ * (TIM8 could run at lower frequency, while TIM3 must run at highest possible)
+ * - Gain selection muxed with SDcard I/Os.
+ *
+ * Radio connector:
+ * - UART3 / UART4
+ * - SPI2
+ * - I2C1 (remapped pins vs. Expansion connector)
+ * - CAN
+ * - TIM4 CH[3:4]
+ *
+ * Expansion connector:
+ * - WakeUp Pin
+ * - System Wide Reset
+ * - SPI1 is wired to expansion port
+ * - I2C1
+ * - USART2 [Rx, Tx, CTS, RTS]
+ * - DAC [0:1]
+ * - ADC2 on pins [0:7]
+ * - TIM2 Channels [1:4]
+ * - TIM5 Channels [1:4]
+ *
+ * Onboard Components:
+ * - SPI3 has direct connection with FRAM
+ * - SDCard, conencts the microSD and shares the control lines with Sensor Interface
+ * to select Amplifier Gain
+ * - ADC3 is used also for power management (can be shared with ADC1 on sensor connector
+ * if not used)
+ */
+
+/* LED */
+
+#define GPIO_LED (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN2 |GPIO_OUTPUT_CLEAR)
+
+/* BUTTON - Note that after a good second button causes hardware reset */
+
+#define GPIO_PUSHBUTTON (GPIO_INPUT |GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5 )
+
+/* Power Management Pins */
+
+#define GPIO_PVS (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN7 |GPIO_OUTPUT_CLEAR)
+#define GPIO_PST (GPIO_INPUT |GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN13)
+#define GPIO_SCTC (GPIO_INPUT |GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN8 )
+#define GPIO_PCLR (GPIO_INPUT |GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTD|GPIO_PIN1 ) // by default this pin is OSCOUT, requires REMAP
+#define GPIO_XPWR (GPIO_INPUT |GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN4 )
+
+/* FRAM (alt pins are not listed here and are a part of SPI) */
+
+#define GPIO_FRAM_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_50MHz|GPIO_PORTA|GPIO_PIN15|GPIO_OUTPUT_SET)
+
+/* Sensor Interface */
+
+#define GPIO_GP1_HIZ (GPIO_INPUT |GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN10)
+#define GPIO_GP1_PUP (GPIO_INPUT |GPIO_CNF_INPULLUP |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN10)
+#define GPIO_GP1_PDN (GPIO_INPUT |GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN10)
+#define GPIO_GP1_LOW (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN10|GPIO_OUTPUT_CLEAR)
+#define GPIO_GP1_HIGH (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN10|GPIO_OUTPUT_SET)
+
+#define GPIO_GP2_HIZ (GPIO_INPUT |GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN11)
+#define GPIO_GP2_PUP (GPIO_INPUT |GPIO_CNF_INPULLUP |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN11)
+#define GPIO_GP2_PDN (GPIO_INPUT |GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN11)
+#define GPIO_GP2_LOW (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN11|GPIO_OUTPUT_CLEAR)
+#define GPIO_GP2_HIGH (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN11|GPIO_OUTPUT_SET)
+
+#define GPIO_OPA_INPUT (GPIO_INPUT |GPIO_CNF_ANALOGIN |GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN0 )
+#define GPIO_OPA_ENABLE (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN1 |GPIO_OUTPUT_CLEAR)
+#define GPIO_OPA_REFAIN (GPIO_INPUT |GPIO_CNF_ANALOGIN |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN0 )
+#define GPIO_OPA_REFPWM (GPIO_ALT |GPIO_CNF_AFPP |GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN0 )
+
+#define GPIO_OUT_PWRON (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN6 |GPIO_OUTPUT_CLEAR)
+#define GPIO_OUT_PWROFF (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN6 |GPIO_OUTPUT_SET)
+#define GPIO_OUT_PWRPWM (GPIO_ALT |GPIO_CNF_AFPP |GPIO_MODE_10MHz|GPIO_PORTC|GPIO_PIN6 )
+#define GPIO_OUT_PWRPWM_TIM8_CH 1 /* TIM8.CH1 */
+
+#define GPIO_OUT_HIZ (GPIO_INPUT |GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1 )
+#define GPIO_OUT_PUP (GPIO_INPUT |GPIO_CNF_INPULLUP |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1 )
+#define GPIO_OUT_PDN (GPIO_INPUT |GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1 )
+#define GPIO_OUT_LOW (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN1 |GPIO_OUTPUT_CLEAR)
+#define GPIO_OUT_HIGH (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTB|GPIO_PIN1 |GPIO_OUTPUT_SET)
+#define GPIO_OUT_AIN (GPIO_INPUT |GPIO_CNF_ANALOGIN |GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN1 )
+#define GPIO_OUT_PWM (GPIO_ALT |GPIO_CNF_AFPP |GPIO_MODE_10MHz|GPIO_PORTB|GPIO_PIN1 )
+#define GPIO_OUT_PWM_TIM3_CH 4 /* TIM3.CH4 */
+
+#define GPIO_PGIA_A0_H (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN8 |GPIO_OUTPUT_SET)
+#define GPIO_PGIA_A0_L (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN8 |GPIO_OUTPUT_CLEAR)
+#define GPIO_PGIA_A1_L (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN12|GPIO_OUTPUT_CLEAR)
+#define GPIO_PGIA_A1_H (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN12|GPIO_OUTPUT_SET)
+#define GPIO_PGIA_A2_H (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTD|GPIO_PIN2 |GPIO_OUTPUT_SET)
+#define GPIO_PGIA_A2_L (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTD|GPIO_PIN2 |GPIO_OUTPUT_CLEAR)
+#define GPIO_PGIA_AEN (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_2MHz |GPIO_PORTC|GPIO_PIN1 |GPIO_OUTPUT_CLEAR)
+
+
+/* Radio Connector */
+
+#define GPIO_CC1101_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP |GPIO_MODE_50MHz|GPIO_PORTB|GPIO_PIN12|GPIO_OUTPUT_SET)
+#define GPIO_CC1101_GDO0 (GPIO_INPUT|GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN9 )
+#define GPIO_CC1101_GDO2 (GPIO_INPUT|GPIO_CNF_INFLOAT |GPIO_MODE_INPUT|GPIO_PORTD|GPIO_PIN0 )
+
+
+/* Expansion Connector */
+
+
+/************************************************************************************
+ * Debugging
+ ************************************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# ifdef CONFIG_DEBUG
+# define message(...) lib_lowprintf(__VA_ARGS__)
+# else
+# define message(...) printf(__VA_ARGS__)
+# endif
+#else
+# ifdef CONFIG_DEBUG
+# define message lib_lowprintf
+# else
+# define message printf
+# endif
+#endif
+
+
+/************************************************************************************
+ * Public data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: stm32_spiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the VSN board.
+ *
+ ************************************************************************************/
+
+extern void weak_function stm32_spiinitialize(void);
+
+/************************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called to setup USB-related GPIO pins for the VSN board.
+ *
+ ************************************************************************************/
+
+extern void weak_function stm32_usbinitialize(void);
+
+/************************************************************************************
+ * Init Power Module and set board system voltage
+ ************************************************************************************/
+
+extern void board_power_init(void);
+
+/************************************************************************************
+ * Name: sysclock_select_hsi
+ *
+ * Description:
+ * Selects internal HSI Clock, SYSCLK = 36 MHz, HCLK = 36 MHz.
+ *
+ ************************************************************************************/
+
+extern void sysclock_select_hsi(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_VSN_SRC_VSN_INTERNAL_H */
+
diff --git a/nuttx/configs/xtrs/Kconfig b/nuttx/configs/xtrs/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/xtrs/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/xtrs/README.txt b/nuttx/configs/xtrs/README.txt
new file mode 100644
index 000000000..ecd44e4e2
--- /dev/null
+++ b/nuttx/configs/xtrs/README.txt
@@ -0,0 +1,169 @@
+xtrs README
+^^^^^^^^^^^^^
+
+Current status
+^^^^^^^^^^^^^^
+
+The xtrs port is not operational yet; some work still needs to be done.
+
+Contents
+^^^^^^^^
+
+ o Getting a TRS80 emulator and DOS disks
+ o Loading an executable into xtrs
+ o Configuring NuttX
+ o Building the SDCC toolchain
+ o SDCC Update
+ o Newer SDCC Versions
+
+Getting a TRS80 emulator and DOS disks
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This port uses a vintage computer based on the Z80, the TRS80.
+There's a main page describing the different models of TRS80.
+See: http://www.trs-80.com
+
+An emulator for this computer is available to run TRS80 programs on a
+linux platform (http://www.tim-mann.org/xtrs.html).
+
+Other emulators are available for other platforms.
+See http://www.trs-80.com, click on the link Emulators.
+
+TRSDOS, LDOS and other softwares are available at:
+http://discover-net.net/~dmkeil/trs80/software/trs-dos.htm
+
+Or you can get TRSDOS 1.3 and 6.1 from this site; it's included with the emulator.
+http://discover-net.net/~dmkeil/trs80/model4.htm
+
+The SDCC toolchain is available from http://sdcc.sourceforge.net/. All
+testing has been performed using version 2.7.0 of the SDCC toolchain.
+
+Loading an executable into xtrs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+At http://www.trs-80.com click on the link: Getting a Software Onto an Emulator.
+
+Configuring NuttX
+^^^^^^^^^^^^^^^^^
+
+ ostest
+ This configuration performs a simple, minimal OS test using
+ examples/ostest. This can be configurated as follows:
+
+ cd tools
+ ./configure.sh xtrs/ostest
+ cd -
+ . ./setenv.sh
+
+ nsh
+ This configuration file builds NSH (examples/nsh). This
+ configuration is not functional due to issues with use of the
+ simulated serial driver (see the TODO list).
+
+ This configuration can be selected by:
+
+ cd tools
+ ./configure.sh xtrs/nsh
+ cd -
+ . ./setenv.sh
+
+ pashello
+ Configures to use examples/pashello for execution from FLASH
+ See examples/README.txt for information about pashello.
+
+ This configuration is not usable because the resulting binary
+ is too large for the z80 address space.
+
+ This configuration can be selected by:
+
+ cd tools
+ ./configure.sh xtrs/pashello
+ cd -
+ . ./setenv.sh
+
+Building the SDCC toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The SDCC toolchain is built with the standard configure/make/make install
+sequence. However, some special actions are required to generate libraries
+compatible with this build. First start with the usual steps
+
+ download
+ unpack
+ cd sdcc
+ ./configure
+
+But before making, we need to apply a patch to the SDCC 2.6.0 source
+so that the z80 assembler can handle long symbol names
+
+ Apply sdcc-2.6.0-asz80-symlen.patch
+ cd sdcc/device/lib
+
+Then make the SDCC binaries
+
+ cd sdcc
+ make
+
+and install SDCC:
+
+ sudo make install
+
+SDCC Update
+^^^^^^^^^^^
+
+I have had some problems building sdcc-2.6.0 on my current UBUNTU
+release (9.10). I had other problems building sdcc-2.9.0 on UBUNTU 9.10.
+I suspect that the newer gcc toolchains are causing problems for these
+older SDCC releases.
+
+A 20091106 snapshot did build with no major problems on UBUNTU 9.10, but
+has some compatibilty problems with the older SDCC compiler. For one, you
+will need to change the Z80 assember name and options in the Make.defs
+files as follows:
+
+-AS = as-z80
++AS = sdasz80
+
+- @$(AS) $(ASFLAGS) $2 $1
++ $(AS) $(ASFLAGS) $1
+
+For another, I had other problems building with that 20091106 that look
+like compiler bugs. If you are using UBUNTU 9.10, you may have to either
+(1) downgrade your GCC compiler to a version 3.x compiler and use one of
+the older stable releases, or (2) wait for the next stable SDCC release
+after 2.9.0.
+
+See below: If you wish to continue using the older SDCC toolchain, you
+must now also add CONFIG_SDCC_OLD=y to your configuration file.
+
+Newer SDCC Versions
+^^^^^^^^^^^^^^^^^^^
+
+This is the text of bug 3468951 reported on the SourceForge website:
+
+"Some obsolete stuff in z80sim port," (submitted by Philipp Klaus Krause):
+
+ The simz80 port needs a few updates to work well with current sdcc versions,
+ and has some unecessary stuff:
+
+ * The linker name for Make.defs should be sdldz80
+ * The assembler name for Make.defs should be sdasz80
+ * _asm and _endasm in z80_io.c and z80_irq.c should be replaced by __asm
+ and __endasm
+ * The --stack-auto --int-long-reent --float-reent options or Make.defs should
+ be removed, as they have no effect on sdcc's z80 port
+ * The current assembler AFAIK can handle long symbol names, so the
+ sdcc-2.6.0-asz80-symlen.patch is unnecessary, and it and the corresponding
+ section from the README can be removed.
+
+These changes *have* been incorporated but only partially verified. In order
+to get a successful compilation, I had to copy stdarg.h out of the SDCC source
+(at sdcc/device/include/stdarg.h) to include/nuttx/stdarg.h.
+
+There are also some library related issues when you get to the final build
+that I have not looked into yet.
+
+If you want to back out these change and continue to use the older toolchain
+in your build, simpy define the following in your configuration file:
+
+ CONFIG_SDCC_OLD=y
diff --git a/nuttx/configs/xtrs/include/README.txt b/nuttx/configs/xtrs/include/README.txt
new file mode 100644
index 000000000..dfd9f734b
--- /dev/null
+++ b/nuttx/configs/xtrs/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the xtrs80 emulator
diff --git a/nuttx/configs/xtrs/include/board.h b/nuttx/configs/xtrs/include/board.h
new file mode 100644
index 000000000..02ab012f8
--- /dev/null
+++ b/nuttx/configs/xtrs/include/board.h
@@ -0,0 +1,71 @@
+/************************************************************
+ * configs/xtrs/include/board.h
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************
+ * Included Files
+ ************************************************************/
+
+/* Adresses of BIOS routines */
+
+#include "trs80-m3.h"
+
+/************************************************************
+ * Definitions
+ ************************************************************/
+
+/************************************************************
+ * Public Functions
+ ************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+EXTERN void z80_lowputc(char ch) __naked;
+EXTERN char z80_lowgetc(void) __naked;
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/xtrs/include/trs80-m3.h b/nuttx/configs/xtrs/include/trs80-m3.h
new file mode 100644
index 000000000..1a23b2d7b
--- /dev/null
+++ b/nuttx/configs/xtrs/include/trs80-m3.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+ * configs/xtrs/include/trs80-m3.h
+ *
+ * Copyright (C) 2008 Jacques Pelletier. All rights reserved.
+ * Author: Jacques Pelletier
+ *
+ * This file is a part of NuttX and hence
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* Information from http://www.trs-80.com */
+
+#ifndef __TRS80_M3_H
+#define __TRS80_M3_H
+
+/* Outputs a byte to a logical device or FCB. DE = FCB and A = byte.
+ * Don't confuse with CTL at 0023.
+ */
+
+#define _TRS80_M3_PUT 0x001B
+
+/* Outputs a control byte to a logical device or FCB. DE = FCB and A = control byte. */
+
+#define _TRS80_M3_CTL 0x0023
+
+/* Scan keyboard and return with accumulator containing result. DE is used. */
+
+#define _TRS80_M3_KBDSCN 0x002B
+
+/* Displays a character at current cursor location. */
+
+#define _TRS80_M3_VDCHAR 0x0033
+
+/* "Waits until printer is ready then prints character. A = ASCII character.
+ * If BREAK is pressed, a return to caller is made."
+ */
+
+#define _TRS80_M3_PRCHAR 0x003B
+
+/* Call Input a line from the keyboard. B = max length of line. HL points at buffer.
+ * Buffer should be the length of B plus 1. To terminate, hit BREAK or ENTER.
+ * On exit, HL points at buffer and B = number of characters entered.
+ * Carry will be set if BREAK was pressed.
+ */
+
+#define _TRS80_M3_KBLINE 0x0040
+
+/* "Scans the keyboard until a key is pressed. If BREAK is pressed, it is returned
+ * like other keys."
+ */
+
+#define _TRS80_M3_KBWAIT 0x0049
+
+/* "Receive a character from RS-232. No entry conditions. On exit, memory location
+ * 16872 contains character received. DE is altered. This routine honors wait status."
+ */
+
+#define _TRS80_M3_RSRCV 0x0050
+
+/* "Transmit character to RS-232. On entry, Accumulator or memory location 16880
+ * contains character. On exit, 16880 = 0 if no character sent. Wait status honored."
+ */
+
+#define _TRS80_M3_RSTX 0x0055
+
+/* Initialize RS-232 interface. On entry, memory location 16888 = send/receive baud
+ * rate code, location 16890 = wait/don't wait switch, location 16889 = RS-232
+ * characteristics switch. On exit, DE is altered. For more detail, consult Model 3
+ * reference manual.
+ */
+
+#define _TRS80_M3_RSINIT 0x005A
+
+/* This is the routine that is Basic's SET, RESET, and POINT functions. Here's how
+ * to use it. Load HL with return address and push. Load register A with one of the
+ * following: 00H = POINT, 01H = RESET, and 80H = SET. Push AF onto stack. Load A with
+ * X coordinate and push onto stack. Load A with Y coordinate and JP GRAPH.
+ */
+
+#define _TRS80_M3_GRAPH 0x0150
+
+/* Clear screen. */
+
+#define _TRS80_M3_CLS 0x01C9
+
+/* Randomize. */
+
+#define _TRS80_M3_RANDOM 0x01D3
+
+/* This routine turns off the cassette drive. */
+
+#define _TRS80_M3_CSOFF 0x01F8
+
+#ifdef TRS80_MODEL1
+
+/* A register contains a 0 or 1 which is the cassette number. This routine defines
+ * cassette number and turns on cassette. Model I only.
+ */
+
+#define _TRS80_M3_DEFCAS 0x0212
+
+#endif /* TRS80_MODEL1 */
+
+/* Inputs data one byte at a time from cassette after you use CSHIN. A = the data
+ * byte.
+ */
+
+#define _TRS80_M3_CSIN 0x0235
+
+/* Outputs data one byte at a time to cassette after you use CSHWR. A = the
+ * output byte.
+ */
+
+#define _TRS80_M3_CSOUT 0x0264
+
+/* Turns on the cassette and writes the header. */
+
+#define _TRS80_M3_CSHWR 0x0287
+
+/* Finds the cassette header info at the beggining of cassette file. */
+
+#define _TRS80_M3_CSHIN 0x0296
+
+/* Ouput character in register A; OUTSEL (409CH) selects device. See OUTSEL for
+ * device values.
+ */
+
+#define _TRS80_M3_OUTCHR 0x032A
+
+/* Displays character in A on screen at next print position. Uses AF. */
+
+#define _TRS80_M3_DISPA 0x033A
+
+/* Calls keyboard scan routine. */
+
+#define _TRS80_M3_keyb_scan 0x0358
+
+/* Reads keyboard into buffer until a carriage return is entered. 40A7H contains
+ * the address of the buffer.
+ */
+
+#define _TRS80_M3_KIBUFF 0x0361
+
+/* Same as KBLINE. See 0040. */
+
+#define _TRS80_M3_KLINE 0x05D9
+
+/* "Get date in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS." */
+
+#define _TRS80_M3_GETDAT 0x3033
+
+/* "Get time in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS." */
+
+#define _TRS80_M3_GETTIM 0x3036
+
+#endif /* __TRS80_M3_H */
diff --git a/nuttx/configs/xtrs/nsh/Make.defs b/nuttx/configs/xtrs/nsh/Make.defs
new file mode 100644
index 000000000..947deb5af
--- /dev/null
+++ b/nuttx/configs/xtrs/nsh/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/xtrs/nsh/Make.defs
+#
+# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+
+ifeq ($(CONFIG_SDCC_OLD),y)
+
+LD = link-z80
+AS = as-z80
+ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+
+else
+
+LD = sdldz80
+AS = sdasz80
+ARCHCPUFLAGS = -mz80
+
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+ASFLAGS = -x -a -l -o -s
+
+SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
+SDCCLIB = z80.lib
+
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .cmd
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $2 $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/xtrs/nsh/appconfig b/nuttx/configs/xtrs/nsh/appconfig
new file mode 100644
index 000000000..ef9401691
--- /dev/null
+++ b/nuttx/configs/xtrs/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/xtrs/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/xtrs/nsh/defconfig b/nuttx/configs/xtrs/nsh/defconfig
new file mode 100644
index 000000000..b8bd5d6f2
--- /dev/null
+++ b/nuttx/configs/xtrs/nsh/defconfig
@@ -0,0 +1,220 @@
+############################################################################
+# configs/xtrs/nsh/defconfig
+#
+# Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="z80"
+CONFIG_ARCH_CHIP_Z80=y
+CONFIG_ARCH_BOARD="xtrs"
+CONFIG_ARCH_BOARD_XTRS=y
+CONFIG_DRAM_SIZE=65536
+
+#
+# Z80sim specific device driver settings
+#
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_TXBUFSIZE=256
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+CONFIG_LINKER_START_AREA=0x5200
+CONFIG_LINKER_CODE_AREA=0x5300
+CONFIG_LINKER_ROM_AT_0000=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=40
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/xtrs/nsh/setenv.sh b/nuttx/configs/xtrs/nsh/setenv.sh
new file mode 100755
index 000000000..99d45f97a
--- /dev/null
+++ b/nuttx/configs/xtrs/nsh/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# configs/xtrs/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/xtrs/ostest/Make.defs b/nuttx/configs/xtrs/ostest/Make.defs
new file mode 100644
index 000000000..06cc05db0
--- /dev/null
+++ b/nuttx/configs/xtrs/ostest/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/xtrs/ostest/Make.defs
+#
+# Copyright (C) 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+
+ifeq ($(CONFIG_SDCC_OLD),y)
+
+LD = link-z80
+AS = as-z80
+ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+
+else
+
+LD = sdldz80
+AS = sdasz80
+ARCHCPUFLAGS = -mz80
+
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+ASFLAGS = -x -a -l -o -s
+
+SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
+SDCCLIB = z80.lib
+
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .cmd
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $2 $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/xtrs/ostest/appconfig b/nuttx/configs/xtrs/ostest/appconfig
new file mode 100644
index 000000000..d99892985
--- /dev/null
+++ b/nuttx/configs/xtrs/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/xtrs/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/xtrs/ostest/defconfig b/nuttx/configs/xtrs/ostest/defconfig
new file mode 100644
index 000000000..9c88c5d8f
--- /dev/null
+++ b/nuttx/configs/xtrs/ostest/defconfig
@@ -0,0 +1,205 @@
+############################################################################
+# configs/xtrs/ostest/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="z80"
+CONFIG_ARCH_CHIP_Z80=y
+CONFIG_ARCH_BOARD="xtrs"
+CONFIG_ARCH_BOARD_XTRS=y
+CONFIG_DRAM_SIZE=65536
+
+#
+# xtrs specific device driver settings
+#
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_TXBUFSIZE=256
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+CONFIG_LINKER_START_AREA=0x5200
+CONFIG_LINKER_CODE_AREA=0x5300
+CONFIG_LINKER_ROM_AT_0000=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/xtrs/ostest/setenv.sh b/nuttx/configs/xtrs/ostest/setenv.sh
new file mode 100755
index 000000000..73454b772
--- /dev/null
+++ b/nuttx/configs/xtrs/ostest/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# configs/xtrs/ostest/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/xtrs/pashello/Make.defs b/nuttx/configs/xtrs/pashello/Make.defs
new file mode 100644
index 000000000..2c2fb47ce
--- /dev/null
+++ b/nuttx/configs/xtrs/pashello/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/xtrs/pashello/Make.defs
+#
+# Copyright (C) 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+
+ifeq ($(CONFIG_SDCC_OLD),y)
+
+LD = link-z80
+AS = as-z80
+ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+
+else
+
+LD = sdldz80
+AS = sdasz80
+ARCHCPUFLAGS = -mz80
+
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+ASFLAGS = -x -a -l -o -s
+
+SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
+SDCCLIB = z80.lib
+
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .cmd
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $2 $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/xtrs/pashello/appconfig b/nuttx/configs/xtrs/pashello/appconfig
new file mode 100644
index 000000000..7cb5a7cf2
--- /dev/null
+++ b/nuttx/configs/xtrs/pashello/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/xtrs/pashello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/pashello
+
+# Path to the Pascal p-code runtime interpreter module
+
+CONFIGURED_APPS += interpreters/pcode
+
diff --git a/nuttx/configs/xtrs/pashello/defconfig b/nuttx/configs/xtrs/pashello/defconfig
new file mode 100644
index 000000000..d187ccec5
--- /dev/null
+++ b/nuttx/configs/xtrs/pashello/defconfig
@@ -0,0 +1,205 @@
+############################################################################
+# configs/xtrs/pashello/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="z80"
+CONFIG_ARCH_CHIP_Z80=y
+CONFIG_ARCH_BOARD="xtrs"
+CONFIG_ARCH_BOARD_XTRS=y
+CONFIG_DRAM_SIZE=65536
+
+#
+# xtrs specific device driver settings
+#
+CONFIG_UART_RXBUFSIZE=256
+CONFIG_UART_TXBUFSIZE=256
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+CONFIG_LINKER_START_AREA=0x5200
+CONFIG_LINKER_CODE_AREA=0x5300
+CONFIG_LINKER_ROM_AT_0000=y
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="pashello_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=4
+CONFIG_NFILE_STREAMS=4
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/xtrs/pashello/setenv.sh b/nuttx/configs/xtrs/pashello/setenv.sh
new file mode 100755
index 000000000..4e2e98e31
--- /dev/null
+++ b/nuttx/configs/xtrs/pashello/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# configs/xtrs/pashello/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch b/nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch
new file mode 100644
index 000000000..d91c18d98
--- /dev/null
+++ b/nuttx/configs/xtrs/sdcc-2.6.0-asz80-symlen.patch
@@ -0,0 +1,11 @@
+--- sdcc/as/z80/asm.h 2007-12-30 16:49:53.000000000 -0600
++++ sdcc.orig/as/z80/asm.h 2007-12-30 16:49:14.000000000 -0600
+@@ -65,7 +65,7 @@
+ #define RTTERM ')' /* Right expression delimeter */
+
+ #ifdef SDK
+-#define NCPS 80 /* characters per symbol */
++#define NCPS 32 /* characters per symbol */
+ #else /* SDK */
+ #define NCPS 8 /* Chars. per symbol */
+ #endif /* SDK */
diff --git a/nuttx/configs/xtrs/src/Make.defs b/nuttx/configs/xtrs/src/Make.defs
new file mode 100644
index 000000000..e20f03a4e
--- /dev/null
+++ b/nuttx/configs/xtrs/src/Make.defs
@@ -0,0 +1,37 @@
+############################################################################
+# configs/xtrs/src/Make.defs
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+HEAD_ASRC = xtrs_head.asm
+
diff --git a/nuttx/configs/xtrs/src/Makefile b/nuttx/configs/xtrs/src/Makefile
new file mode 100644
index 000000000..9b14cf417
--- /dev/null
+++ b/nuttx/configs/xtrs/src/Makefile
@@ -0,0 +1,77 @@
+############################################################################
+# configs/xtrs/src/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/arch/z80/src/common -I$(TOPDIR)/arch/z80/src/z80
+
+ASRCS =
+AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
+CSRCS = xtr_irq.c xtr_serial.c xtr_timerisr.c xtr_lowputc.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/include
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/xtrs/src/README.txt b/nuttx/configs/xtrs/src/README.txt
new file mode 100644
index 000000000..d733b60bd
--- /dev/null
+++ b/nuttx/configs/xtrs/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the xtrs80 emulation
diff --git a/nuttx/configs/xtrs/src/xtr_irq.c b/nuttx/configs/xtrs/src/xtr_irq.c
new file mode 100644
index 000000000..72f6c10e2
--- /dev/null
+++ b/nuttx/configs/xtrs/src/xtr_irq.c
@@ -0,0 +1,116 @@
+/****************************************************************************
+ * configs/xtrs/src/xtr_irq.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+
+#include "up_arch.h"
+#include "os_internal.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_irqinitialize
+ ****************************************************************************/
+
+void up_irqinitialize(void)
+{
+ /* Attach the timer interrupt -- There is not special timer interrupt
+ * enable in the simulation so it must be enabled here before interrupts
+ * are enabled.
+ *
+ * NOTE: Normally, there are seperate enables for "global" interrupts
+ * and specific device interrupts. In such a "normal" case, the timer
+ * interrupt should be attached and enabled in the function up_timerinit()
+ */
+
+ irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)up_timerisr);
+
+ /* And finally, enable interrupts (including the timer) */
+
+#ifndef CONFIG_SUPPRESS_INTERRUPTS
+ irqrestore(Z80_C_FLAG);
+#endif
+}
+
+/****************************************************************************
+ * Name: up_disable_irq
+ *
+ * Description:
+ * Disable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_disable_irq(int irq)
+{
+ irqrestore(0);
+}
+
+/****************************************************************************
+ * Name: up_enable_irq
+ *
+ * Description:
+ * Enable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_enable_irq(int irq)
+{
+ irqrestore(true);
+}
diff --git a/nuttx/configs/xtrs/src/xtr_lowputc.c b/nuttx/configs/xtrs/src/xtr_lowputc.c
new file mode 100644
index 000000000..8ed166211
--- /dev/null
+++ b/nuttx/configs/xtrs/src/xtr_lowputc.c
@@ -0,0 +1,105 @@
+/********************************************************************************
+ * configs/xtrs/src//xtr_lowputc.c
+ *
+ * Copyright (C) 2008 Jacques Pelletier. All rights reserved.
+ * Author: Jacques Pelletier
+ *
+ * This file is a part of NuttX and hence
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************/
+
+/********************************************************************************
+ * Included Files
+ ********************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <assert.h>
+#include <debug.h>
+
+#include "os_internal.h"
+#include "up_internal.h"
+
+/* Includes trs80-m3.h for assembler call addresses */
+
+#include <board/board.h>
+
+/********************************************************************************
+ * Definitions
+ ********************************************************************************/
+
+/********************************************************************************
+ * Public Data
+ ********************************************************************************/
+
+/********************************************************************************
+ * Private Data
+ ********************************************************************************/
+
+/********************************************************************************
+ * Private Functions
+ ********************************************************************************/
+
+/********************************************************************************
+ * Public Functions
+ ********************************************************************************/
+
+/********************************************************************************
+ * Name: z80_lowputc
+ ********************************************************************************/
+
+void z80_lowputc(char ch) __naked
+{
+ _asm
+ ld hl, #2
+ add hl, sp
+ ld a, (hl)
+ call _TRS80_M3_VDCHAR ;0x0033
+ ret
+ _endasm;
+}
+
+/********************************************************************************
+ * Name: z80_lowgetc
+ ********************************************************************************/
+
+char z80_lowgetc(void) __naked
+{
+ _asm
+ call _TRS80_M3_KBDSCN ;0x002b
+ ld l, a
+ ld h, #0
+ ret
+ _endasm;
+}
diff --git a/nuttx/configs/xtrs/src/xtr_serial.c b/nuttx/configs/xtrs/src/xtr_serial.c
new file mode 100644
index 000000000..42cffb740
--- /dev/null
+++ b/nuttx/configs/xtrs/src/xtr_serial.c
@@ -0,0 +1,411 @@
+/****************************************************************************
+ * config/xtrs/src/xtr_serial.c
+ *
+ * Copyright (C) 2008 Jacques Pelletier. All rights reserved.
+ * Author: Jacques Pelletier
+ *
+ * This file is a part of NuttX and hence
+ *
+ * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/serial/serial.h>
+#include <arch/serial.h>
+
+#include "up_arch.h"
+#include "os_internal.h"
+#include "up_internal.h"
+
+#ifdef USE_SERIAL_DRIVER
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+#define TRSDOS 0 /* TRSDOS 1.3 */
+#define LDOS 1 /* LDOS 5.3.1 */
+
+#define MODEM_STATUS 0xe8
+#define RESET 0xe8
+#define BAUD 0xe9
+#define STATUS 0xea
+#define CONTROL 0xea
+#define RECV_REG 0xeb
+#define XMIT_REG 0xeb
+
+#define XMIT_REG_EMPTY 0x40
+
+#define WRINTMASK 0xe0
+
+#define MASK_XMIT_INT 0x10
+#define MASK_RECV_INT 0x20
+#define MASK_ERR_INT 0x40
+
+#if TRSDOS
+#define WRINTMASK_SHADOW 0x4213
+#define XMIT_INT_VECTOR 0x4207
+#define RECV_INT_VECTOR 0x420a
+#endif
+
+#if LDOS
+#define WRINTMASK_SHADOW 0x4474
+#define XMIT_INT_VECTOR 0x447D
+#define RECV_INT_VECTOR 0x447F
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int up_setup(struct uart_dev_s *dev);
+static void up_shutdown(struct uart_dev_s *dev);
+static int up_attach(struct uart_dev_s *dev);
+static void up_detach(struct uart_dev_s *dev);
+static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
+static int up_receive(struct uart_dev_s *dev, uint32_t *status);
+static void up_rxint(struct uart_dev_s *dev, bool enable);
+static bool up_rxavailable(struct uart_dev_s *dev);
+static void up_send(struct uart_dev_s *dev, int ch);
+static void up_txint(struct uart_dev_s *dev, bool enable);
+static bool up_txready(struct uart_dev_s *dev);
+static bool up_txempty(struct uart_dev_s *dev);
+
+/****************************************************************************
+ * Private Variables
+ ****************************************************************************/
+
+struct uart_ops_s g_uart_ops =
+{
+ up_setup, /* setup */
+ up_shutdown, /* shutdown */
+ up_attach, /* attach */
+ up_detach, /* detach */
+ up_ioctl, /* ioctl */
+ up_receive, /* receive */
+ up_rxint, /* rxint */
+ up_rxavailable, /* rxavailable */
+ up_send, /* send */
+ up_txint, /* txint */
+ up_txready, /* txready */
+ up_txempty, /* txempty */
+};
+
+/* I/O buffers */
+
+static char g_uartrxbuffer[CONFIG_UART_RXBUFSIZE];
+static char g_uarttxbuffer[CONFIG_UART_TXBUFSIZE];
+
+/* This describes the state of the fake UART port. */
+
+static uart_dev_t g_uartport =
+{
+ 0, /* open_count */
+ false, /* xmitwaiting */
+ false, /* recvwaiting */
+ false, /* isconsole */
+ { 1 }, /* closesem */
+ { 0 }, /* xmitsem */
+ { 0 }, /* recvsem */
+ { /* xmit */
+ { 1 }, /* sem */
+ 0, /* head */
+ 0, /* tail */
+ CONFIG_UART_TXBUFSIZE, /* size */
+ g_uarttxbuffer, /* buffer */
+ },
+ { /* recv */
+ { 1 }, /* sem */
+ 0, /* head */
+ 0, /* tail */
+ CONFIG_UART_RXBUFSIZE, /* size */
+ g_uartrxbuffer, /* buffer */
+ },
+ &g_uart_ops, /* ops */
+ NULL, /* priv */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setup
+ *
+ * Description:
+ * Configure the UART baud, bits, parity, fifos, etc. This
+ * method is called the first time that the serial port is
+ * opened.
+ *
+ ****************************************************************************/
+
+static int up_setup(struct uart_dev_s *dev)
+{
+ outp(RESET, 0);
+ outp(CONTROL, ctrl);
+ outp(BAUD, baud);
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: up_shutdown
+ *
+ * Description:
+ * Disable the UART. This method is called when the serial
+ * port is closed
+ *
+ ****************************************************************************/
+
+static void up_shutdown(struct uart_dev_s *dev)
+{
+}
+
+/****************************************************************************
+ * Name: up_attach
+ *
+ * Description:
+ * Configure the UART to operation in interrupt driven mode. This method is
+ * called when the serial port is opened. Normally, this is just after the
+ * setup() method is called, however, the serial console may operate in a
+ * non-interrupt driven mode during the boot phase.
+ *
+ * RX and TX interrupts are not enabled by the attach method (unless the
+ * hardware supports multiple levels of interrupt enabling). The RX and TX
+ * interrupts are not enabled until the txint() and rxint() methods are called.
+ *
+ ****************************************************************************/
+
+static int up_attach(struct uart_dev_s *dev)
+{
+// SDCC complains here
+// *((void (*)()) XMIT_INT_VECTOR) = rs232_xmitisr;
+// *((void (*)()) RECV_INT_VECTOR) = rs232_recvisr;
+ *((int *) XMIT_INT_VECTOR) = (int) rs232_xmitisr;
+ *((int *) RECV_INT_VECTOR) = (int) rs232_recvisr;
+
+ *(char *)WRINTMASK_SHADOW &= ~(MASK_ERR_INT | MASK_XMIT_INT);
+ outp(WRINTMASK, *(char *)WRINTMASK_SHADOW |= MASK_RECV_INT);
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: up_detach
+ *
+ * Description:
+ * Detach UART interrupts. This method is called when the serial port is
+ * closed normally just before the shutdown method is called. The exception is
+ * the serial console which is never shutdown.
+ *
+ ****************************************************************************/
+
+static void up_detach(struct uart_dev_s *dev)
+{
+ outp(WRINTMASK, *(char *)WRINTMASK_SHADOW &= ~(MASK_ERR_INT | MASK_RECV_INT | MASK_XMIT_INT));
+ *((int *) XMIT_INT_VECTOR) = 0x35fa;
+ *((int *) RECV_INT_VECTOR) = 0x35fa;
+}
+
+/****************************************************************************
+ * Name: up_ioctl
+ *
+ * Description:
+ * All ioctl calls will be routed through this method
+ *
+ ****************************************************************************/
+
+static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
+{
+ *get_errno_ptr() = ENOTTY;
+ return ERROR;
+}
+
+/****************************************************************************
+ * Name: up_receive
+ *
+ * Description:
+ * Called (usually) from the interrupt level to receive one
+ * character from the UART. Error bits associated with the
+ * receipt are provided in the return 'status'.
+ *
+ ****************************************************************************/
+
+static int up_receive(struct uart_dev_s *dev, uint32_t *status)
+{
+// uint8_t ch = z80_lowputc();
+
+ *status = 0;
+ return ch;
+}
+
+/****************************************************************************
+ * Name: up_rxint
+ *
+ * Description:
+ * Call to enable or disable RX interrupts
+ *
+ ****************************************************************************/
+
+static void up_rxint(struct uart_dev_s *dev, bool enable)
+{
+}
+
+/****************************************************************************
+ * Name: up_rxavailable
+ *
+ * Description:
+ * Return true if the receive fifo is not empty
+ *
+ ****************************************************************************/
+
+static bool up_rxavailable(struct uart_dev_s *dev)
+{
+ return true;
+}
+
+/****************************************************************************
+ * Name: up_send
+ *
+ * Description:
+ * This method will send one byte on the UART
+ *
+ ****************************************************************************/
+
+static void up_send(struct uart_dev_s *dev, int ch)
+{
+ z80_lowputc(ch);
+}
+
+/****************************************************************************
+ * Name: up_txint
+ *
+ * Description:
+ * Call to enable or disable TX interrupts
+ *
+ ****************************************************************************/
+
+static void up_txint(struct uart_dev_s *dev, bool enable)
+{
+}
+
+/****************************************************************************
+ * Name: up_txready
+ *
+ * Description:
+ * Return true if the transmit fifo is not full
+ *
+ ****************************************************************************/
+
+static bool up_txready(struct uart_dev_s *dev)
+{
+ return true;
+}
+
+/****************************************************************************
+ * Name: up_txempty
+ *
+ * Description:
+ * Return true if the transmit fifo is empty
+ *
+ ****************************************************************************/
+
+static bool up_txempty(struct uart_dev_s *dev)
+{
+ return true;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_serialinit
+ *
+ * Description:
+ * Performs the low level UART initialization early in
+ * debug so that the serial console will be available
+ * during bootup. This must be called before up_serialinit.
+ *
+ ****************************************************************************/
+
+void up_earlyserialinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_serialinit
+ *
+ * Description:
+ * Register serial ports. This assumes
+ * that up_earlyserialinit was called previously.
+ *
+ ****************************************************************************/
+
+void up_serialinit(void)
+{
+ (void)uart_register("/dev/console", &g_uartport);
+ (void)uart_register("/dev/ttyS0", &g_uartport);
+}
+#endif /* USE_SERIALDRIVER */
+
+/****************************************************************************
+ * Name: up_putc
+ *
+ * Description:
+ * Provide priority, low-level access to support OS debug
+ * writes
+ *
+ ****************************************************************************/
+
+int up_putc(int ch)
+{
+ z80_lowputc(ch);
+ return 0;
+}
diff --git a/nuttx/configs/xtrs/src/xtr_timerisr.c b/nuttx/configs/xtrs/src/xtr_timerisr.c
new file mode 100644
index 000000000..295bc65d7
--- /dev/null
+++ b/nuttx/configs/xtrs/src/xtr_timerisr.c
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * configs/xtrs/src/xtr_timerisr.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include "clock_internal.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Global Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Function: up_timerisr
+ *
+ * Description:
+ * The timer ISR will perform a variety of services for various portions of
+ * the system.
+ *
+ ****************************************************************************/
+
+int up_timerisr(int irq, FAR chipreg_t *regs)
+{
+ /* Process timer interrupt */
+
+ sched_process_timer();
+ return 0;
+}
+
+/****************************************************************************
+ * Function: up_timerinit
+ *
+ * Description:
+ * This function is called during start-up to initialize the timer
+ * interrupt.
+ *
+ ****************************************************************************/
+
+void up_timerinit(void)
+{
+ /* The timer interrupt was attached in up_irqinitialize -- see comments there */
+}
diff --git a/nuttx/configs/xtrs/src/xtrs_head.asm b/nuttx/configs/xtrs/src/xtrs_head.asm
new file mode 100644
index 000000000..bd7156f59
--- /dev/null
+++ b/nuttx/configs/xtrs/src/xtrs_head.asm
@@ -0,0 +1,276 @@
+;**************************************************************************
+; configs/xtrs/src/xtrs_head.asm
+;
+; Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+; Author: Gregory Nutt <gnutt@nuttx.org>
+;
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions
+; are met:
+;
+; 1. Redistributions of source code must retain the above copyright
+; notice, this list of conditions and the following disclaimer.
+; 2. Redistributions in binary form must reproduce the above copyright
+; notice, this list of conditions and the following disclaimer in
+; the documentation and/or other materials provided with the
+; distribution.
+; 3. Neither the name NuttX nor the names of its contributors may be
+; used to endorse or promote products derived from this software
+; without specific prior written permission.
+;
+; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+; COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+; POSSIBILITY OF SUCH DAMAGE.
+;
+;**************************************************************************
+
+ .title NuttX for the Z80
+ .module xtrs_head
+
+;**************************************************************************
+; Constants
+;**************************************************************************
+
+ ; Register save area layout
+
+ XCPT_I == 0 ; Offset 0: Saved I w/interrupt state in parity
+ XCPT_BC == 2 ; Offset 1: Saved BC register
+ XCPT_DE == 4 ; Offset 2: Saved DE register
+ XCPT_IX == 6 ; Offset 3: Saved IX register
+ XCPT_IY == 8 ; Offset 4: Saved IY register
+ XCPT_SP == 10 ; Offset 5: Offset to SP at time of interrupt
+ XCPT_HL == 12 ; Offset 6: Saved HL register
+ XCPT_AF == 14 ; Offset 7: Saved AF register
+ XCPT_PC == 16 ; Offset 8: Offset to PC at time of interrupt
+
+ ; Default stack base (needs to be fixed)
+
+ .include "asm_mem.h"
+
+;**************************************************************************
+; Global symbols used
+;**************************************************************************
+
+ .globl _os_start ; OS entry point
+ .globl _up_doirq ; Interrupt decoding logic
+
+;**************************************************************************
+; System start logic
+;**************************************************************************
+
+_up_reset:
+ ; Set up the stack pointer at the location determined the Makefile
+ ; and stored in asm_mem.h
+
+ ld SP, #CONFIG_STACK_END ; Set stack pointer
+
+ ; Performed initialization unique to the SDCC toolchain
+
+ call gsinit ; Initialize the data section
+
+ ; Copy the reset vectors
+
+ ld hl, #_up_rstvectors ; code for RAM
+ ld de, #0x4000 ; move it here
+ ld bc, #3*7 ; 7 vectors / 3 bytes each
+ ldir
+
+ ; Then start NuttX
+
+ call _os_start ; jump to the OS entry point
+
+ ; NuttX will never return, but just in case...
+
+_up_halt::
+ halt ; We should never get here
+ jp _up_halt
+
+ ; Data to copy to address 0x4000
+
+_up_rstvectors:
+ jp _up_rst1 ; 0x4000 : RST 1
+ jp _up_rst2 ; 0x4003 : RST 2
+ jp _up_rst3 ; 0x4006 : RST 3
+ jp _up_rst4 ; 0x4009 : RST 4
+ jp _up_rst5 ; 0x400c : RST 5
+ jp _up_rst6 ; 0x400f : RST 6
+ jp _up_rst7 ; 0x4012 : RST 7
+
+;**************************************************************************
+; Other reset handlers
+;
+; Interrupt mode 1 behavior:
+;
+; 1. M1 cycle: 7 ticks
+; Acknowledge interrupt and decrements SP
+; 2. M2 cycle: 3 ticks
+; Writes the MS byte of the PC onto the stack and decrements SP
+; 3. M3 cycle: 3 ticks
+; Writes the LS byte of the PC onto the stack and sets the PC to 0x0038.
+;
+;**************************************************************************
+
+_up_rst1: ; RST 1
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #1 ; 1 = Z80_RST1
+ jr _up_rstcommon ; Remaining RST handling is common
+
+_up_rst2: ; RST 2
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #2 ; 2 = Z80_RST2
+ jr _up_rstcommon ; Remaining RST handling is common
+
+_up_rst3: ; RST 3
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #3 ; 1 = Z80_RST3
+ jr _up_rstcommon ; Remaining RST handling is common
+
+_up_rst4: ; RST 4
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #4 ; 1 = Z80_RST4
+ jr _up_rstcommon ; Remaining RST handling is common
+
+_up_rst5: ; RST 5
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #5 ; 1 = Z80_RST5
+ jr _up_rstcommon ; Remaining RST handling is common
+
+_up_rst6: ; RST 6
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #6 ; 1 = Z80_RST6
+ jr _up_rstcommon ; Remaining RST handling is common
+
+_up_rst7: ; RST 7
+ ; Save AF on the stack, set the interrupt number and jump to the
+ ; common reset handling logic.
+ ; Offset 8: Return PC is already on the stack
+ push af ; Offset 7: AF (retaining flags)
+ ld a, #7 ; 7 = Z80_RST7
+ jr _up_rstcommon ; Remaining RST handling is common
+
+;**************************************************************************
+; Common Interrupt handler
+;**************************************************************************
+
+_up_rstcommon:
+ ; Create a register frame. SP points to top of frame + 4, pushes
+ ; decrement the stack pointer. Already have
+ ;
+ ; Offset 8: Return PC is already on the stack
+ ; Offset 7: AF (retaining flags)
+ ;
+ ; IRQ number is in A
+
+ push hl ; Offset 6: HL
+ ld hl, #(3*2) ; HL is the value of the stack pointer before
+ add hl, sp ; the interrupt occurred
+ push hl ; Offset 5: Stack pointer
+ push iy ; Offset 4: IY
+ push ix ; Offset 3: IX
+ push de ; Offset 2: DE
+ push bc ; Offset 1: BC
+
+ ld b, a ; Save the reset number in B
+ ld a, i ; Parity bit holds interrupt state
+ push af ; Offset 0: I with interrupt state in parity
+ di
+
+ ; Call the interrupt decode logic. SP points to the beggining of the reg structure
+
+ ld hl, #0 ; Argument #2 is the beginning of the reg structure
+ add hl, sp ;
+ push hl ; Place argument #2 at the top of stack
+ push bc ; Argument #1 is the Reset number
+ inc sp ; (make byte sized)
+ call _up_doirq ; Decode the IRQ
+
+ ; On return, HL points to the beginning of the reg structure to restore
+ ; Note that (1) the arguments pushed on the stack are not popped, and (2) the
+ ; original stack pointer is lost. In the normal case (no context switch),
+ ; HL will contain the value of the SP before the arguments wer pushed.
+
+ ld sp, hl ; Use the new stack pointer
+
+ ; Restore registers. HL points to the beginning of the reg structure to restore
+
+ ex af, af' ; Select alternate AF
+ pop af ; Offset 0: AF' = I with interrupt state in parity
+ ex af, af' ; Restore original AF
+ pop bc ; Offset 1: BC
+ pop de ; Offset 2: DE
+ pop ix ; Offset 3: IX
+ pop iy ; Offset 4: IY
+ exx ; Use alternate BC/DE/HL
+ ld hl, #-2 ; Offset of SP to account for ret addr on stack
+ pop de ; Offset 5: HL' = Stack pointer after return
+ add hl, de ; HL = Stack pointer value before return
+ exx ; Restore original BC/DE/HL
+ pop hl ; Offset 6: HL
+ pop af ; Offset 7: AF
+
+ ; Restore the stack pointer
+
+ exx ; Use alternate BC/DE/HL
+ ld sp, hl ; Set SP = saved stack pointer value before return
+ exx ; Restore original BC/DE/HL
+
+ ; Restore interrupt state
+
+ ex af, af' ; Recover interrupt state
+ jp po, nointenable ; Odd parity, IFF2=0, means disabled
+ ex af, af' ; Restore AF (before enabling interrupts)
+ ei ; yes
+ reti
+nointenable::
+ ex af, af' ; Restore AF
+ reti
+
+;**************************************************************************
+; Ordering of segments for the linker (SDCC only)
+;**************************************************************************
+
+ .area _HOME
+ .area _CODE
+ .area _GSINIT
+ .area _GSFINAL
+
+ .area _DATA
+ .area _BSS
+ .area _HEAP
+
+;**************************************************************************
+; Global data initialization logic (SDCC only)
+;**************************************************************************
+
+ .area _GSINIT
+gsinit::
+ .area _GSFINAL
+ ret
+
diff --git a/nuttx/configs/z16f2800100zcog/Kconfig b/nuttx/configs/z16f2800100zcog/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/z16f2800100zcog/README.txt b/nuttx/configs/z16f2800100zcog/README.txt
new file mode 100644
index 000000000..64f90b9b9
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/README.txt
@@ -0,0 +1,90 @@
+README.txt
+^^^^^^^^^^
+
+This is the README file for the NuttX port to the ZiLog ZNEO MCU.
+
+ZDS-II Compiler Versions
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+4.10.2
+ The ZDS-II version 4.10.2 will not compile NuttX. It reports "internal
+ errors" on some of the files. Upgrades to ZDS-II are available for
+ download from the Zilog website: http://www.zilog.com/software/zds2.asp
+
+4.11.0
+ NuttX compiles correctly with the newer 4.11.0 version of the ZDS-II
+ toolchain. However, I have found a few issues:
+
+ - The code will not run without the -reduceopt option. There is,
+ apparently, some optimization related issue. This issue has not
+ been analyzed as of this writing.
+
+ - Not all NuttX logic will not run with the -regvars option. There is
+ at least one failure that has been reported to ZiLOG as incident 81400.
+
+ - The Pascal add-on interpreter includes a large switch statement and
+ exposes another compiler problem. This is reported as incident 81459.
+
+4.11.1
+ As of this writing (30 September 2010), the latest release of ZDS-II for the
+ ZNEO is 4.11.1. It is unknown if this release includes fixes for incidents
+ 81400 and 81459 or not. It is unknown if the code will run without -reduceopt
+ either. (Basically, it compiles with 4.11.1, but is untested with that version).
+
+If you use any version of ZDS-II other than 4.11.1 or if you install ZDS-II
+at any location other than the default location, you will have to modify
+two files: (1) configs/z16f2800100zcog/*/setenv.sh and (2)
+configs/z16f2800100zcog/*/Make.defs. Simply edit these two files, changing
+4.11.1 to whatever.
+
+Issues
+^^^^^^
+
+There are several, important open issues with the ZNEO port (8 as of this writing).
+See the TODO file in the top-level NuttX directory. One of these should be
+mentioned here because it causes a failure to compile Nuttx:
+
+ Description: The file drivers/mmcsd/mmcsd_sdio.c generates an internal compiler
+ error like:
+
+ mmcsd\mmcsd_sdio.c
+ Internal Error(0503) On line 2524 of "MMCSD\MMCSD_SDIO.C"
+ File <c3>, Args(562,46)
+
+ Status: Open. Recommended workaround: remove mmcsd_sdio.c from
+ drivers/mmcsd/Make.defs. There is no SDIO support for the Z16 anyway
+ Priority: Low
+
+This is bug in ZDS-II. It was discovered in version 4.11.0 and still exists
+in version 4.11.1.
+
+Configuration Subdirectories
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- source/ and include/
+ These directories contain common logic for all z16f2800100zcog
+ configurations.
+
+Variations on the basic z8f162800100zcog configuration are maintained
+in subdirectories. To configure any specific configuration, do the
+following steps:
+
+ cd <nuttx-top-directory>/tools
+ ./configure.sh z16f2800100zcog/<sub-directory>
+ cd <nuttx-top-directory>
+ make
+
+Where <sub-directory> is the specific board configuration that you
+wish to build. The following board-specific configurations are
+available:
+
+- ostest
+ This builds the examples/ostest application for execution from FLASH.
+ See examples/README.txt for information about ostest.
+
+- pashello
+
+ Configures to use examples/pashello for execution from FLASH
+ See examples/README.txt for information about pashello.
+
+Check out any README.txt files in these <sub-directory>s.
diff --git a/nuttx/configs/z16f2800100zcog/include/board.h b/nuttx/configs/z16f2800100zcog/include/board.h
new file mode 100644
index 000000000..e9b37d85d
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/include/board.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+ * board/board.h
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* LED pattern definitions
+ *
+ * The z16f2800100zcog board has four LEDs:
+ *
+ * - Green LED D1 which illuminates in the presence of Vcc
+ * - Red LED D2 connected to chip port PA0_T0IN
+ * - Yellow LED D3 connected to chip port PA1_T0OUT
+ * - Green LED D4 connected to chip port PA2_DE0
+ */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_IDLE 4
+#define LED_INIRQ 5
+#define LED_SIGNAL 6
+#define LED_ASSERTION 7
+#define LED_PANIC 8
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/z16f2800100zcog/ostest/Make.defs b/nuttx/configs/z16f2800100zcog/ostest/Make.defs
new file mode 100644
index 000000000..8440224ca
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/z16f2800100zcog/ostest/Make.defs
+#
+# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZNeo-II toolchain is installed
+
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_ZNEO_4.11.1
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZNeo-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug
+else
+ ARCHASMOPTIMIZATION = -nodebug
+endif
+
+ARCHASMCPUFLAGS = -cpu:Z16F2811AL -NOigcase
+ARCHASMLIST = -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:_Z16F2811AL=1 -define:_Z16K_SERIES=1 -define:_Z16F_SERIES=1 \ -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -NOregvar -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -regvar
+endif
+
+ARCHCPUFLAGS = -chartype:S -model:L -NOmodsect -cpu:Z16F2811AL -NOgenprint \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -NOkeepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:_Z16F2811AL -define:_Z16K_SERIES \
+ -define:_Z16F_SERIES
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D_Z16F2811AL -D_Z16K_SERIES -D_Z16F_SERIES -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/z16f2800100zcog/ostest/ostest.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/zneocc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/zneolink.exe
+AS = $(ZDSBINDIR)/zneoasm.exe
+AR = $(ZDSBINDIR)/zneolib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZNeo-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z16f2800100zcog/ostest/README.txt b/nuttx/configs/z16f2800100zcog/ostest/README.txt
new file mode 100644
index 000000000..214c3a9f1
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/README.txt
@@ -0,0 +1,12 @@
+README.txt
+^^^^^^^^^^
+
+ostest.zfpproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger. Before using, copy the following
+ files from the toplevel directory:
+
+ nuttx.hex, nuttx.map, nuttx.lod
+
+ to this directory as:
+
+ ostest.hex, ostest.map, ostest.lod
diff --git a/nuttx/configs/z16f2800100zcog/ostest/appconfig b/nuttx/configs/z16f2800100zcog/ostest/appconfig
new file mode 100644
index 000000000..a0f5d2462
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/z16f2800100zcog/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/z16f2800100zcog/ostest/defconfig b/nuttx/configs/z16f2800100zcog/ostest/defconfig
new file mode 100644
index 000000000..24cca2a6a
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/defconfig
@@ -0,0 +1,218 @@
+############################################################################
+# configs/z16f2800100zcog/ostest/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z16"
+CONFIG_ARCH_Z16=y
+CONFIG_ARCH_CHIP="z16f"
+CONFIG_ARCH_CHIP_Z16F=y
+CONFIG_ARCH_CHIP_Z16F2810=n
+CONFIG_ARCH_CHIP_Z16F2811=y
+CONFIG_ARCH_CHIP_Z16F3211=n
+CONFIG_ARCH_CHIP_Z16F6411=n
+CONFIG_ARCH_BOARD="z16f2800100zcog"
+CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+#
+# Z16F specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=1
+CONFIG_START_DAY=28
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z16f2800100zcog/ostest/ostest.linkcmd b/nuttx/configs/z16f2800100zcog/ostest/ostest.linkcmd
new file mode 100755
index 000000000..17539ad57
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/ostest.linkcmd
@@ -0,0 +1,92 @@
+/****************************************************************************/
+/* configs/z16f2800100zcog/ostest/ostest.linkcmd */
+/* */
+/* Copyright (C) 2008 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -sort NAME=ascending -unresolved=fatal
+-warnoverlap -NOxref -warn -debug -NOigcase
+
+RANGE ROM $000000 : $007FFF
+RANGE RAM $FFB000 : $FFBFFF
+RANGE IODATA $FFC000 : $FFFFFF
+RANGE EROM $008000 : $01FFFF
+RANGE ERAM $800000 : $87FFFF
+
+CHANGE NEAR_TEXT=NEAR_DATA
+CHANGE FAR_TEXT=FAR_DATA
+
+ORDER FAR_BSS, FAR_DATA
+ORDER NEAR_BSS, NEAR_DATA
+COPY NEAR_DATA EROM
+COPY FAR_DATA EROM
+
+define _0_exit = 0
+define _low_near_romdata = copy base of NEAR_DATA
+define _low_neardata = base of NEAR_DATA
+define _len_neardata = length of NEAR_DATA
+define _low_far_romdata = copy base of FAR_DATA
+define _low_fardata = base of FAR_DATA
+define _len_fardata = length of FAR_DATA
+define _low_nearbss = base of NEAR_BSS
+define _len_nearbss = length of NEAR_BSS
+define _low_farbss = base of FAR_BSS
+define _len_farbss = length of FAR_BSS
+define _near_heaptop = highaddr of RAM
+define _far_heaptop = highaddr of ERAM
+define _far_stack = highaddr of ERAM
+define _near_stack = highaddr of RAM
+define _near_heapbot = top of RAM
+define _far_heapbot = top of ERAM
+
+define _SYS_CLK_SRC = 2
+define _SYS_CLK_FREQ = 20000000
+
+define __EXTCT_INIT_PARAM = $80
+define __EXTCS0_INIT_PARAM = $8012
+define __EXTCS1_INIT_PARAM = $8001
+define __EXTCS2_INIT_PARAM = $0000
+define __EXTCS3_INIT_PARAM = $0000
+define __EXTCS4_INIT_PARAM = $0000
+define __EXTCS5_INIT_PARAM = $0000
+
+define __PFAF_INIT_PARAM = $ff
+define __PGAF_INIT_PARAM = $ff
+define __PDAF_INIT_PARAM = $ff00
+define __PAAF_INIT_PARAM = $0000
+define __PCAF_INIT_PARAM = $0000
+define __PHAF_INIT_PARAM = $0300
+define __PKAF_INIT_PARAM = $0f
+
+/* arch/z16/src/Makefile will append target, object and library paths below */
+
diff --git a/nuttx/configs/z16f2800100zcog/ostest/ostest.zfpproj b/nuttx/configs/z16f2800100zcog/ostest/ostest.zfpproj
new file mode 100644
index 000000000..ade3d73d4
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/ostest.zfpproj
@@ -0,0 +1,238 @@
+<project type="Standard" project-type="Standard" configuration="Debug" created-by="{{build_number}}" modified-by="c:4.11:07031901">
+<cpu>Z16F2811AL</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="chartype" type="string" change-action="compile">U</option>
+<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">S</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="regvar" type="boolean" change-action="compile">true</option>
+<option name="regvarcache" type="boolean" change-action="none">false</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">Z16F2800100ZCOG</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">true</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000001</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+<option name="autoselect" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build"></option>
+<option name="warn" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="eram" type="string" change-action="build">0-0</option>
+<option name="erom" type="string" change-action="build">0-0</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="iodata" type="string" change-action="build">0-0</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\ostest</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">000000-007FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="startuptype" type="string" change-action="build">1</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">false</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="chartype" type="string" change-action="compile">U</option>
+<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">S</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="regvar" type="boolean" change-action="compile">true</option>
+<option name="regvarcache" type="boolean" change-action="none">false</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild"></option>
+<option name="debugtool" type="string" change-action="none">ZPAKII</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">1</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+<option name="autoselect" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build"></option>
+<option name="warn" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="eram" type="string" change-action="build">0-0</option>
+<option name="erom" type="string" change-action="build">0-0</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="iodata" type="string" change-action="build">0-0</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\ostest</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">000000-007FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="startuptype" type="string" change-action="build">1</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">false</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+<watch-element expression="0x801d1a" />
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project> \ No newline at end of file
diff --git a/nuttx/configs/z16f2800100zcog/ostest/setenv.sh b/nuttx/configs/z16f2800100zcog/ostest/setenv.sh
new file mode 100755
index 000000000..bddcad2b5
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/setenv.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# configs/z16f2800100zcog/ostest/setenv.sh
+#
+# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.11.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_ZNEO_4.11.1/bin"
+alias zneoasm="${ZDSBINDIR}/zneoasm.exe"
+alias zneocc="${ZDSBINDIR}/zneocc.exe"
+alias zneolib="${ZDSBINDIR}/zneolib.exe"
+alias zneolink="${ZDSBINDIR}/zneolink.exe"
diff --git a/nuttx/configs/z16f2800100zcog/ostest/test-result.txt b/nuttx/configs/z16f2800100zcog/ostest/test-result.txt
new file mode 100644
index 000000000..ebf178439
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/ostest/test-result.txt
@@ -0,0 +1,529 @@
+This is the output from the z16f target from January 31, 2008
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+While all tests pass per this output, my impression is that some
+of the timed delays in during execution of the test were not
+correct and I suspect some system timing issues.
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: putenv(Variable1=BadValue3)
+user_start: setenv(Variable1, GoodValue1, TRUE)
+user_start: setenv(Variable2, BadValue1, FALSE)
+user_start: setenv(Variable2, GoodValue2, TRUE)
+user_start: setenv(Variable3, Variable3, FALSE)
+user_start: setenv(Variable3, Variable3, FALSE)
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+user_start: Started user_main at PID=2
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 2
+mxordblk 76b20 76b20
+uordblks 33d0 33d0
+fordblks 78180 78180
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 3
+mxordblk 76b20 76b20
+uordblks 33d0 33c0
+fordblks 78180 78190
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has no value
+show_variable: Variable=Variable3 has no value
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 33c0 3380
+fordblks 78190 781d0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning ntcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+errors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=804b10
+Resuming
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 4
+mxordblk 76b20 76b20
+uordblks 3380 35c0
+fordblks 781d0 77f90
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b23
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b36
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b49
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf76
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b5c
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf66
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b6f
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve1 finished
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 3 started
+barrier_test: Thread 3 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 4 started
+barrier_test: Thread 4 created
+barrier_func: Thread 3 calling pthread_barrier_wait()
+barrier_func: Thread 4 calling pthread_barrier_wait()
+barrier_func: Thread 5 started
+barrier_test: Thread 5 created
+barrier_func: Thread 6 started
+barrier_test: Thread 6 created
+barrier_func: Thread 7 started
+barrier_test: Thread 7 created
+barrier_func: Thread 5 calling pthread_barrier_wait()
+barrier_func: Thread 6 calling pthread_barrier_wait()
+barrier_func: Thread 7 calling pthread_barrier_wait()
+barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2, back with status=0 (I am not special)
+barrier_func: Thread 3, back with status=0 (I am not special)
+barrier_func: Thread 4, back with status=0 (I am not special)
+barrier_func: Thread 5, back with status=0 (I am not special)
+barrier_func: Thread 6, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 7 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_func: Thread 6 done
+barrier_func: Thread 3 done
+barrier_func: Thread 4 done
+barrier_func: Thread 5 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+barrier_test: Thread 3 completed with result=0
+barrier_test: Thread 4 completed with result=0
+barrier_test: Thread 5 completed with result=0
+barrier_test: Thread 6 completed with result=0
+barrier_test: Thread 7 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 4
+mxordblk 76b20 76b20
+uordblks 33d0 35c0
+fordblks 78180 77f90
+user_main: Exitting
+
diff --git a/nuttx/configs/z16f2800100zcog/pashello/Make.defs b/nuttx/configs/z16f2800100zcog/pashello/Make.defs
new file mode 100644
index 000000000..1c3e277ad
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/Make.defs
@@ -0,0 +1,172 @@
+############################################################################
+# configs/z16f2800100zcog/pashello/Make.defs
+#
+# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZNeo-II toolchain is installed
+
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_ZNEO_4.11.1
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZNeo-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug
+else
+ ARCHASMOPTIMIZATION = -nodebug
+endif
+
+ARCHASMCPUFLAGS = -cpu:Z16F2811AL -NOigcase
+ARCHASMLIST = -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:_Z16F2811AL=1 -define:_Z16K_SERIES=1 -define:_Z16F_SERIES=1 \ -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -NOregvar -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -regvar
+endif
+
+ARCHCPUFLAGS = -chartype:S -model:L -NOmodsect -cpu:Z16F2811AL -NOgenprint \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -NOkeepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:_Z16F2811AL -define:_Z16K_SERIES \
+ -define:_Z16F_SERIES
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D_Z16F2811AL -D_Z16K_SERIES -D_Z16F_SERIES -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/z16f2800100zcog/pashello/pashello.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/zneocc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/zneolink.exe
+AS = $(ZDSBINDIR)/zneoasm.exe
+AR = $(ZDSBINDIR)/zneolib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZNeo-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z16f2800100zcog/pashello/README.txt b/nuttx/configs/z16f2800100zcog/pashello/README.txt
new file mode 100644
index 000000000..bc9828184
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/README.txt
@@ -0,0 +1,12 @@
+README.txt
+^^^^^^^^^^
+
+pashello.zfpproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger. Before using, copy the following
+ files from the toplevel directory:
+
+ nuttx.hex, nuttx.map, nuttx.lod
+
+ to this directory as:
+
+ pashello.hex, pashello.map, pashello.lod
diff --git a/nuttx/configs/z16f2800100zcog/pashello/appconfig b/nuttx/configs/z16f2800100zcog/pashello/appconfig
new file mode 100644
index 000000000..d35185f5f
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/appconfig
@@ -0,0 +1,42 @@
+############################################################################
+# configs/z16f2800100zcog/pashello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/pashello
+
+# Path to the Pascal p-code runtime interpreter module
+
+CONFIGURED_APPS += interpreters/pcode
diff --git a/nuttx/configs/z16f2800100zcog/pashello/defconfig b/nuttx/configs/z16f2800100zcog/pashello/defconfig
new file mode 100644
index 000000000..daf98c7d6
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/defconfig
@@ -0,0 +1,218 @@
+############################################################################
+# configs/z16f2800100zcog/pashello/defconfig
+#
+# Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z16"
+CONFIG_ARCH_Z16=y
+CONFIG_ARCH_CHIP="z16f"
+CONFIG_ARCH_CHIP_Z16F=y
+CONFIG_ARCH_CHIP_Z16F2810=n
+CONFIG_ARCH_CHIP_Z16F2811=y
+CONFIG_ARCH_CHIP_Z16F3211=n
+CONFIG_ARCH_CHIP_Z16F6411=n
+CONFIG_ARCH_BOARD="z16f2800100zcog"
+CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y
+CONFIG_ARCH_NOINTC=n
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=y
+#
+# Z16F specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="pashello_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=1
+CONFIG_START_DAY=28
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=n
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=n
+CONFIG_DISABLE_MOUNTPOINT=n
+CONFIG_DISABLE_ENVIRON=n
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=16
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=4
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=256
+CONFIG_NUNGET_CHARS=2
+CONFIG_PREALLOC_MQ_MSGS=4
+CONFIG_MQ_MAXMSGSIZE=32
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=4
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=4096
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z16f2800100zcog/pashello/pashello.linkcmd b/nuttx/configs/z16f2800100zcog/pashello/pashello.linkcmd
new file mode 100755
index 000000000..f519219fb
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/pashello.linkcmd
@@ -0,0 +1,92 @@
+/****************************************************************************/
+/* configs/z16f2800100zcog/pashello/pashello.linkcmd */
+/* */
+/* Copyright (C) 2008 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -sort NAME=ascending -unresolved=fatal
+-warnoverlap -NOxref -warn -debug -NOigcase
+
+RANGE ROM $000000 : $007FFF
+RANGE RAM $FFB000 : $FFBFFF
+RANGE IODATA $FFC000 : $FFFFFF
+RANGE EROM $008000 : $01FFFF
+RANGE ERAM $800000 : $87FFFF
+
+CHANGE NEAR_TEXT=NEAR_DATA
+CHANGE FAR_TEXT=FAR_DATA
+
+ORDER FAR_BSS, FAR_DATA
+ORDER NEAR_BSS, NEAR_DATA
+COPY NEAR_DATA EROM
+COPY FAR_DATA EROM
+
+define _0_exit = 0
+define _low_near_romdata = copy base of NEAR_DATA
+define _low_neardata = base of NEAR_DATA
+define _len_neardata = length of NEAR_DATA
+define _low_far_romdata = copy base of FAR_DATA
+define _low_fardata = base of FAR_DATA
+define _len_fardata = length of FAR_DATA
+define _low_nearbss = base of NEAR_BSS
+define _len_nearbss = length of NEAR_BSS
+define _low_farbss = base of FAR_BSS
+define _len_farbss = length of FAR_BSS
+define _near_heaptop = highaddr of RAM
+define _far_heaptop = highaddr of ERAM
+define _far_stack = highaddr of ERAM
+define _near_stack = highaddr of RAM
+define _near_heapbot = top of RAM
+define _far_heapbot = top of ERAM
+
+define _SYS_CLK_SRC = 2
+define _SYS_CLK_FREQ = 20000000
+
+define __EXTCT_INIT_PARAM = $80
+define __EXTCS0_INIT_PARAM = $8012
+define __EXTCS1_INIT_PARAM = $8001
+define __EXTCS2_INIT_PARAM = $0000
+define __EXTCS3_INIT_PARAM = $0000
+define __EXTCS4_INIT_PARAM = $0000
+define __EXTCS5_INIT_PARAM = $0000
+
+define __PFAF_INIT_PARAM = $ff
+define __PGAF_INIT_PARAM = $ff
+define __PDAF_INIT_PARAM = $ff00
+define __PAAF_INIT_PARAM = $0000
+define __PCAF_INIT_PARAM = $0000
+define __PHAF_INIT_PARAM = $0300
+define __PKAF_INIT_PARAM = $0f
+
+/* arch/z16/src/Makefile will append target, object and library paths below */
+
diff --git a/nuttx/configs/z16f2800100zcog/pashello/pashello.zfpproj b/nuttx/configs/z16f2800100zcog/pashello/pashello.zfpproj
new file mode 100755
index 000000000..9df5cdd0f
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/pashello.zfpproj
@@ -0,0 +1,238 @@
+<project type="Standard" project-type="Standard" configuration="Debug" created-by="{{build_number}}" modified-by="c:4.11:07031901">
+<cpu>Z16F2811AL</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="chartype" type="string" change-action="compile">U</option>
+<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">S</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="regvar" type="boolean" change-action="compile">true</option>
+<option name="regvarcache" type="boolean" change-action="none">false</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">Z16F2800100ZCOG</option>
+<option name="debugtool" type="string" change-action="none">USBSmartCable</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">true</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000001</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+<option name="autoselect" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build"></option>
+<option name="warn" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="eram" type="string" change-action="build">0-0</option>
+<option name="erom" type="string" change-action="build">0-0</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="iodata" type="string" change-action="build">0-0</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\pashello</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">000000-007FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="startuptype" type="string" change-action="build">1</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">false</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z16F2811AL=1,_Z16F_SERIES=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="chartype" type="string" change-action="compile">U</option>
+<option name="define" type="string" change-action="compile">_Z16F2811AL,_Z16F_SERIES</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">false</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">S</option>
+<option name="modsect" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="regvar" type="boolean" change-action="compile">true</option>
+<option name="regvarcache" type="boolean" change-action="none">false</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild"></option>
+<option name="debugtool" type="string" change-action="none">ZPAKII</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="enableinfopage" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">1</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+<option name="autoselect" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">false</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build"></option>
+<option name="warn" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="directives" type="string" change-action="build"></option>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="eram" type="string" change-action="build">0-0</option>
+<option name="erom" type="string" change-action="build">0-0</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="iodata" type="string" change-action="build">0-0</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\pashello</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="ram" type="string" change-action="build">FFB000-FFBFFF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">000000-007FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="startuptype" type="string" change-action="build">1</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnoverlap" type="boolean" change-action="none">false</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+<watch-element expression="0x801d1a" />
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+</project>
diff --git a/nuttx/configs/z16f2800100zcog/pashello/setenv.sh b/nuttx/configs/z16f2800100zcog/pashello/setenv.sh
new file mode 100755
index 000000000..f957b23cb
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/pashello/setenv.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# z16f2800100zcog/setenv.sh
+#
+# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.11.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_ZNEO_4.11.1/bin"
+alias zneoasm="${ZDSBINDIR}/zneoasm.exe"
+alias zneocc="${ZDSBINDIR}/zneocc.exe"
+alias zneolib="${ZDSBINDIR}/zneolib.exe"
+alias zneolink="${ZDSBINDIR}/zneolink.exe"
diff --git a/nuttx/configs/z16f2800100zcog/src/Makefile b/nuttx/configs/z16f2800100zcog/src/Makefile
new file mode 100644
index 000000000..b8eedadd4
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/src/Makefile
@@ -0,0 +1,84 @@
+############################################################################
+# configs/z16f2800100zcog/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
+USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
+INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) $(EXTRADEFINES)
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = z16f_lowinit.c z16f_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+
+all: libboard$(LIBEXT)
+
+$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
+ @$(CPP) $(CPPFLAGS) $< -o $@.tmp
+ @cat $@.tmp | sed -e "s/^#/;/g" > $@
+ @rm $@.tmp
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/z16f2800100zcog/src/z16f_leds.c b/nuttx/configs/z16f2800100zcog/src/z16f_leds.c
new file mode 100644
index 000000000..dfcf96fec
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/src/z16f_leds.c
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * configs/z16f2800100zcog/z16f_leds.c
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The z16f2800100zcog board has four LEDs:
+ *
+ * - Green LED D1 which illuminates in the presence of Vcc
+ * - Red LED D2 connected to chip port PA0_T0IN
+ * - Yellow LED D3 connected to chip port PA1_T0OUT
+ * - Green LED D4 connected to chip port PA2_DE0
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/board/board.h>
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ /* The following is performed up_lowinit() as well */
+
+ putreg8(getreg8(Z16F_GPIOA_OUT) | 0x07, Z16F_GPIOA_OUT);
+ putreg8(getreg8(Z16F_GPIOA_DD) & 0xF8, Z16F_GPIOA_DD);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ if ((unsigned)led <= 7)
+ {
+ putreg8(((getreg8(Z16F_GPIOA_OUT) & 0xf8) | led), Z16F_GPIOA_OUT);
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ if (led >= 1)
+ {
+ up_ledon(led-1);
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c b/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c
new file mode 100644
index 000000000..2eb7d701b
--- /dev/null
+++ b/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c
@@ -0,0 +1,90 @@
+/***************************************************************************
+ * configs/z16f2800100zcog/src/z16f_lowinit.c
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Based upon sample code included with the Zilog ZDS-II toolchain.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ * Included Files
+ ***************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip/chip.h"
+
+/***************************************************************************
+ * Definitions
+ ***************************************************************************/
+
+/***************************************************************************
+ * Private Functions
+ ***************************************************************************/
+
+static void z16f_gpioinit(void)
+{
+ /* Configure LEDs and Run/Stop switch port */
+
+ putreg8(getreg8(Z16F_GPIOA_DD) | 0x87, Z16F_GPIOA_DD);
+ putreg8(getreg8(Z16F_GPIOA_OUT) | 0x07, Z16F_GPIOA_OUT);
+ putreg8(getreg8(Z16F_GPIOA_DD) & 0xF8, Z16F_GPIOA_DD);
+
+ /* Configure rate switch port */
+
+ putreg8(getreg8(Z16F_GPIOB_DD) | 0x20, Z16F_GPIOB_DD);
+ putreg8(getreg8(Z16F_GPIOB_AFL) | 0x20, Z16F_GPIOB_AFL);
+
+#if 0 /* Not yet */
+ putreg8(0x05, Z16F_ADC0_MAX);
+ putreg8(0xf5, Z16F_ADC0_CTL);
+#endif
+
+ /* Configure Direction switch port */
+
+ putreg8(getreg8(Z16F_GPIOC_DD) | 0x01, Z16F_GPIOC_DD);
+
+ /* Configure to use both UART0 and 1 */
+
+ putreg8(getreg8(Z16F_GPIOA_AFL) | 0x30, Z16F_GPIOA_AFL);
+ putreg8(getreg8(Z16F_GPIOD_AFL) | 0x30, Z16F_GPIOD_AFL);
+}
+
+/***************************************************************************
+ * Public Functions
+ ***************************************************************************/
+
+void z16f_lowinit(void)
+{
+ z16f_gpioinit();
+}
+
diff --git a/nuttx/configs/z80sim/Kconfig b/nuttx/configs/z80sim/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/z80sim/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/z80sim/README.txt b/nuttx/configs/z80sim/README.txt
new file mode 100644
index 000000000..3edc6ad71
--- /dev/null
+++ b/nuttx/configs/z80sim/README.txt
@@ -0,0 +1,142 @@
+z80sim README
+^^^^^^^^^^^^^
+
+This port uses a primitive, emulated Z80 and the SDCC toolchain.
+The instruction set emulator can be found in the NuttX SVN at
+http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/misc/sims/z80sim
+
+The SDCC toolchain is available from http://sdcc.sourceforge.net/. All
+testing has been performed using version 2.6.0 of the SDCC toolchain.
+
+Contents
+^^^^^^^^
+
+ o Configuring NuttX
+ o Building the SDCC toolchain
+ o SDCC Update
+ o Newer SDCC Versions
+
+Configuring NuttX
+^^^^^^^^^^^^^^^^^
+
+ ostest
+ This configuration performs a simple, minimal OS test using
+ examples/ostest. This can be configurated as follows:
+
+ cd tools
+ ./configure.sh z80sim/ostest
+ cd -
+ . ./setenv.sh
+
+ nsh
+ This configuration file builds NSH (examples/nsh). This
+ configuration is not functional due to issues with use of the
+ simulated serial driver (see the TODO list).
+
+ This configuration can be selected by:
+
+ cd tools
+ ./configure.sh z80sim/nsh
+ cd -
+ . ./setenv.sh
+
+ pashello
+ Configures to use examples/pashello for execution from FLASH
+ See examples/README.txt for information about pashello.
+
+ This configuration is not usable because the resulting binary
+ is too large for the z80 address space.
+
+ This configuration can be selected by:
+
+ cd tools
+ ./configure.sh z80sim/pashello
+ cd -
+ . ./setenv.sh
+
+Building the SDCC toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The SDCC toolchain is built with the standard configure/make/make install
+sequence. However, some special actions are required to generate libraries
+compatible with this build. First start with the usual steps
+
+ download
+ unpack
+ cd sdcc
+ ./configure
+
+But before making, we need to apply a patch to the SDCC 2.6.0 source
+so that the z80 assembler can handle long symbol names
+
+ Apply sdcc-2.6.0-asz80-symlen.patch
+ cd sdcc/device/lib
+
+Then make the SDCC binaries
+
+ cd sdcc
+ make
+
+and install SDCC:
+
+ sudo make install
+
+SDCC Update
+^^^^^^^^^^^
+
+I have had some problems building sdcc-2.6.0 on my current UBUNTU
+release (9.10). I had other problems building sdcc-2.9.0 on UBUNTU 9.10.
+I suspect that the newer gcc toolchains are causing problems for these
+older SDCC releases.
+
+A 20091106 snapshot did build with no major problems on UBUNTU 9.10, but
+has some compatibilty problems with the older SDCC compiler. For one, you
+will need to change the Z80 assember name and options in the Make.defs
+files as follows:
+
+-AS = as-z80
++AS = sdasz80
+
+- @$(AS) $(ASFLAGS) $2 $1
++ $(AS) $(ASFLAGS) $1
+
+For another, I had other problems building with that 20091106 that look
+like compiler bugs. If you are using UBUNTU 9.10, you may have to either
+(1) downgrade your GCC compiler to a version 3.x compiler and use one of
+the older stable releases, or (2) wait for the next stable SDCC release
+after 2.9.0.
+
+See below: If you wish to continue using the older SDCC toolchain, you
+must now also add CONFIG_SDCC_OLD=y to your configuration file.
+
+Newer SDCC Versions
+^^^^^^^^^^^^^^^^^^^
+
+This is the text of bug 3468951 reported on the SourceForge website:
+
+"Some obsolete stuff in z80sim port," (submitted by Philipp Klaus Krause):
+
+ The simz80 port needs a few updates to work well with current sdcc versions,
+ and has some unecessary stuff:
+
+ * The linker name for Make.defs should be sdldz80
+ * The assembler name for Make.defs should be sdasz80
+ * _asm and _endasm in z80_io.c and z80_irq.c should be replaced by __asm
+ and __endasm
+ * The --stack-auto --int-long-reent --float-reent options or Make.defs should
+ be removed, as they have no effect on sdcc's z80 port
+ * The current assembler AFAIK can handle long symbol names, so the
+ sdcc-2.6.0-asz80-symlen.patch is unnecessary, and it and the corresponding
+ section from the README can be removed.
+
+These changes *have* been incorporated but only partially verified. In order
+to get a successful compilation, I had to copy stdarg.h out of the SDCC source
+(at sdcc/device/include/stdarg.h) to include/nuttx/stdarg.h.
+
+There are also some library related issues when you get to the final build
+that I have not looked into yet.
+
+If you want to back out these change and continue to use the older toolchain
+in your build, simpy define the following in your configuration file:
+
+ CONFIG_SDCC_OLD=y
diff --git a/nuttx/configs/z80sim/include/README.txt b/nuttx/configs/z80sim/include/README.txt
new file mode 100644
index 000000000..4af1b2ad2
--- /dev/null
+++ b/nuttx/configs/z80sim/include/README.txt
@@ -0,0 +1 @@
+This directory contains header files unique to the z80 simulation
diff --git a/nuttx/configs/z80sim/include/board.h b/nuttx/configs/z80sim/include/board.h
new file mode 100644
index 000000000..f581242cb
--- /dev/null
+++ b/nuttx/configs/z80sim/include/board.h
@@ -0,0 +1,66 @@
+/************************************************************
+ * configs/z80sim/include/board.h
+ *
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************
+ * Included Files
+ ************************************************************/
+
+/************************************************************
+ * Definitions
+ ************************************************************/
+
+/************************************************************
+ * Public Functions
+ ************************************************************/
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+EXTERN void z80_lowputc(char ch) __naked;
+EXTERN char z80_lowgetc(void) __naked;
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/z80sim/nsh/Make.defs b/nuttx/configs/z80sim/nsh/Make.defs
new file mode 100644
index 000000000..7bdc9663d
--- /dev/null
+++ b/nuttx/configs/z80sim/nsh/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/z80sim/nsh/Make.defs
+#
+# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+
+ifeq ($(CONFIG_SDCC_OLD),y)
+
+LD = link-z80
+AS = as-z80
+ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+
+else
+
+LD = sdldz80
+AS = sdasz80
+ARCHCPUFLAGS = -mz80
+
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+ASFLAGS = -x -a -l -o -s
+
+SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
+SDCCLIB = z80.lib
+
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .hex
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $2 $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z80sim/nsh/appconfig b/nuttx/configs/z80sim/nsh/appconfig
new file mode 100644
index 000000000..22298ecda
--- /dev/null
+++ b/nuttx/configs/z80sim/nsh/appconfig
@@ -0,0 +1,44 @@
+############################################################################
+# configs/z80sim/nsh/appconfig
+#
+# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/nsh
+
+# The NSH Library
+
+CONFIGURED_APPS += system/readline
+CONFIGURED_APPS += nshlib
+
diff --git a/nuttx/configs/z80sim/nsh/defconfig b/nuttx/configs/z80sim/nsh/defconfig
new file mode 100644
index 000000000..87195b6e8
--- /dev/null
+++ b/nuttx/configs/z80sim/nsh/defconfig
@@ -0,0 +1,216 @@
+############################################################################
+# configs/z80sim/nsh/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="z80"
+CONFIG_ARCH_CHIP_Z80=y
+CONFIG_ARCH_BOARD="z80sim"
+CONFIG_ARCH_BOARD_Z80SIM=y
+CONFIG_DRAM_SIZE=65536
+
+#
+# Z80sim specific device driver settings
+#
+CONFIG_UART_RXBUFSIZE=64
+CONFIG_UART_TXBUFSIZE=64
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=6
+CONFIG_NFILE_STREAMS=6
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+#
+CONFIG_NSH_FILEIOSIZE=1024
+CONFIG_NSH_STRERROR=n
+CONFIG_NSH_LINELEN=40
+CONFIG_NSH_NESTDEPTH=3
+CONFIG_NSH_DISABLESCRIPT=n
+CONFIG_NSH_DISABLEBG=n
+CONFIG_NSH_ROMFSETC=n
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+CONFIG_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_NSH_ROMFSDEVNO=0
+CONFIG_NSH_ROMFSSECTSIZE=64
+CONFIG_NSH_FATDEVNO=1
+CONFIG_NSH_FATSECTSIZE=512
+CONFIG_NSH_FATNSECTORS=1024
+CONFIG_NSH_FATMOUNTPT="/tmp"
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z80sim/nsh/setenv.sh b/nuttx/configs/z80sim/nsh/setenv.sh
new file mode 100755
index 000000000..48373b0f2
--- /dev/null
+++ b/nuttx/configs/z80sim/nsh/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# configs/z80sim/nsh/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/z80sim/ostest/Make.defs b/nuttx/configs/z80sim/ostest/Make.defs
new file mode 100644
index 000000000..f19ae8dd5
--- /dev/null
+++ b/nuttx/configs/z80sim/ostest/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/z80sim/ostest/Make.defs
+#
+# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+
+ifeq ($(CONFIG_SDCC_OLD),y)
+
+LD = link-z80
+AS = as-z80
+ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+
+else
+
+LD = sdldz80
+AS = sdasz80
+ARCHCPUFLAGS = -mz80
+
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+ASFLAGS = -x -a -l -o -s
+
+SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
+SDCCLIB = z80.lib
+
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .hex
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $2 $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z80sim/ostest/appconfig b/nuttx/configs/z80sim/ostest/appconfig
new file mode 100644
index 000000000..59f1211b1
--- /dev/null
+++ b/nuttx/configs/z80sim/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/z80sim/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/z80sim/ostest/defconfig b/nuttx/configs/z80sim/ostest/defconfig
new file mode 100644
index 000000000..4fbca2e16
--- /dev/null
+++ b/nuttx/configs/z80sim/ostest/defconfig
@@ -0,0 +1,201 @@
+############################################################################
+# configs/z80sim/ostest/defconfig
+#
+# Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="z80"
+CONFIG_ARCH_CHIP_Z80=y
+CONFIG_ARCH_BOARD="z80sim"
+CONFIG_ARCH_BOARD_Z80SIM=y
+CONFIG_DRAM_SIZE=65536
+
+#
+# Z80sim specific device driver settings
+#
+CONFIG_UART_RXBUFSIZE=0
+CONFIG_UART_TXBUFSIZE=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=n
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve system performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z80sim/ostest/setenv.sh b/nuttx/configs/z80sim/ostest/setenv.sh
new file mode 100755
index 000000000..239e35286
--- /dev/null
+++ b/nuttx/configs/z80sim/ostest/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# configs/z80sim/ostest/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/z80sim/pashello/Make.defs b/nuttx/configs/z80sim/pashello/Make.defs
new file mode 100644
index 000000000..0617b8d8a
--- /dev/null
+++ b/nuttx/configs/z80sim/pashello/Make.defs
@@ -0,0 +1,111 @@
+############################################################################
+# configs/z80sim/pashello/Make.defs
+#
+# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+AR = sdcclib -a
+
+ifeq ($(CONFIG_SDCC_OLD),y)
+
+LD = link-z80
+AS = as-z80
+ARCHCPUFLAGS = -mz80 --stack-auto --int-long-reent --float-reent
+
+else
+
+LD = sdldz80
+AS = sdasz80
+ARCHCPUFLAGS = -mz80
+
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+ASFLAGS = -x -a -l -o -s
+
+SDCCLIBDIR = /usr/local/share/sdcc/lib/z80
+SDCCLIB = z80.lib
+
+ASMEXT = .asm
+OBJEXT = .o
+LIBEXT = .lib
+EXEEXT = .hex
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(ASFLAGS) $2 $1
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z80sim/pashello/appconfig b/nuttx/configs/z80sim/pashello/appconfig
new file mode 100644
index 000000000..38d7b91f8
--- /dev/null
+++ b/nuttx/configs/z80sim/pashello/appconfig
@@ -0,0 +1,43 @@
+############################################################################
+# configs/z80sim/pashello/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/pashello
+
+# Path to the Pascal p-code runtime interpreter module
+
+CONFIGURED_APPS += interpreters/pcode
+
diff --git a/nuttx/configs/z80sim/pashello/defconfig b/nuttx/configs/z80sim/pashello/defconfig
new file mode 100644
index 000000000..1c50f71ff
--- /dev/null
+++ b/nuttx/configs/z80sim/pashello/defconfig
@@ -0,0 +1,201 @@
+############################################################################
+# configs/z80sim/pashello/defconfig
+#
+# Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z80=y
+CONFIG_ARCH_CHIP="z80"
+CONFIG_ARCH_CHIP_Z80=y
+CONFIG_ARCH_BOARD="z80sim"
+CONFIG_ARCH_BOARD_Z80SIM=y
+CONFIG_DRAM_SIZE=65536
+
+#
+# Z80sim specific device driver settings
+#
+CONFIG_UART_RXBUFSIZE=0
+CONFIG_UART_TXBUFSIZE=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="pashello_main"
+CONFIG_DEBUG=n
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=4
+CONFIG_NFILE_STREAMS=4
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/nsh
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z80sim/pashello/setenv.sh b/nuttx/configs/z80sim/pashello/setenv.sh
new file mode 100755
index 000000000..b9de2b9e0
--- /dev/null
+++ b/nuttx/configs/z80sim/pashello/setenv.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# configs/z80sim/pashello/setenv.sh
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+export SDCC_BIN=/usr/local/bin
+export PATH=${SDCC_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch b/nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch
new file mode 100644
index 000000000..d91c18d98
--- /dev/null
+++ b/nuttx/configs/z80sim/sdcc-2.6.0-asz80-symlen.patch
@@ -0,0 +1,11 @@
+--- sdcc/as/z80/asm.h 2007-12-30 16:49:53.000000000 -0600
++++ sdcc.orig/as/z80/asm.h 2007-12-30 16:49:14.000000000 -0600
+@@ -65,7 +65,7 @@
+ #define RTTERM ')' /* Right expression delimeter */
+
+ #ifdef SDK
+-#define NCPS 80 /* characters per symbol */
++#define NCPS 32 /* characters per symbol */
+ #else /* SDK */
+ #define NCPS 8 /* Chars. per symbol */
+ #endif /* SDK */
diff --git a/nuttx/configs/z80sim/src/Makefile b/nuttx/configs/z80sim/src/Makefile
new file mode 100644
index 000000000..0511d00fe
--- /dev/null
+++ b/nuttx/configs/z80sim/src/Makefile
@@ -0,0 +1,76 @@
+############################################################################
+# configs/z80sim/src/Makefile
+#
+# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/arch/z80/src/common -I$(TOPDIR)/arch/z80/src/z80
+
+ASRCS =
+AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
+CSRCS = z80_irq.c z80_serial.c z80_timerisr.c z80_lowputc.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/z80sim/src/README.txt b/nuttx/configs/z80sim/src/README.txt
new file mode 100644
index 000000000..13c1e3e58
--- /dev/null
+++ b/nuttx/configs/z80sim/src/README.txt
@@ -0,0 +1 @@
+This directory contains drivers unique to the z80 simulation
diff --git a/nuttx/configs/z80sim/src/z80_irq.c b/nuttx/configs/z80sim/src/z80_irq.c
new file mode 100644
index 000000000..eb1901d27
--- /dev/null
+++ b/nuttx/configs/z80sim/src/z80_irq.c
@@ -0,0 +1,116 @@
+/****************************************************************************
+ * configs/z80sim/src/z80_irq.c
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+
+#include "up_arch.h"
+#include "os_internal.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_irqinitialize
+ ****************************************************************************/
+
+void up_irqinitialize(void)
+{
+ /* Attach the timer interrupt -- There is not special timer interrupt
+ * enable in the simulation so it must be enabled here before interrupts
+ * are enabled.
+ *
+ * NOTE: Normally, there are seperate enables for "global" interrupts
+ * and specific device interrupts. In such a "normal" case, the timer
+ * interrupt should be attached and enabled in the function up_timerinit()
+ */
+
+ irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)up_timerisr);
+
+ /* And finally, enable interrupts (including the timer) */
+
+#ifndef CONFIG_SUPPRESS_INTERRUPTS
+ irqrestore(Z80_C_FLAG);
+#endif
+}
+
+/****************************************************************************
+ * Name: up_disable_irq
+ *
+ * Description:
+ * Disable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_disable_irq(int irq)
+{
+ irqrestore(0);
+}
+
+/****************************************************************************
+ * Name: up_enable_irq
+ *
+ * Description:
+ * Enable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_enable_irq(int irq)
+{
+ irqrestore(true);
+}
diff --git a/nuttx/configs/z80sim/src/z80_lowputc.c b/nuttx/configs/z80sim/src/z80_lowputc.c
new file mode 100644
index 000000000..e23caeb0f
--- /dev/null
+++ b/nuttx/configs/z80sim/src/z80_lowputc.c
@@ -0,0 +1,103 @@
+/********************************************************************************
+ * configs/z80sim/src//z80_lowputc.c
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************/
+
+/********************************************************************************
+ * Included Files
+ ********************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <assert.h>
+#include <debug.h>
+
+#include "os_internal.h"
+#include "up_internal.h"
+
+/********************************************************************************
+ * Definitions
+ ********************************************************************************/
+
+/********************************************************************************
+ * Public Data
+ ********************************************************************************/
+
+/********************************************************************************
+ * Private Data
+ ********************************************************************************/
+
+/********************************************************************************
+ * Private Functions
+ ********************************************************************************/
+
+/********************************************************************************
+ * Public Functions
+ ********************************************************************************/
+
+/********************************************************************************
+ * Name: z80_lowputc
+ *
+ * Data sent to port 0xbe are echoed on stdout by the simulation
+ *
+ ********************************************************************************/
+
+void z80_lowputc(char ch) __naked
+{
+ _asm
+ ld hl, #2
+ add hl, sp
+ ld a, (hl)
+ out (0xbe), a
+ ret
+ _endasm;
+}
+
+/********************************************************************************
+ * Name: z80_lowgetc
+ *
+ * Data from stdin can be received on port 0xbe in the simulation
+ *
+ ********************************************************************************/
+
+char z80_lowgetc(void) __naked
+{
+ _asm
+ in a, (0xbe)
+ ld l, a
+ ld h, #0
+ ret
+ _endasm;
+}
diff --git a/nuttx/configs/z80sim/src/z80_serial.c b/nuttx/configs/z80sim/src/z80_serial.c
new file mode 100644
index 000000000..1e5d98b29
--- /dev/null
+++ b/nuttx/configs/z80sim/src/z80_serial.c
@@ -0,0 +1,361 @@
+/****************************************************************************
+ * configs/z80sim/src/z80_serial.c
+ *
+ * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/serial/serial.h>
+#include <arch/serial.h>
+
+#include "up_arch.h"
+#include "os_internal.h"
+#include "up_internal.h"
+
+#ifdef USE_SERIALDRIVER
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int up_setup(struct uart_dev_s *dev);
+static void up_shutdown(struct uart_dev_s *dev);
+static int up_attach(struct uart_dev_s *dev);
+static void up_detach(struct uart_dev_s *dev);
+static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
+static int up_receive(struct uart_dev_s *dev, uint32_t *status);
+static void up_rxint(struct uart_dev_s *dev, bool enable);
+static bool up_rxavailable(struct uart_dev_s *dev);
+static void up_send(struct uart_dev_s *dev, int ch);
+static void up_txint(struct uart_dev_s *dev, bool enable);
+static bool up_txready(struct uart_dev_s *dev);
+static bool up_txempty(struct uart_dev_s *dev);
+
+/****************************************************************************
+ * Private Variables
+ ****************************************************************************/
+
+struct uart_ops_s g_uart_ops =
+{
+ up_setup, /* setup */
+ up_shutdown, /* shutdown */
+ up_attach, /* attach */
+ up_detach, /* detach */
+ up_ioctl, /* ioctl */
+ up_receive, /* receive */
+ up_rxint, /* rxint */
+ up_rxavailable, /* rxavailable */
+ up_send, /* send */
+ up_txint, /* txint */
+ up_txready, /* txready */
+ up_txempty, /* txempty */
+};
+
+/* I/O buffers */
+
+static char g_uartrxbuffer[CONFIG_UART_RXBUFSIZE];
+static char g_uarttxbuffer[CONFIG_UART_TXBUFSIZE];
+
+/* This describes the state of the fake UART port. */
+
+static uart_dev_t g_uartport =
+{
+ 0, /* open_count */
+ false, /* xmitwaiting */
+ false, /* recvwaiting */
+ true, /* isconsole */
+ { 1 }, /* closesem */
+ { 0 }, /* xmitsem */
+ { 0 }, /* recvsem */
+ { /* xmit */
+ { 1 }, /* sem */
+ 0, /* head */
+ 0, /* tail */
+ CONFIG_UART_TXBUFSIZE, /* size */
+ g_uarttxbuffer, /* buffer */
+ },
+ { /* recv */
+ { 1 }, /* sem */
+ 0, /* head */
+ 0, /* tail */
+ CONFIG_UART_RXBUFSIZE, /* size */
+ g_uartrxbuffer, /* buffer */
+ },
+ &g_uart_ops, /* ops */
+ NULL, /* priv */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_setup
+ *
+ * Description:
+ * Configure the UART baud, bits, parity, fifos, etc. This
+ * method is called the first time that the serial port is
+ * opened.
+ *
+ ****************************************************************************/
+
+static int up_setup(struct uart_dev_s *dev)
+{
+ return OK;
+}
+
+/****************************************************************************
+ * Name: up_shutdown
+ *
+ * Description:
+ * Disable the UART. This method is called when the serial
+ * port is closed
+ *
+ ****************************************************************************/
+
+static void up_shutdown(struct uart_dev_s *dev)
+{
+}
+
+/****************************************************************************
+ * Name: up_attach
+ *
+ * Description:
+ * Configure the UART to operation in interrupt driven mode. This method is
+ * called when the serial port is opened. Normally, this is just after the
+ * setup() method is called, however, the serial console may operate in a
+ * non-interrupt driven mode during the boot phase.
+ *
+ * RX and TX interrupts are not enabled by the attach method (unless the
+ * hardware supports multiple levels of interrupt enabling). The RX and TX
+ * interrupts are not enabled until the txint() and rxint() methods are called.
+ *
+ ****************************************************************************/
+
+static int up_attach(struct uart_dev_s *dev)
+{
+ return OK;
+}
+
+/****************************************************************************
+ * Name: up_detach
+ *
+ * Description:
+ * Detach UART interrupts. This method is called when the serial port is
+ * closed normally just before the shutdown method is called. The exception is
+ * the serial console which is never shutdown.
+ *
+ ****************************************************************************/
+
+static void up_detach(struct uart_dev_s *dev)
+{
+}
+
+/****************************************************************************
+ * Name: up_ioctl
+ *
+ * Description:
+ * All ioctl calls will be routed through this method
+ *
+ ****************************************************************************/
+
+static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
+{
+ *get_errno_ptr() = ENOTTY;
+ return ERROR;
+}
+
+/****************************************************************************
+ * Name: up_receive
+ *
+ * Description:
+ * Called (usually) from the interrupt level to receive one
+ * character from the UART. Error bits associated with the
+ * receipt are provided in the return 'status'.
+ *
+ ****************************************************************************/
+
+static int up_receive(struct uart_dev_s *dev, uint32_t *status)
+{
+ uint8_t ch = z80_lowgetc();
+ *status = 0;
+ return ch;
+}
+
+/****************************************************************************
+ * Name: up_rxint
+ *
+ * Description:
+ * Call to enable or disable RX interrupts
+ *
+ ****************************************************************************/
+
+static void up_rxint(struct uart_dev_s *dev, bool enable)
+{
+}
+
+/****************************************************************************
+ * Name: up_rxavailable
+ *
+ * Description:
+ * Return true if the receive fifo is not empty
+ *
+ ****************************************************************************/
+
+static bool up_rxavailable(struct uart_dev_s *dev)
+{
+ return true;
+}
+
+/****************************************************************************
+ * Name: up_send
+ *
+ * Description:
+ * This method will send one byte on the UART
+ *
+ ****************************************************************************/
+
+static void up_send(struct uart_dev_s *dev, int ch)
+{
+ z80_lowputc(ch);
+}
+
+/****************************************************************************
+ * Name: up_txint
+ *
+ * Description:
+ * Call to enable or disable TX interrupts
+ *
+ ****************************************************************************/
+
+static void up_txint(struct uart_dev_s *dev, bool enable)
+{
+}
+
+/****************************************************************************
+ * Name: up_txready
+ *
+ * Description:
+ * Return true if the tranmsit fifo is not full
+ *
+ ****************************************************************************/
+
+static bool up_txready(struct uart_dev_s *dev)
+{
+ return true;
+}
+
+/****************************************************************************
+ * Name: up_txempty
+ *
+ * Description:
+ * Return true if the transmit fifo is empty
+ *
+ ****************************************************************************/
+
+static bool up_txempty(struct uart_dev_s *dev)
+{
+ return true;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_serialinit
+ *
+ * Description:
+ * Performs the low level UART initialization early in
+ * debug so that the serial console will be available
+ * during bootup. This must be called before up_serialinit.
+ *
+ ****************************************************************************/
+
+void up_earlyserialinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_serialinit
+ *
+ * Description:
+ * Register serial console and serial ports. This assumes
+ * that up_earlyserialinit was called previously.
+ *
+ ****************************************************************************/
+
+void up_serialinit(void)
+{
+ (void)uart_register("/dev/console", &g_uartport);
+ (void)uart_register("/dev/ttyS0", &g_uartport);
+}
+#endif /* USE_SERIALDRIVER */
+
+/****************************************************************************
+ * Name: up_putc
+ *
+ * Description:
+ * Provide priority, low-level access to support OS debug
+ * writes
+ *
+ ****************************************************************************/
+
+int up_putc(int ch)
+{
+ z80_lowputc(ch);
+ return 0;
+}
+
diff --git a/nuttx/configs/z80sim/src/z80_timerisr.c b/nuttx/configs/z80sim/src/z80_timerisr.c
new file mode 100644
index 000000000..e6357e8e0
--- /dev/null
+++ b/nuttx/configs/z80sim/src/z80_timerisr.c
@@ -0,0 +1,95 @@
+/****************************************************************************
+ * configs/z80sim/src/z80_timerisr.c
+ *
+ * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include "clock_internal.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Global Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Function: up_timerisr
+ *
+ * Description:
+ * The timer ISR will perform a variety of services for various portions of
+ * the system.
+ *
+ ****************************************************************************/
+
+int up_timerisr(int irq, FAR chipreg_t *regs)
+{
+ /* Process timer interrupt */
+
+ sched_process_timer();
+ return 0;
+}
+
+/****************************************************************************
+ * Function: up_timerinit
+ *
+ * Description:
+ * This function is called during start-up to initialize the timer
+ * interrupt.
+ *
+ ****************************************************************************/
+
+void up_timerinit(void)
+{
+ /* The timer interrupt was attached in up_irqinitialize -- see comments there */
+}
+
diff --git a/nuttx/configs/z8encore000zco/Kconfig b/nuttx/configs/z8encore000zco/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/z8encore000zco/README.txt b/nuttx/configs/z8encore000zco/README.txt
new file mode 100644
index 000000000..9abc06f05
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/README.txt
@@ -0,0 +1,60 @@
+README.txt
+^^^^^^^^^^
+
+ZDS-II Compiler Versions
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+4.10.1
+ The ZDS-II version 4.10.2 will not compile NuttX. It reports "internal
+ errors" on one of the files, mm/mm_initialize.c. Below is a simple work-
+ around. With this work-around in place, NuttX builds successfully with
+ the 4.10.1 compiler.
+
+ --- mm/mm_initialize.c.SAVE 2008-02-13 08:06:46.833857700 -0600
+ +++ mm/mm_initialize.c 2008-02-13 08:07:26.367608900 -0600
+ @@ -94,8 +94,11 @@
+ {
+ int i;
+
+ +#if 0 /* DO NOT CHECK IN */
+ CHECK_ALLOCNODE_SIZE;
+ CHECK_FREENODE_SIZE;
+ +#endif
+
+ /* Set up global variables */
+
+4.9.5
+ This is the latest tool version listed on the ZiLOG site for the Z8F6403.
+ However, it uses different compiler command line arguments.
+
+Other Versions
+ If you use any version of ZDS-II other than 4.10.1 or if you install ZDS-II
+ at any location other than the default location, you will have to modify
+ two files: (1) configs/z8encore000zco/*/setenv.sh and (2)
+ configs/z8encore000zco/*/Make.defs.
+
+Configuration Subdirectories
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- src/ and include/
+ These directories contain common logic for all z8encore000zco
+ configurations.
+
+Variations on the basic z8encore000zco configuration are maintained
+in subdirectories. To configure any specific configuration, do the
+following steps:
+
+ cd <nuttx-top-directory>/tools
+ ./configure.sh z8encore000zco/<sub-directory>
+ cd <nuttx-top-directgory>
+ make
+
+Where <sub-directory> is the specific board configuration that you
+wish to build. The following board-specific configurations are
+available:
+
+- ostest
+ This builds the examples/ostest application for execution from FLASH.
+ See examples/README.txt for information about ostest.
+
+Check out any README.txt files in these <sub-directory>s.
diff --git a/nuttx/configs/z8encore000zco/include/board.h b/nuttx/configs/z8encore000zco/include/board.h
new file mode 100644
index 000000000..4690ee093
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/include/board.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * arch/z8encore000zco/include/board.h
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* LED pattern definitions */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_IDLE 4
+#define LED_INIRQ 5
+#define LED_ASSERTION 6
+#define LED_SIGNAL 6
+#define LED_PANIC 7
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/z8encore000zco/ostest/Make.defs b/nuttx/configs/z8encore000zco/ostest/Make.defs
new file mode 100644
index 000000000..cf310e0ff
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/z8encore000zco/ostest/Make.defs
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_Z8Encore!_4.10.1
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y)
+ZDSDEVINCDIR := $(ZDSZILOGINCDIR)/Z8Encore_F642X
+endif
+ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y)
+ZDSDEVINCDIR := $(ZDSZILOGINCDIR)/Z8Encore_F640X
+endif
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSDEVINCDIR := ${shell cygpath -w $(ZDSDEVINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y)
+ARCHFAMILYDEF = _Z8ENCORE_F642X
+ARCHSERIESDEF = _Z8ENCORE_64K_SERIES
+ARCHREVAA = -NOrevaa
+ifeq ($(CONFIG_ARCH_CHIP_Z8F6423),y)
+ARCHCPU = Z8F6423
+ARCHCPUDEF = _Z8F6423
+endif
+endif
+
+ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y)
+ARCHFAMILYDEF = _Z8ENCORE_F640X
+ARCHSERIESDEF = _Z8ENCORE_640_FAMILY
+ARCHREVAA = -revaa
+ifeq ($(CONFIG_ARCH_CHIP_Z8F6403),y)
+ARCHCPU = Z8F6403
+ARCHCPUDEF = _Z8F6403
+endif
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -sdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -sdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase $(ARCHREVAA)
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHSERIESDEF)=1 -define:$(ARCHFAMILYDEF)=1 \ -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -NOregvar -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -regvar
+endif
+
+ARCHCPUFLAGS = -chartype:S -model:L -const:RAM -NOoptlink -promote -cpu:$(ARCHCPU) $(ARCHREVAA) -NOgenprintf \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHFAMILYDEF) -define:$(ARCHCPUDEF) -define:$(ARCHSERIESDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR);$(WZDSDEVINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D$(ARCHSERIESDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/z8encore000zco/ostest/ostest.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez8cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez8link.exe
+AS = $(ZDSBINDIR)/ez8asm.exe
+AR = $(ZDSBINDIR)/ez8lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z8encore000zco/ostest/README.txt b/nuttx/configs/z8encore000zco/ostest/README.txt
new file mode 100644
index 000000000..214c3a9f1
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/README.txt
@@ -0,0 +1,12 @@
+README.txt
+^^^^^^^^^^
+
+ostest.zfpproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger. Before using, copy the following
+ files from the toplevel directory:
+
+ nuttx.hex, nuttx.map, nuttx.lod
+
+ to this directory as:
+
+ ostest.hex, ostest.map, ostest.lod
diff --git a/nuttx/configs/z8encore000zco/ostest/appconfig b/nuttx/configs/z8encore000zco/ostest/appconfig
new file mode 100644
index 000000000..212b52f72
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/z8encore000zco/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/z8encore000zco/ostest/defconfig b/nuttx/configs/z8encore000zco/ostest/defconfig
new file mode 100644
index 000000000..2fb427105
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/defconfig
@@ -0,0 +1,222 @@
+############################################################################
+# configs/z8encore000zco/ostest/defconfig
+#
+# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z8=y
+CONFIG_ARCH_CHIP="z8"
+CONFIG_ARCH_CHIP_Z8=y
+CONFIG_ARCH_CHIP_Z8F640X=y
+CONFIG_ARCH_CHIP_Z8F6403=y
+CONFIG_ARCH_CHIP_Z8F642X=n
+CONFIG_ARCH_CHIP_Z8F6423=n
+CONFIG_ARCH_BOARD="z8encore000zco"
+CONFIG_ARCH_BOARD_Z8ENCORE000ZCO=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=n
+#
+# eZ8 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=17
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=256
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
+CONFIG_PTHREAD_STACK_MIN=128
+CONFIG_PTHREAD_STACK_DEFAULT=256
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z8encore000zco/ostest/ostest.linkcmd b/nuttx/configs/z8encore000zco/ostest/ostest.linkcmd
new file mode 100755
index 000000000..14fcd81f6
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/ostest.linkcmd
@@ -0,0 +1,80 @@
+/****************************************************************************/
+/* configs/z8encore000zco/ostest/ostest.linkcmd */
+/* */
+/* Copyright (C) 2008 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -sort NAME=ascending -unresolved=fatal
+-NOwarnoverlap -NOxref -warn -debug -NOigcase -quiet
+
+RANGE ROM $0 : $FFFF
+RANGE RDATA $20 : $FF
+RANGE EDATA $100 : $EFF
+RANGE PRAM FORBIDDEN
+
+CHANGE TEXT=EDATA
+CHANGE TEXT=FAR_DATA
+change NEAR_TXT=NEAR_DATA
+change FAR_TXT=FAR_DATA
+ORDER FAR_BSS, FAR_DATA
+ORDER NEAR_BSS,NEAR_DATA
+COPY NEAR_DATA ROM
+COPY FAR_DATA ROM
+
+define _low_near_romdata = copy base of NEAR_DATA
+define _low_neardata = base of NEAR_DATA
+define _len_neardata = length of NEAR_DATA
+define _low_far_romdata = copy base of FAR_DATA
+define _low_fardata = base of FAR_DATA
+define _len_fardata = length of FAR_DATA
+define _low_nearbss = base of NEAR_BSS
+define _len_nearbss = length of NEAR_BSS
+define _low_farbss = base of FAR_BSS
+define _len_farbss = length of FAR_BSS
+define _far_stacktop = highaddr of EDATA
+define _near_stack = highaddr of RDATA
+define _far_heapbot = top of EDATA
+define _near_heaptop = highaddr of RDATA
+define _near_heapbot = top of RDATA
+define _low_pramseg = base of PRAMSEG
+define _len_pramseg = length of PRAMSEG
+define _low_pram_romdata = copy base of PRAMSEG
+define _READ_NVDS=$1000
+define _WRITE_NVDS=$10B3
+define _READ_NVDS_GET_STATUS=$1000
+define _WRITE_NVDS_GET_STATUS=$10B3
+/* Set frequency to 18432000 Hz */
+define __user_frequency = 18432000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/z8encore000zco/ostest/ostest.zdsproj b/nuttx/configs/z8encore000zco/ostest/ostest.zdsproj
new file mode 100644
index 000000000..d46a19859
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/ostest.zdsproj
@@ -0,0 +1,291 @@
+<project type="Standard" project-type="Standard" configuration="Debug" created-by="{{build_number}}" modified-by="b:4.10:06121401">
+<cpu>Z8F6403</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="">.\zsldevinit.asm</file>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z8F6403=1,_Z8ENCORE_640_FAMILY=1,_Z8ENCORE_F640X=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="revaa" type="boolean" change-action="rebuild">true</option>
+<option name="sdiopt" type="boolean" change-action="assemble">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="codegen" type="string" change-action="none">UserDefined</option>
+<option name="const" type="string" change-action="compile">RAM</option>
+<option name="define" type="string" change-action="compile">_Z8F6403,_Z16F_SERIES,_Z8ENCORE_640_FAMILY,_Z8ENCORE_F640X</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">L</option>
+<option name="optlink" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="regvar" type="string" change-action="compile">Normal</option>
+<option name="regvarcache" type="string" change-action="none">Normal</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">Z8ENCORE00ZC0</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="zemul_enableevents" type="boolean" change-action="none">false</option>
+<option name="zemul_brkonfull" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">true</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000001</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usenvds" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\ostest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="directives" type="string" change-action="build"></option>
+<option name="edata" type="string" change-action="build">100-EFF</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="flash" type="string" change-action="build">FF80-FFFF</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="nvds" type="string" change-action="build">0-f</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\ostest</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="pram" type="string" change-action="build">0-f</option>
+<option name="praminuse" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="rdata" type="string" change-action="build">20-FF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">0-FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuptype" type="string" change-action="build">Standard</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">true</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+<option name="zslpramisrs" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z8F6403=1,_Z16F_SERIES=1,_Z8ENCORE_640_FAMILY=1,_Z8ENCORE_F640X=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="revaa" type="boolean" change-action="rebuild">false</option>
+<option name="sdiopt" type="boolean" change-action="assemble">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="codegen" type="string" change-action="none">UserDefined</option>
+<option name="const" type="string" change-action="compile">RAM</option>
+<option name="define" type="string" change-action="compile">_Z8F6403,_Z16F_SERIES,_Z8ENCORE_640_FAMILY,_Z8ENCORE_F640X</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">S</option>
+<option name="optlink" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="regvar" type="string" change-action="compile">Normal</option>
+<option name="regvarcache" type="string" change-action="none">Normal</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild"></option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="zemul_enableevents" type="boolean" change-action="none">false</option>
+<option name="zemul_brkonfull" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">1</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usenvds" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build"></option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="directives" type="string" change-action="build"></option>
+<option name="edata" type="string" change-action="build">100-EFF</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="flash" type="string" change-action="build">FF80-FFFF</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="nvds" type="string" change-action="build">0-f</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\ostest</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="pram" type="string" change-action="build">0-f</option>
+<option name="praminuse" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="rdata" type="string" change-action="build">20-FF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">0-FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuptype" type="string" change-action="build">Standard</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">true</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+<option name="zslpramisrs" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+<watch-element expression="0x801d1a" />
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+<!-- ice event information -->
+<ice-events count="4" enable="0" breakOnFull="0">
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+</ice-events>
+
+</project> \ No newline at end of file
diff --git a/nuttx/configs/z8encore000zco/ostest/setenv.sh b/nuttx/configs/z8encore000zco/ostest/setenv.sh
new file mode 100755
index 000000000..5aa816dd9
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/z8encore000zco/ostest/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_Z8Encore!_4.10.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/z8encore000zco/ostest/test-result.txt b/nuttx/configs/z8encore000zco/ostest/test-result.txt
new file mode 100644
index 000000000..ebf178439
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/ostest/test-result.txt
@@ -0,0 +1,529 @@
+This is the output from the z16f target from January 31, 2008
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+While all tests pass per this output, my impression is that some
+of the timed delays in during execution of the test were not
+correct and I suspect some system timing issues.
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: putenv(Variable1=BadValue3)
+user_start: setenv(Variable1, GoodValue1, TRUE)
+user_start: setenv(Variable2, BadValue1, FALSE)
+user_start: setenv(Variable2, GoodValue2, TRUE)
+user_start: setenv(Variable3, Variable3, FALSE)
+user_start: setenv(Variable3, Variable3, FALSE)
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+user_start: Started user_main at PID=2
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 2
+mxordblk 76b20 76b20
+uordblks 33d0 33d0
+fordblks 78180 78180
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 3
+mxordblk 76b20 76b20
+uordblks 33d0 33c0
+fordblks 78180 78190
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has no value
+show_variable: Variable=Variable3 has no value
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 33c0 3380
+fordblks 78190 781d0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning ntcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+errors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=804b10
+Resuming
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 4
+mxordblk 76b20 76b20
+uordblks 3380 35c0
+fordblks 781d0 77f90
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b23
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b36
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b49
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf76
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b5c
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf66
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b6f
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve1 finished
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 3 started
+barrier_test: Thread 3 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 4 started
+barrier_test: Thread 4 created
+barrier_func: Thread 3 calling pthread_barrier_wait()
+barrier_func: Thread 4 calling pthread_barrier_wait()
+barrier_func: Thread 5 started
+barrier_test: Thread 5 created
+barrier_func: Thread 6 started
+barrier_test: Thread 6 created
+barrier_func: Thread 7 started
+barrier_test: Thread 7 created
+barrier_func: Thread 5 calling pthread_barrier_wait()
+barrier_func: Thread 6 calling pthread_barrier_wait()
+barrier_func: Thread 7 calling pthread_barrier_wait()
+barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2, back with status=0 (I am not special)
+barrier_func: Thread 3, back with status=0 (I am not special)
+barrier_func: Thread 4, back with status=0 (I am not special)
+barrier_func: Thread 5, back with status=0 (I am not special)
+barrier_func: Thread 6, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 7 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_func: Thread 6 done
+barrier_func: Thread 3 done
+barrier_func: Thread 4 done
+barrier_func: Thread 5 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+barrier_test: Thread 3 completed with result=0
+barrier_test: Thread 4 completed with result=0
+barrier_test: Thread 5 completed with result=0
+barrier_test: Thread 6 completed with result=0
+barrier_test: Thread 7 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 4
+mxordblk 76b20 76b20
+uordblks 33d0 35c0
+fordblks 78180 77f90
+user_main: Exitting
+
diff --git a/nuttx/configs/z8encore000zco/src/Makefile b/nuttx/configs/z8encore000zco/src/Makefile
new file mode 100644
index 000000000..ca9de460c
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/src/Makefile
@@ -0,0 +1,84 @@
+############################################################################
+# configs/z8encore000zco/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
+USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
+INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = z8_lowinit.c z8_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+
+all: libboard$(LIBEXT)
+
+$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
+ @$(CPP) $(CPPFLAGS) `cygpath -w $<` -o $@.tmp
+ @cat $@.tmp | sed -e "s/^#/;/g" > $@
+ @rm $@.tmp
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/z8encore000zco/src/z8_leds.c b/nuttx/configs/z8encore000zco/src/z8_leds.c
new file mode 100644
index 000000000..097b27efa
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/src/z8_leds.c
@@ -0,0 +1,243 @@
+/****************************************************************************
+ * configs/z8encore000zco/src/z8_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The z16f2800100zcog board has four LEDs:
+ *
+ * - Green LED D1 which illuminates in the presence of Vcc
+ * - Red LED D2 connected to chip port PA0_T0IN
+ * - Yellow LED D3 connected to chip port PA1_T0OUT
+ * - Green LED D4 connected to chip port PA2_DE0
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include <arch/board/board.h>
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* Port G: Anode Bit Assignments (1 enables) */
+
+#define Z8_PORTG_ANODE_MASK 0x7f
+#define Z8_PORTG_ANODE_ROW0 0x01
+#define Z8_PORTG_ANODE_ROW1 0x02
+#define Z8_PORTG_ANODE_ROW2 0x04
+#define Z8_PORTG_ANODE_ROW3 0x08
+#define Z8_PORTG_ANODE_ROW4 0x10
+#define Z8_PORTG_ANODE_ROW5 0x20
+#define Z8_PORTG_ANODE_ROW6 0x40
+
+/* Port E: Cathode Bit Assignements (0 enables) */
+
+#define Z8_PORTE_CATHODE_MASK 0x1f
+#define Z8_PORTE_CATHODE_COLUMN0 0x01
+#define Z8_PORTE_CATHODE_COLUMN1 0x02
+#define Z8_PORTE_CATHODE_COLUMN2 0x04
+#define Z8_PORTE_CATHODE_COLUMN3 0x08
+#define Z8_PORTE_CATHODE_COLUMN4 0x10
+
+/* Port E: LED Addressing */
+
+#define Z8_PORTE_LED_MASK 0xe0
+#define Z8_PORTE_LED_D3 0x20
+#define Z8_PORTE_LED_D4 0x40
+#define Z8_PORTE_LED_D1 0x80
+
+/* Port G: LED Addressing */
+
+#define Z8_PORTG_LED_MASK 0x80
+#define Z8_PORTG_LED_D2 0x80
+
+/* Special values for display */
+
+#define LED_ALLON { Z8_PORTG_ANODE_MASK, 0x00 }
+#define LED_ALLOFF { 0x00, Z8_PORTE_CATHODE_MASK }
+#define LED_LEVEL1 { 0x10, 0x00 }
+#define LED_LEVEL2 { 0x08, 0x00 }
+#define LED_LEVEL3 { 0x04, 0x00 }
+#define LED_LEVEL4 { 0x02, 0x00 }
+#define LED_LEVEL1I { 0x14, 0x00 }
+#define LED_LEVEL2I { 0x0c, 0x00 }
+#define LED_LEVEL3I { 0x04, 0x00 }
+#define LED_LEVEL4I { 0x06, 0x00 }
+#define LED_LEVEL1S { 0x11, 0x00 }
+#define LED_LEVEL2S { 0x09, 0x00 }
+#define LED_LEVEL3S { 0x05, 0x00 }
+#define LED_LEVEL4S { 0x03, 0x00 }
+#define LED_LEVEL1A { 0x10, 0x11 }
+#define LED_LEVEL2A { 0x08, 0x11 }
+#define LED_LEVEL3A { 0x04, 0x11 }
+#define LED_LEVEL4A { 0x02, 0x11 }
+#define LED_SNAKEEYES { 0x06, 0x11 }
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct z8_ledbits_s
+{
+ uint8_t anode;
+ uint8_t cathode;
+};
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct z8_ledbits_s g_ledarray[10][4] =
+{
+ { LED_ALLON, LED_ALLON, LED_ALLON, LED_ALLON },
+ { LED_ALLOFF, LED_ALLOFF, LED_ALLOFF, LED_ALLOFF },
+ { LED_LEVEL1, LED_ALLOFF, LED_ALLOFF, LED_ALLOFF },
+ { LED_LEVEL1, LED_LEVEL2, LED_ALLOFF, LED_ALLOFF },
+ { LED_LEVEL1, LED_LEVEL2, LED_LEVEL3, LED_ALLOFF },
+ { LED_LEVEL1, LED_LEVEL2, LED_LEVEL3, LED_LEVEL4 },
+ { LED_LEVEL1I, LED_LEVEL2I, LED_LEVEL3I, LED_LEVEL4I },
+ { LED_LEVEL1S, LED_LEVEL2S, LED_LEVEL3S, LED_LEVEL4S },
+ { LED_LEVEL1A, LED_LEVEL2A, LED_LEVEL3A, LED_LEVEL4A },
+ { LED_SNAKEEYES, LED_SNAKEEYES, LED_SNAKEEYES, LED_SNAKEEYES }
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: z8_putled134
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+static void z8_putled134(FAR const struct z8_ledbits_s *bits, uint8_t addr)
+{
+ uint8_t porte;
+
+ porte = bits->cathode;
+ putreg8(porte, PEOD); /* Load porte data */
+ putreg8(bits->anode, PGOD); /* Load portg data */
+
+ porte |= addr;
+ putreg8(porte, PEOD); /* Latch data */
+}
+#endif
+
+/****************************************************************************
+ * Name: z8_lputed2
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+static void z8_putled2(FAR const struct z8_ledbits_s *bits, uint8_t addr)
+{
+ uint8_t portg;
+
+ putreg8(bits->cathode, PEOD); /* Load porte data */
+ portg = bits->anode;
+ putreg8(porte, PGOD); /* Load portg data */
+
+ portg |= addr;
+ putreg8(portg, PGOD); /* Latch data */
+}
+#endif
+
+/****************************************************************************
+ * Name: z8_putarray
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+static void z8_putarray(FAR const struct z8_ledarray_s *array)
+{
+ z8_putled134(&array->led[0], Z8_PORTE_LED_D1);
+ z8_putled2(&array->led[1], Z8_PORTG_LED_D2);
+ z8_putled134(&array->led[2], Z8_PORTE_LED_D3);
+ z8_putled134(&array->led[3], Z8_PORTE_LED_D4);
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+ putreg8(0x00, PEAF); /* PE Alt func = Port */
+ putreg8(0x00, PGAF); /* PG Alt func = Port */
+
+ putreg8(0x00, PEOC); /* PE Out Ctrl = push-pull */
+ putreg8(0x00, PGOC); /* PG Out Ctrl = push-pull */
+
+/*putreg8(0x00, PEDD); * PA Data Dir = output */
+ putreg8(0x01, PEADDR); /* PA Data Dir = output */
+ putreg8(0x00, PECTL); /* OUTPUT */
+/*putreg8(0x00, PGDD); * PA Data Dir = output */
+ putreg8(0x01, PGADDR); /* PA Data Dir = output */
+ putreg8(0x00, PGCTL); /* OUTPUT */
+
+ z8_putarray(&g_ledarray[0][0]);
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+ if ((unsigned)led <= 8)
+ {
+ z8_putarray(&g_ledarray[led+1][0]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+ if (led >= 1)
+ {
+ up_ledon(led-1);
+ }
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/z8encore000zco/src/z8_lowinit.c b/nuttx/configs/z8encore000zco/src/z8_lowinit.c
new file mode 100644
index 000000000..1604fb82c
--- /dev/null
+++ b/nuttx/configs/z8encore000zco/src/z8_lowinit.c
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * configs/z8encore000zco/src/z8_lowinit.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Based upon sample code included with the Zilog ZDS-II toolchain.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ * Included Files
+ ***************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip/chip.h"
+
+/***************************************************************************
+ * Definitions
+ ***************************************************************************/
+
+/***************************************************************************
+ * Private Functions
+ ***************************************************************************/
+
+static void z8_gpioinit(void)
+{
+}
+
+/***************************************************************************
+ * Public Functions
+ ***************************************************************************/
+
+void z8_lowinit(void)
+{
+ z8_gpioinit();
+}
+
diff --git a/nuttx/configs/z8f64200100kit/Kconfig b/nuttx/configs/z8f64200100kit/Kconfig
new file mode 100644
index 000000000..ae2bf3130
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
diff --git a/nuttx/configs/z8f64200100kit/README.txt b/nuttx/configs/z8f64200100kit/README.txt
new file mode 100644
index 000000000..afe647565
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/README.txt
@@ -0,0 +1,60 @@
+README.txt
+^^^^^^^^^^
+
+ZDS-II Compiler Versions
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+4.10.1
+ The ZDS-II version 4.10.2 will not compile NuttX. It reports "internal
+ errors" on one of the files, mm/mm_initialize.c. Below is a simple work-
+ around. With this work-around in place, NuttX builds successfully with
+ the 4.10.1 compiler.
+
+ --- mm/mm_initialize.c.SAVE 2008-02-13 08:06:46.833857700 -0600
+ +++ mm/mm_initialize.c 2008-02-13 08:07:26.367608900 -0600
+ @@ -94,8 +94,11 @@
+ {
+ int i;
+
+ +#if 0 /* DO NOT CHECK IN */
+ CHECK_ALLOCNODE_SIZE;
+ CHECK_FREENODE_SIZE;
+ +#endif
+
+ /* Set up global variables */
+
+4.9.5
+ This is the latest tool version listed on the ZiLOG site for the Z8F6403.
+ However, it uses different compiler command line arguments.
+
+Other Versions
+ If you use any version of ZDS-II other than 4.10.1 or if you install ZDS-II
+ at any location other than the default location, you will have to modify
+ two files: (1) configs/z8f64200100kit/*/setenv.sh and (2)
+ configs/z8f64200100kit/*/Make.defs.
+
+Configuration Subdirectories
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- src/ and include/
+ These directories contain common logic for all z8f64200100kit
+ configurations.
+
+Variations on the basic z8f64200100kit configuration are maintained
+in subdirectories. To configure any specific configuration, do the
+following steps:
+
+ cd <nuttx-top-directory>/tools
+ ./configure.sh z8f64200100kit/<sub-directory>
+ cd <nuttx-top-directgory>
+ make
+
+Where <sub-directory> is the specific board configuration that you
+wish to build. The following board-specific configurations are
+available:
+
+- ostest
+ This builds the examples/ostest application for execution from FLASH.
+ See examples/README.txt for information about ostest.
+
+Check out any README.txt files in these <sub-directory>s.
diff --git a/nuttx/configs/z8f64200100kit/include/board.h b/nuttx/configs/z8f64200100kit/include/board.h
new file mode 100644
index 000000000..87ca98adc
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/include/board.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * arch/z8f64200100kit/include/board.h
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/* LED pattern definitions */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_IDLE 4
+#define LED_INIRQ 5
+#define LED_ASSERTION 6
+#define LED_SIGNAL 6
+#define LED_PANIC 7
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/z8f64200100kit/ostest/Make.defs b/nuttx/configs/z8f64200100kit/ostest/Make.defs
new file mode 100644
index 000000000..894df0855
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/Make.defs
@@ -0,0 +1,198 @@
+############################################################################
+# configs/z8f64200100kit/ostest/Make.defs
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+include ${TOPDIR}/tools/Config.mk
+
+# These are the directories where the ZDS-II toolchain is installed
+
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_Z8Encore!_4.10.1
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
+ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y)
+ZDSDEVINCDIR := $(ZDSZILOGINCDIR)/Z8Encore_F642X
+endif
+ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y)
+ZDSDEVINCDIR := $(ZDSZILOGINCDIR)/Z8Encore_F640X
+endif
+ZDSSTDLIBDIR := $(ZDSINSTALLDIR)/lib/std
+ZDSZILOGLIBDIR := $(ZDSINSTALLDIR)/lib/zilog
+
+# These are the same directories but with the directory separator
+# character swapped as needed by the ZDS-II compiler
+
+WINTOOL := y
+WTOPDIR := ${shell cygpath -w $(TOPDIR)}
+WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
+WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+WZDSDEVINCDIR := ${shell cygpath -w $(ZDSDEVINCDIR)}
+WZDSSTDLIBDIR := ${shell cygpath -w $(ZDSSTDLIBDIR)}
+WZDSZILOGLIBDIR := ${shell cygpath -w $(ZDSZILOGLIBDIR)}
+
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
+# Assembler definitions
+
+ifeq ($(CONFIG_ARCH_CHIP_Z8F642X),y)
+ARCHFAMILYDEF = _Z8ENCORE_F642X
+ARCHSERIESDEF = _Z8ENCORE_64K_SERIES
+ARCHREVAA = -NOrevaa
+ifeq ($(CONFIG_ARCH_CHIP_Z8F6423),y)
+ARCHCPU = Z8F6423
+ARCHCPUDEF = _Z8F6423
+endif
+endif
+
+ifeq ($(CONFIG_ARCH_CHIP_Z8F640X),y)
+ARCHFAMILYDEF = _Z8ENCORE_F640X
+ARCHSERIESDEF = _Z8ENCORE_640_FAMILY
+ARCHREVAA = -revaa
+ifeq ($(CONFIG_ARCH_CHIP_Z8F6403),y)
+ARCHCPU = Z8F6403
+ARCHCPUDEF = _Z8F6403
+endif
+endif
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHASMOPTIMIZATION = -debug -sdiopt
+else
+ ARCHASMOPTIMIZATION = -nodebug -sdiopt
+endif
+
+ARCHASMCPUFLAGS = -cpu:$(ARCHCPU) -NOigcase $(ARCHREVAA)
+ARCHASMLIST = -list -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
+ARCHASMWARNINGS = -warn
+ARCHASMDEFINES = -define:$(ARCHCPUDEF)=1 -define:$(ARCHSERIESDEF)=1 -define:$(ARCHFAMILYDEF)=1 \ -define:__ASSEMBLY__
+ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+EARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
+AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
+ $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
+
+# Compiler definitions
+
+ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
+ ARCHOPTIMIZATION = -debug -NOregvar -reduceopt
+else
+ ARCHOPTIMIZATION = -nodebug -regvar
+endif
+
+ARCHCPUFLAGS = -chartype:S -model:L -const:RAM -NOoptlink -promote -cpu:$(ARCHCPU) $(ARCHREVAA) -NOgenprintf \
+ -asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
+ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
+ARCHPICFLAGS =
+ARCHWARNINGS = -warn
+ARCHDEFINES = -define:$(ARCHFAMILYDEF) -define:$(ARCHCPUDEF) -define:$(ARCHSERIESDEF)
+ARCHSTDINCLUDES = -stdinc:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR);$(WZDSDEVINCDIR)'
+ARCHUSRINCLUDES = -usrinc:'.'
+ARCHINCLUDES = $(ARCHSTDINCLUDES) $(ARCHUSRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHLIST) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+CPPDEFINES = -D$(ARCHFAMILYDEF) -D$(ARCHCPUDEF) -D$(ARCHSERIESDEF) -D__ASSEMBLY__
+CPPINCLUDES = -I$(TOPDIR)/include
+CPPFLAGS = $(CPPDEFINES) $(CPPINCLUDES)
+
+# Librarian definitions
+
+ARFLAGS = -quiet -warn
+
+# Linker definitions
+
+LINKCMDTEMPLATE = $(TOPDIR)/configs/z8f64200100kit/ostest/ostest.linkcmd
+
+# Tool names/pathes
+
+CROSSDEV =
+CC = $(ZDSBINDIR)/ez8cc.exe
+CPP = gcc -E
+LD = $(ZDSBINDIR)/ez8link.exe
+AS = $(ZDSBINDIR)/ez8asm.exe
+AR = $(ZDSBINDIR)/ez8lib.exe
+
+# File extensions
+
+ASMEXT = .asm
+OBJEXT = .obj
+LIBEXT = .lib
+EXEEXT = .hex
+
+# These are the macros that will be used in the NuttX make system
+# to compile and assembly source files and to insert the resulting
+# object files into an archive
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @#echo "CC: $1"
+ @(wfile=`cygpath -w $1`; $(CC) $(CFLAGS) $$wfile)
+endef
+
+define ASSEMBLE
+ @#echo "AS: $1"
+ @(wfile=`cygpath -w $1`; $(AS) $(AFLAGS) $$wfile)
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.obj *.src *.lib *.hex *.lst
+endef
+
+# This is the tool to use for dependencies (i.e., none)
+
+MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+
+# ZDS-II cannot follow Cygwin soft links, so we will have to use directory copies
+
+DIRLINK = $(TOPDIR)/tools/winlink.sh
+DIRUNLINK = $(TOPDIR)/tools/unlink.sh
+
+# Linux/Cygwin host tool definitions
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
diff --git a/nuttx/configs/z8f64200100kit/ostest/README.txt b/nuttx/configs/z8f64200100kit/ostest/README.txt
new file mode 100644
index 000000000..214c3a9f1
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/README.txt
@@ -0,0 +1,12 @@
+README.txt
+^^^^^^^^^^
+
+ostest.zfpproj is a simple ZDS-II project that will allow you
+ to use the ZDS-II debugger. Before using, copy the following
+ files from the toplevel directory:
+
+ nuttx.hex, nuttx.map, nuttx.lod
+
+ to this directory as:
+
+ ostest.hex, ostest.map, ostest.lod
diff --git a/nuttx/configs/z8f64200100kit/ostest/appconfig b/nuttx/configs/z8f64200100kit/ostest/appconfig
new file mode 100644
index 000000000..e6f0c2375
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/appconfig
@@ -0,0 +1,39 @@
+############################################################################
+# configs/z8f64200100kit/ostest/appconfig
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+# Path to example in apps/examples containing the user_start entry point
+
+CONFIGURED_APPS += examples/ostest
+
diff --git a/nuttx/configs/z8f64200100kit/ostest/defconfig b/nuttx/configs/z8f64200100kit/ostest/defconfig
new file mode 100644
index 000000000..d9c5a51a5
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/defconfig
@@ -0,0 +1,222 @@
+############################################################################
+# configs/z8f64200100kit/ostest/defconfig
+#
+# Copyright (C) 2008, 2010, 2012 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+#
+# Architecture selection
+#
+CONFIG_ARCH="z80"
+CONFIG_ARCH_Z8=y
+CONFIG_ARCH_CHIP="z8"
+CONFIG_ARCH_CHIP_Z8=y
+CONFIG_ARCH_CHIP_Z8F640X=n
+CONFIG_ARCH_CHIP_Z8F6403=n
+CONFIG_ARCH_CHIP_Z8F642X=y
+CONFIG_ARCH_CHIP_Z8F6423=y
+CONFIG_ARCH_BOARD="z8f64200100kit"
+CONFIG_ARCH_BOARD_Z8F64200100KIT=y
+CONFIG_BOARD_LOOPSPERMSEC=1250
+CONFIG_ENDIAN_BIG=y
+CONFIG_DRAM_SIZE=65536
+CONFIG_ARCH_LEDS=n
+#
+# ez8 specific device driver settings
+#
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=0
+CONFIG_UART1_TXBUFSIZE=0
+CONFIG_UART0_RXBUFSIZE=0
+CONFIG_UART1_RXBUFSIZE=0
+CONFIG_UART0_BAUD=57600
+CONFIG_UART1_BAUD=57600
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# General build options
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_RAW_BINARY=n
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_SYMBOLS=n
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=0
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2008
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=17
+CONFIG_JULIAN_TIME=n
+CONFIG_HAVE_LOWUARTINIT=y
+CONFIG_DEV_CONSOLE=n
+CONFIG_DEV_LOWCONSOLE=n
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+CONFIG_SEM_PREALLOCHOLDERS=0
+CONFIG_SEM_NNESTPRIO=0
+CONFIG_FDCLONE_DISABLE=n
+CONFIG_FDCLONE_STDIO=n
+CONFIG_SDCLONE_DISABLE=y
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+CONFIG_NOPRINTF_FIELDWIDTH=y
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_STRNLEN=n
+CONFIG_ARCH_BZERO=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# TCP/IP and UDP support via uIP
+#
+CONFIG_NET=n
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=0
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=n
+CONFIG_NET_TCP_CONNS=40
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=n
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=y
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+
+#
+# UIP Network Utilities
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/ostest
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=256
+
+#
+# Settings for apps/nshlib
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_TELNET=n
+CONFIG_NSH_IOBUFFER_SIZE=512
+CONFIG_NSH_CMD_SIZE=40
+CONFIG_NSH_DHCPC=n
+CONFIG_NSH_NOMAC=n
+CONFIG_NSH_IPADDR=0x0a000002
+CONFIG_NSH_DRIPADDR=0x0a000001
+CONFIG_NSH_NETMASK=0xffffff00
+
+#
+# Stack and heap information
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
+CONFIG_PTHREAD_STACK_MIN=128
+CONFIG_PTHREAD_STACK_DEFAULT=256
+CONFIG_HEAP_SIZE=
+CONFIG_HEAP_BASE=
diff --git a/nuttx/configs/z8f64200100kit/ostest/ostest.linkcmd b/nuttx/configs/z8f64200100kit/ostest/ostest.linkcmd
new file mode 100755
index 000000000..87ea00085
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/ostest.linkcmd
@@ -0,0 +1,80 @@
+/****************************************************************************/
+/* configs/z8f64200100kit/ostest/ostest.linkcmd */
+/* */
+/* Copyright (C) 2008 Gregory Nutt. All rights reserved. */
+/* Author: Gregory Nutt <gnutt@nuttx.org> */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in */
+/* the documentation and/or other materials provided with the */
+/* distribution. */
+/* 3. Neither the name NuttX nor the names of its contributors may be */
+/* used to endorse or promote products derived from this software */
+/* without specific prior written permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS */
+/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED */
+/* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************/
+
+-FORMAT=OMF695,INTEL32
+-map -maxhexlen=64 -quiet -sort NAME=ascending -unresolved=fatal
+-NOwarnoverlap -NOxref -warn -debug -NOigcase -quiet
+
+RANGE ROM $0 : $FFFF
+RANGE RDATA $20 : $FF
+RANGE EDATA $100 : $EFF
+RANGE PRAM FORBIDDEN
+
+CHANGE TEXT=EDATA
+CHANGE TEXT=FAR_DATA
+change NEAR_TXT=NEAR_DATA
+change FAR_TXT=FAR_DATA
+ORDER FAR_BSS, FAR_DATA
+ORDER NEAR_BSS,NEAR_DATA
+COPY NEAR_DATA ROM
+COPY FAR_DATA ROM
+
+define _low_near_romdata = copy base of NEAR_DATA
+define _low_neardata = base of NEAR_DATA
+define _len_neardata = length of NEAR_DATA
+define _low_far_romdata = copy base of FAR_DATA
+define _low_fardata = base of FAR_DATA
+define _len_fardata = length of FAR_DATA
+define _low_nearbss = base of NEAR_BSS
+define _len_nearbss = length of NEAR_BSS
+define _low_farbss = base of FAR_BSS
+define _len_farbss = length of FAR_BSS
+define _far_stacktop = highaddr of EDATA
+define _near_stack = highaddr of RDATA
+define _far_heapbot = top of EDATA
+define _near_heaptop = highaddr of RDATA
+define _near_heapbot = top of RDATA
+define _low_pramseg = base of PRAMSEG
+define _len_pramseg = length of PRAMSEG
+define _low_pram_romdata = copy base of PRAMSEG
+define _READ_NVDS=$1000
+define _WRITE_NVDS=$10B3
+define _READ_NVDS_GET_STATUS=$1000
+define _WRITE_NVDS_GET_STATUS=$10B3
+/* Set frequency to 18432000 Hz */
+define __user_frequency = 18432000
+
+/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */
+
diff --git a/nuttx/configs/z8f64200100kit/ostest/ostest.zdsproj b/nuttx/configs/z8f64200100kit/ostest/ostest.zdsproj
new file mode 100644
index 000000000..d46a19859
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/ostest.zdsproj
@@ -0,0 +1,291 @@
+<project type="Standard" project-type="Standard" configuration="Debug" created-by="{{build_number}}" modified-by="b:4.10:06121401">
+<cpu>Z8F6403</cpu>
+
+<!-- file information -->
+<files>
+<file filter-key="">.\zsldevinit.asm</file>
+<file filter-key="flash">..\..\..\nuttx.hex</file>
+</files>
+
+<!-- configuration information -->
+<configurations>
+<configuration name="Debug" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z8F6403=1,_Z8ENCORE_640_FAMILY=1,_Z8ENCORE_F640X=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="revaa" type="boolean" change-action="rebuild">true</option>
+<option name="sdiopt" type="boolean" change-action="assemble">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="codegen" type="string" change-action="none">UserDefined</option>
+<option name="const" type="string" change-action="compile">RAM</option>
+<option name="define" type="string" change-action="compile">_Z8F6403,_Z16F_SERIES,_Z8ENCORE_640_FAMILY,_Z8ENCORE_F640X</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">L</option>
+<option name="optlink" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="regvar" type="string" change-action="compile">Normal</option>
+<option name="regvarcache" type="string" change-action="none">Normal</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild">Z8ENCORE00ZC0</option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="zemul_enableevents" type="boolean" change-action="none">false</option>
+<option name="zemul_brkonfull" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">true</option>
+<option name="sn" type="string" change-action="none">000000000000000000000000</option>
+<option name="snsize" type="integer" change-action="none">1</option>
+<option name="snstep" type="integer" change-action="none">000000000000000000000001</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usenvds" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build">.\ostest.lib</option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="directives" type="string" change-action="build"></option>
+<option name="edata" type="string" change-action="build">100-EFF</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="flash" type="string" change-action="build">FF80-FFFF</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="nvds" type="string" change-action="build">0-f</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\ostest</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="pram" type="string" change-action="build">0-f</option>
+<option name="praminuse" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="rdata" type="string" change-action="build">20-FF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">0-FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuptype" type="string" change-action="build">Standard</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">true</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+<option name="zslpramisrs" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+<configuration name="Release" >
+<tools>
+<tool name="Assembler">
+<options>
+<option name="define" type="string" change-action="assemble">_Z8F6403=1,_Z16F_SERIES=1,_Z8ENCORE_640_FAMILY=1,_Z8ENCORE_F640X=1</option>
+<option name="include" type="string" change-action="assemble"></option>
+<option name="list" type="boolean" change-action="none">true</option>
+<option name="listmac" type="boolean" change-action="none">false</option>
+<option name="name" type="boolean" change-action="none">true</option>
+<option name="pagelen" type="integer" change-action="none">56</option>
+<option name="pagewidth" type="integer" change-action="none">80</option>
+<option name="quiet" type="boolean" change-action="none">true</option>
+<option name="revaa" type="boolean" change-action="rebuild">false</option>
+<option name="sdiopt" type="boolean" change-action="assemble">true</option>
+</options>
+</tool>
+<tool name="Compiler">
+<options>
+<option name="codegen" type="string" change-action="none">UserDefined</option>
+<option name="const" type="string" change-action="compile">RAM</option>
+<option name="define" type="string" change-action="compile">_Z8F6403,_Z16F_SERIES,_Z8ENCORE_640_FAMILY,_Z8ENCORE_F640X</option>
+<option name="genprintf" type="boolean" change-action="compile">true</option>
+<option name="keepasm" type="boolean" change-action="none">false</option>
+<option name="keeplst" type="boolean" change-action="none">true</option>
+<option name="list" type="boolean" change-action="none">false</option>
+<option name="listinc" type="boolean" change-action="none">false</option>
+<option name="model" type="string" change-action="compile">S</option>
+<option name="optlink" type="boolean" change-action="compile">false</option>
+<option name="promote" type="boolean" change-action="compile">true</option>
+<option name="regvar" type="string" change-action="compile">Normal</option>
+<option name="regvarcache" type="string" change-action="none">Normal</option>
+<option name="reduceopt" type="boolean" change-action="compile">false</option>
+<option name="stdinc" type="string" change-action="compile"></option>
+<option name="usrinc" type="string" change-action="compile"></option>
+<option name="watch" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Debugger">
+<options>
+<option name="target" type="string" change-action="rebuild"></option>
+<option name="debugtool" type="string" change-action="none">Simulator</option>
+<option name="zemul_enableevents" type="boolean" change-action="none">false</option>
+<option name="zemul_brkonfull" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">true</option>
+</options>
+</tool>
+<tool name="FlashProgrammer">
+<options>
+<option name="erasebeforeburn" type="boolean" change-action="none">false</option>
+<option name="eraseinfopage" type="boolean" change-action="none">false</option>
+<option name="offset" type="integer" change-action="none">0</option>
+<option name="snenable" type="boolean" change-action="none">false</option>
+<option name="sn" type="string" change-action="none">0</option>
+<option name="snsize" type="integer" change-action="none">0</option>
+<option name="snstep" type="integer" change-action="none">1</option>
+<option name="snstepformat" type="integer" change-action="none">0</option>
+<option name="snaddress" type="string" change-action="none">0</option>
+<option name="snformat" type="integer" change-action="none">0</option>
+<option name="snbigendian" type="boolean" change-action="none">true</option>
+<option name="singleval" type="string" change-action="none">0</option>
+<option name="singlevalformat" type="integer" change-action="none">0</option>
+<option name="usenvds" type="boolean" change-action="none">false</option>
+<option name="includeserial" type="boolean" change-action="none">false</option>
+<option name="usepageerase" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="General">
+<options>
+<option name="warn" type="boolean" change-action="none">true</option>
+<option name="debug" type="boolean" change-action="assemble">true</option>
+<option name="debugcache" type="boolean" change-action="none">true</option>
+<option name="igcase" type="boolean" change-action="assemble">false</option>
+<option name="outputdir" type="string" change-action="compile">.</option>
+</options>
+</tool>
+<tool name="Librarian">
+<options>
+<option name="outfile" type="string" change-action="build"></option>
+</options>
+</tool>
+<tool name="Linker">
+<options>
+<option name="createnew" type="boolean" change-action="build">false</option>
+<option name="directives" type="string" change-action="build"></option>
+<option name="edata" type="string" change-action="build">100-EFF</option>
+<option name="exeform" type="string" change-action="build">OMF695,INTEL32</option>
+<option name="flash" type="string" change-action="build">FF80-FFFF</option>
+<option name="fplib" type="string" change-action="build">Dummy</option>
+<option name="linkctlfile" type="string" change-action="build"></option>
+<option name="map" type="boolean" change-action="none">true</option>
+<option name="maxhexlen" type="integer" change-action="build">64</option>
+<option name="nvds" type="string" change-action="build">0-f</option>
+<option name="objlibmods" type="string" change-action="build"></option>
+<option name="of" type="string" change-action="build">.\ostest</option>
+<option name="padhex" type="boolean" change-action="build">false</option>
+<option name="pram" type="string" change-action="build">0-f</option>
+<option name="praminuse" type="boolean" change-action="build">false</option>
+<option name="quiet" type="boolean" change-action="none">false</option>
+<option name="rdata" type="string" change-action="build">20-FF</option>
+<option name="relist" type="boolean" change-action="build">false</option>
+<option name="rom" type="string" change-action="build">0-FFF</option>
+<option name="sort" type="string" change-action="none">name</option>
+<option name="startuptype" type="string" change-action="build">Standard</option>
+<option name="startuplnkcmds" type="boolean" change-action="build">true</option>
+<option name="undefisfatal" type="boolean" change-action="none">true</option>
+<option name="useadddirectives" type="boolean" change-action="build">false</option>
+<option name="usecrun" type="boolean" change-action="build">true</option>
+<option name="warnisfatal" type="boolean" change-action="none">false</option>
+<option name="warnoverlap" type="boolean" change-action="none">true</option>
+<option name="xref" type="boolean" change-action="none">false</option>
+</options>
+</tool>
+<tool name="Middleware">
+<options>
+<option name="usezsl" type="boolean" change-action="rebuild">true</option>
+<option name="zslports" type="string" change-action="rebuild"></option>
+<option name="zsluarts" type="string" change-action="rebuild"></option>
+<option name="zslpramisrs" type="string" change-action="rebuild"></option>
+</options>
+</tool>
+</tools>
+</configuration>
+</configurations>
+
+<!-- watch information -->
+<watch-elements>
+<watch-element expression="0x801d1a" />
+</watch-elements>
+
+<!-- breakpoint information -->
+<breakpoints>
+</breakpoints>
+
+<!-- ice event information -->
+<ice-events count="4" enable="0" breakOnFull="0">
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+<ice-event>
+<data>000000000000</data>
+<mask>000000000000</mask>
+<action>0</action>
+</ice-event>
+</ice-events>
+
+</project> \ No newline at end of file
diff --git a/nuttx/configs/z8f64200100kit/ostest/setenv.sh b/nuttx/configs/z8f64200100kit/ostest/setenv.sh
new file mode 100755
index 000000000..166ed9e0c
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/setenv.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# configs/z8f64200100kit/ostest/setenv.sh
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Check how we were executed
+#
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+#
+# The ZDS-II toolchain lies outside of the Cygwin "sandbox" and
+# attempts to set the PATH variable do not have the desired effect.
+# Instead, alias are provided for all of the ZDS-II command line tools.
+# Version 4.10.1 installed in the default location is assumed here.
+#
+ZDSBINDIR="C:/Program\ Files/ZiLOG/ZDSII_Z8Encore!_4.10.1/bin"
+alias ez8asm="${ZDSBINDIR}/ez8asm.exe"
+alias ez8cc="${ZDSBINDIR}/ez8cc.exe"
+alias ez8lib="${ZDSBINDIR}/ez8lib.exe"
+alias ez8link="${ZDSBINDIR}/ez8link.exe"
+
diff --git a/nuttx/configs/z8f64200100kit/ostest/test-result.txt b/nuttx/configs/z8f64200100kit/ostest/test-result.txt
new file mode 100644
index 000000000..ebf178439
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/ostest/test-result.txt
@@ -0,0 +1,529 @@
+This is the output from the z16f target from January 31, 2008
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+While all tests pass per this output, my impression is that some
+of the timed delays in during execution of the test were not
+correct and I suspect some system timing issues.
+
+stdio_test: write fd=1
+stdio_test: write fd=2
+stdio_test: Standard I/O Check: printf
+user_start: putenv(Variable1=BadValue3)
+user_start: setenv(Variable1, GoodValue1, TRUE)
+user_start: setenv(Variable2, BadValue1, FALSE)
+user_start: setenv(Variable2, GoodValue2, TRUE)
+user_start: setenv(Variable3, Variable3, FALSE)
+user_start: setenv(Variable3, Variable3, FALSE)
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+user_start: Started user_main at PID=2
+stdio_test: Standard I/O Check: fprintf to stderr
+
+user_main: Begin argument test
+user_main: Started with argc=5
+user_main: argv[0]="<noname>"
+user_main: argv[1]="Arg1"
+user_main: argv[2]="Arg2"
+user_main: argv[3]="Arg3"
+user_main: argv[4]="Arg4"
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 2
+mxordblk 76b20 76b20
+uordblks 33d0 33d0
+fordblks 78180 78180
+show_variable: Variable=Variable1 has value=GoodValue1
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has value=GoodValue2
+show_variable: Variable=Variable3 has value=GoodValue3
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 3
+mxordblk 76b20 76b20
+uordblks 33d0 33c0
+fordblks 78180 78190
+show_variable: Variable=Variable1 has no value
+show_variable: Variable=Variable2 has no value
+show_variable: Variable=Variable3 has no value
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 33c0 3380
+fordblks 78190 781d0
+
+user_main: /dev/null test
+dev_null: Read 0 bytes from /dev/null
+dev_null: Wrote 1024 bytes to /dev/null
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: mutex test
+Initializing mutex
+Starting thread 1
+Starting thread 2
+ Thread1 Thread2
+ Loops 32 32
+ Errors 0 0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: cancel test
+cancel_test: Test 1: Normal Cancelation
+cancel_test: Starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+cancel_test: Test 2: Cancelation of detached thread
+cancel_test: Re-starting thread
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+cancel_test: PASS pthread_join failed with status=ESRCH
+cancel_test: Test 3: Non-cancelable threads
+cancel_test: Re-starting thread (non-cancelable)
+restart_thread: Destroying cond
+restart_thread: Destroying mutex
+restart_thread: Re-starting thread
+start_thread: Initializing mutex
+start_thread: Initializing cond
+start_thread: Starting thread
+thread_waiter: Taking mutex
+thread_waiter: Starting wait for condition
+thread_waiter: Setting non-cancelable
+start_thread: Yielding
+cancel_test: Canceling thread
+cancel_test: Joining
+thread_waiter: Releasing mutex
+thread_waiter: Setting cancelable
+cancel_test: waiter exited with result=ffffffff
+cancel_test: PASS thread terminated with PTHREAD_CANCELED
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: semaphore test
+sem_test: Initializing semaphore to 0
+sem_test: Starting waiter thread 1
+sem_test: Set thread 1 priority to 191
+waiter_func: Thread 1 Started
+waiter_func: Thread 1 initial semaphore value = 0
+waiter_func: Thread 1 waiting on semaphore
+sem_test: Starting waiter thread 2
+sem_test: Set thread 2 priority to 128
+waiter_func: Thread 2 Started
+waiter_func: Thread 2 initial semaphore value = -1
+waiter_func: Thread 2 waiting on semaphore
+sem_test: Starting poster thread 3
+sem_test: Set thread 3 priority to 64
+poster_func: Thread 3 started
+poster_func: Thread 3 semaphore value = -2
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 1 awakened
+waiter_func: Thread 1 new semaphore value = -1
+waiter_func: Thread 1 done
+poster_func: Thread 3 new semaphore value = -1
+poster_func: Thread 3 semaphore value = -1
+poster_func: Thread 3 posting semaphore
+waiter_func: Thread 2 awakened
+waiter_func: Thread 2 new semaphore value = 0
+waiter_func: Thread 2 done
+poster_func: Thread 3 new semaphore value = 0
+poster_func: Thread 3 done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: condition variable test
+cond_test: Initializing mutex
+cond_test: Initializing cond
+cond_test: Starting waiter
+cond_test: Set thread 1 priority to 128
+waiter_thread: Started
+cond_test: Starting signaler
+cond_test: Set thread 2 priority to 64
+thread_signaler: Started
+thread_signaler: Terminating
+cond_test: signaler terminated, now cancel the waiter
+cond_test: Waiter Signaler
+cond_test: Loops 32 32
+cond_test: Errors 0 0
+cond_test:
+cond_test: 0 times, waiter did not have to wait for data
+cond_test: 0 times, data was already available when the signaler run
+cond_test: 0 times, the waiter was in an unexpected state when the signaler ran
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed wait test
+thread_waiter: Initializing mutex
+timedwait_test: Initializing cond
+timedwait_test: Starting waiter
+timedwait_test: Set thread 2 priority to 177
+thread_waiter: Taking mutex
+thread_waiter: Starting 5 second wait for condition
+timedwait_test: Joining
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+thread_waiter: pthread_cond_timedwait timed out
+thread_waiter: Releasing mutex
+thread_waiter: Exit with status 0x12345678
+timedwait_test: waiter exited with result=12345678
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: message queue test
+mqueue_test: Starting receiver
+mqueue_test: Set receiver priority to 128
+receiver_thread: Starting
+mqueue_test: Starting sender
+mqueue_test: Set sender thread priority to 64
+mqueue_test: Waiting for sender to complete
+sender_thread: Starting
+receiver_thread: mq_receive succeeded on msg 0
+sender_thread: mq_send succeeded on msg 0
+receiver_thread: mq_receive succeeded on msg 1
+sender_thread: mq_send succeeded on msg 1
+receiver_thread: mq_receive succeeded on msg 2
+sender_thread: mq_send succeeded on msg 2
+receiver_thread: mq_receive succeeded on msg 3
+sender_thread: mq_send succeeded on msg 3
+receiver_thread: mq_receive succeeded on msg 4
+sender_thread: mq_send succeeded on msg 4
+receiver_thread: mq_receive succeeded on msg 5
+sender_thread: mq_send succeeded on msg 5
+receiver_thread: mq_receive succeeded on msg 6
+sender_thread: mq_send succeeded on msg 6
+receiver_thread: mq_receive succeeded on msg 7
+sender_thread: mq_send succeeded on msg 7
+receiver_thread: mq_receive succeeded on msg 8
+sender_thread: mq_send succeeded on msg 8
+receiver_thread: mq_receive succeeded on msg 9
+sender_thread: mq_send succeeded on msg 9
+sender_thread: returning ntcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=0
+Resuming
+errors=0
+mqueue_test: Killing receiver
+receiver_thread: mq_receive interrupted!
+receiver_thread: returning nerrors=0
+mqueue_test: Canceling receiver
+mqueue_test: receiver has already terminated
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: timed message queue test
+timedmqueue_test: Starting sender
+sender_thread: Starting
+sender_thread: mq_timedsend succeeded on msg 0
+sender_thread: mq_timedsend succeeded on msg 1
+timedmqueue_test: Waiting for sender to complete
+sender_thread: mq_timedsend succeeded on msg 2
+sender_thread: mq_timedsend succeeded on msg 3
+sender_thread: mq_timedsend succeeded on msg 4
+sender_thread: mq_timedsend succeeded on msg 5
+sender_thread: mq_timedsend succeeded on msg 6
+sender_thread: mq_timedsend succeeded on msg 7
+sender_thread: mq_timedsend succeeded on msg 8
+sender_thread: mq_timedsend 9 timed out as expected
+sender_thread: returning nerrors=0
+timedmqueue_test: Starting receiver
+receiver_thread: Starting
+receiver_thread: mq_timedreceive succeeded on msg 0
+receiver_thread: mq_timedreceive succeeded on msg 1
+receiver_thread: mq_timedreceive succeeded on msg 2
+receiver_thread: mq_timedreceive succeeded on msg 3
+timedmqueue_test: Waiting for receiver to complete
+receiver_thread: mq_timedreceive succeeded on msg 4
+receiver_thread: mq_timedreceive succeeded on msg 5
+receiver_thread: mq_timedreceive succeeded on msg 6
+receiver_thread: mq_timedreceive succeeded on msg 7
+receiver_thread: mq_timedreceive succeeded on msg 8
+receiver_thread: Receive 9 timed out as expected
+receiver_thread: returning nerrors=0
+timedmqueue_test: Test complete
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 3
+mxordblk 76b20 76b20
+uordblks 3380 3380
+fordblks 781d0 781d0
+
+user_main: signal handler test
+sighand_test: Initializing semaphore to 0
+sighand_test: Starting waiter task
+sighand_test: Started waiter_main pid=20
+waiter_main: Waiter started
+waiter_main: Unmasking signal 17
+waiter_main: Registering signal handler
+waiter_main: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+waiter_main: Waiting on semaphore
+tcb=0x8057d0 sigdeliver=0x13046
+rtcb=0x806e30 current_regs=0x0
+sighand_test: Signaling pid=20 with signo=17 sigvalue=42
+rtcb=8057d0 sigdeliver=13046 sigpendactionq.head=804b10
+Resuming
+wakeup_action: Received signal 17
+wakeup_action: sival_int=42
+wakeup_action: si_code=1
+wakeup_action: ucontext=0
+waiter_main: sem_wait() successfully interrupted by signal
+waiter_main: done
+sighand_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 3 4
+mxordblk 76b20 76b20
+uordblks 3380 35c0
+fordblks 781d0 77f90
+
+user_main: POSIX timer test
+timer_test: Initializing semaphore to 0
+timer_test: Unmasking signal 17
+timer_test: Registering signal handler
+timer_test: oact.sigaction=0 oact.sa_flags=0 oact.sa_mask=0
+timer_test: Creating timer
+timer_test: Starting timer
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b23
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=1
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b36
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=2
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf7a
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b49
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=3
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf76
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b5c
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=4
+timer_test: Waiting on semaphore
+tcb=0x806e30 sigdeliver=0x13046
+rtcb=0x8000c8 current_regs=0xffffbf66
+rtcb=806e30 sigdeliver=13046 sigpendactionq.head=804b6f
+Resuming
+timer_expiration: Received signal 17
+timer_expiration: sival_int=42
+timer_expiration: si_code=2 (SI_TIMER)
+timer_expiration: ucontext=0
+timer_test: sem_wait() successfully interrupted by signal
+timer_test: g_nsigreceived=5
+timer_test: Deleting timer
+timer_test: done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: round-robin scheduler test
+rr_test: Starting sieve1 thread
+rr_test: Set thread priority to 1
+rr_test: Set thread policty to SCHED_RR
+rr_test: Starting sieve1 thread
+sieve1 started
+rr_test: Waiting for sieves to complete -- this should take awhile
+rr_test: If RR scheduling is working, they should start and complete at
+rr_test: about the same time
+sieve2 started
+sieve1 finished
+sieve2 finished
+rr_test: Done
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+user_main: barrier test
+barrier_test: Initializing barrier
+barrier_func: Thread 0 started
+barrier_test: Thread 0 created
+barrier_func: Thread 1 started
+barrier_test: Thread 1 created
+barrier_func: Thread 2 started
+barrier_test: Thread 2 created
+barrier_func: Thread 3 started
+barrier_test: Thread 3 created
+barrier_func: Thread 0 calling pthread_barrier_wait()
+barrier_func: Thread 1 calling pthread_barrier_wait()
+barrier_func: Thread 2 calling pthread_barrier_wait()
+barrier_func: Thread 4 started
+barrier_test: Thread 4 created
+barrier_func: Thread 3 calling pthread_barrier_wait()
+barrier_func: Thread 4 calling pthread_barrier_wait()
+barrier_func: Thread 5 started
+barrier_test: Thread 5 created
+barrier_func: Thread 6 started
+barrier_test: Thread 6 created
+barrier_func: Thread 7 started
+barrier_test: Thread 7 created
+barrier_func: Thread 5 calling pthread_barrier_wait()
+barrier_func: Thread 6 calling pthread_barrier_wait()
+barrier_func: Thread 7 calling pthread_barrier_wait()
+barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM SPECIAL)
+barrier_func: Thread 0, back with status=0 (I am not special)
+barrier_func: Thread 1, back with status=0 (I am not special)
+barrier_func: Thread 2, back with status=0 (I am not special)
+barrier_func: Thread 3, back with status=0 (I am not special)
+barrier_func: Thread 4, back with status=0 (I am not special)
+barrier_func: Thread 5, back with status=0 (I am not special)
+barrier_func: Thread 6, back with status=0 (I am not special)
+barrier_func: Thread 2 done
+barrier_func: Thread 7 done
+barrier_func: Thread 0 done
+barrier_func: Thread 1 done
+barrier_func: Thread 6 done
+barrier_func: Thread 3 done
+barrier_func: Thread 4 done
+barrier_func: Thread 5 done
+barrier_test: Thread 0 completed with result=0
+barrier_test: Thread 1 completed with result=0
+barrier_test: Thread 2 completed with result=0
+barrier_test: Thread 3 completed with result=0
+barrier_test: Thread 4 completed with result=0
+barrier_test: Thread 5 completed with result=0
+barrier_test: Thread 6 completed with result=0
+barrier_test: Thread 7 completed with result=0
+
+End of test memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 4 4
+mxordblk 76b20 76b20
+uordblks 35c0 35c0
+fordblks 77f90 77f90
+
+Final memory usage:
+VARIABLE BEFORE AFTER
+======== ======== ========
+arena 7b550 7b550
+ordblks 2 4
+mxordblk 76b20 76b20
+uordblks 33d0 35c0
+fordblks 78180 77f90
+user_main: Exitting
+
diff --git a/nuttx/configs/z8f64200100kit/src/Makefile b/nuttx/configs/z8f64200100kit/src/Makefile
new file mode 100644
index 000000000..c9c9b36e2
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/src/Makefile
@@ -0,0 +1,84 @@
+############################################################################
+# configs/z8f64200100kit/Makefile
+#
+# Copyright (C) 2008 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+-include $(TOPDIR)/Make.defs
+
+ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
+USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
+INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = z8_lowinit.c z8_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+
+all: libboard$(LIBEXT)
+
+$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
+ @$(CPP) $(CPPFLAGS) `cygpath -w $<` -o $@.tmp
+ @cat $@.tmp | sed -e "s/^#/;/g" > $@
+ @rm $@.tmp
+
+$(AOBJS): %$(OBJEXT): %$(ASMEXT)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f libboard$(LIBEXT) *~ .*.swp
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+-include Make.dep
diff --git a/nuttx/configs/z8f64200100kit/src/z8_leds.c b/nuttx/configs/z8f64200100kit/src/z8_leds.c
new file mode 100644
index 000000000..c5b6ec8af
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/src/z8_leds.c
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * configs/z8f64200100kit/src/z8_leds.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/board/board.h>
+#include "up_internal.h"
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_ledinit
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void up_ledinit(void)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledon
+ ****************************************************************************/
+
+void up_ledon(int led)
+{
+}
+
+/****************************************************************************
+ * Name: up_ledoff
+ ****************************************************************************/
+
+void up_ledoff(int led)
+{
+}
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/nuttx/configs/z8f64200100kit/src/z8_lowinit.c b/nuttx/configs/z8f64200100kit/src/z8_lowinit.c
new file mode 100644
index 000000000..41782e69f
--- /dev/null
+++ b/nuttx/configs/z8f64200100kit/src/z8_lowinit.c
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * configs/z8f64200100kit/src/z8_lowinit.c
+ *
+ * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Based upon sample code included with the Zilog ZDS-II toolchain.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ * Included Files
+ ***************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip/chip.h"
+
+/***************************************************************************
+ * Definitions
+ ***************************************************************************/
+
+/***************************************************************************
+ * Private Functions
+ ***************************************************************************/
+
+static void z8_gpioinit(void)
+{
+}
+
+/***************************************************************************
+ * Public Functions
+ ***************************************************************************/
+
+void z8_lowinit(void)
+{
+ z8_gpioinit();
+}
+